Tools for (key, value)-list streams/files/databases
See the --help
pages (linked) for details.
...kv32... | kv-map --bash 'convert ppm:- png:-' | ...kv32...
...kv32... | kv-map \
--temp-dir /Volumes/ramdisk \
--bash 'optipng $VALUE_FILE -out $RESULT_FILE -o7 -strip all -silent' | ...kv32...
...kv32... | kv-keys | ...(k + "\n") for k in keys...
... | kv32-to-leveldb $DB_DIR
leveldb-to-kv32 $DB_DIR | ...
ev-values -k $KEY foo.ev | ...concatenated values for key $KEY...
Reading/writing kv32:
from kvtools import kv32_iteritems, kv32_write_item
for key, value in kv32_iteritems(sys.stdin):
kv32_write_item(sys.stdout, key, value)
To concatenate fixed-width events as a matrix, using the C library under the hood:
from kvtools import EVFile
m = EVFile(data).event_as_matrix(event_code, ncols=7, dtype=numpy.dtype('float64'))
Install it however you like, e.g. via:
export PYTHONPATH="$PYTHONPATH:/.../key-value-tools/python"
All functions return NULL
or an error message.
char* kvtool_ev_values_size_for_event(void *ev, uint64_t ev_size, uint64_t event_code, uint64_t *values_size);
char* kvtool_ev_extract_values (void *ev, uint64_t ev_size, uint64_t event_code, void *values, uint64_t values_size);
brew install leveldb
bash build.sh
A LevelDB database directory.
The kv32 bytestream is a concatenation of zero or more of these:
key_size : uint32le
value_size : uint32le
key : bytes
value : bytes
The ev bytestream is a concatenation of zero or more of these:
event_code : unsigned varint (protobuf-style)
value_size : unsigned varint (protobuf-style)
value : bytes
Support these:
- SQLite file
- Hadoop SequenceFile
- Cassandra bulk import/export JSON
- SQL
INSERT
statements with N rows per statement