heapwolf / ldb Goto Github PK
View Code? Open in Web Editor NEWA C++ REPL / CLI for LevelDB
License: MIT License
A C++ REPL / CLI for LevelDB
License: MIT License
In lev
, things got ugly for a while because each feature/command grew in complexity. It would be nice to just start off with each feature/command in it's own file.
@jwerle Would it be easy to add clib/leveldb as a dependency instead of having the code checked in?
This is on Debian Jessie/Sid, with Linux kernel 4.0.0 on amd64.
g++ -o ldb ldb.cc ./lib/*.cc -I./deps/leveldb/include -std=gnu++11 -lpthread ./deps/leveldb/libleveldb.a -lsnappy ./linenoise.o
g++: error: ./deps/leveldb/libleveldb.a: No such file or directory
Makefile:28: recipe for target 'ldb' failed
make: *** [ldb] Error 1
I can see that the libleveldb.a file is not in the deps/leveldb
directory, but one level down, in the out-static
directory:
~/src/ldb$ ls deps/leveldb/
AUTHORS build_detect_platform* db/ helpers/ issues/ Makefile out-shared/ port/ table/ util/
build_config.mk CONTRIBUTING.md doc/ include/ LICENSE NEWS out-static/ README.md TODO
~/src/ldb$ ls deps/leveldb/out-static/libleveldb.a
deps/leveldb/out-static/libleveldb.a
on auto completion, show suggestions with colorised prefixes.
The node module level-sublevel
gives you a way to fake tables in leveldb, which is nice. It lets you pick a separator or defaults to \xff
, then only iterates keys according to the currently selected prefix. It might be nice to make a c++ version of sublevel... Thoughts?
Working on a patch for the Makefile
now
snappy is not getting linked atm -- should be simple.
There should be something like base64 support for keys and values.
...todo.
Hi there,
I'm interested in using ldb in a bash script. Is there a way I can run ldb ./testdb --create without going into REPL mode?
For example I want to create the db if it doesn't exist and then put a key into it.
But now, ldb ./testdb --create is blocking! :/
Why does README.md point to github.com/**0x00a**/ldb.git
? Shouldn't it be github.com/**hxoht**/ldb.git
?
The 0x00a looks strange and is not explained anywhere. It should at least be explained. The user 0x00a does not appear to be a contributor to this project, and his (I assume?) fork of the project is not public. Given that the official LevelDB homepage (http://leveldb.org) links to this project (the project under which I am posting this issue), I think this should be cleaned up or explained, because it looks potentially untrustworthy.
should say how to use.
Something I've been doing with some clibs is keeping there deps/
in my repo. It will allow a user who doesn't have clibs to use ldb
without having to be dep'd on clibs :]
If a user types clib install hij1nx/ldb
it will fetch linenoise
anyways. If a user clones they will still be fine because linenoise is also there too !
What do you think ?
After you find the first whitespace, the remainder of the input gets parsed. We need a key and value. That seems simple but keys and values can have anything in them. So the question is, how should we "split" the rest of the value?
Hi, I'm following the usage example shown here.
Here is my result:
ldb ./db --put foo --value bar
In excecutable 'ldb':
Unrecognized flag/option './db'
Could you provide any tips? I'm interested to write a simple bash script to populate the database, but this is stopping me.
On the other hand, this command actually works:
ldb -i ./db -c
Then, I'm able to successfully do:
> put foo;bar
>
> get foo
bar
Machine:- Ubuntu
State:- clib installed successfully.
command "clib -v" shows 1.5.0
When running command "clib install hij1nx/ldb" It says
fetch : hij1nx/ldb:package.json
gzip: ldb-0.0.2.tar.gz: not in gzip format
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
Is it due to "ldb-0.0.2.tar.gz" is not a compressed file ?
Brew part is ok:
1. brew install snappy
Result:
==> Pouring snappy-1.1.7_1.high_sierra.bottle.tar.gz
2. git Part is ok
3. make install -C ldb
its NOT ok
Result:
make -C ./deps/leveldb
make[1]: *** No targets specified and no makefile found. Stop.
make: *** [leveldb] Error 2
Unfortunately I am not a make-scripts expert :-(.
Thx
Can you make some new releases of the latest commit?
The REPL correctly lists a moderately sized leveldb test db:
$ du -hs .
76M .
But it crashes when I'm about to tab-complete one of the keys:
$ ldb -i .
> get a
terminate called after throwing an instance of 'std::regex_error'
what(): regex_error
Aborted
Those keys have a format such as:
abu/day/foobaruserid/2015-05-15
determine the encoding, if it is JSON, pretty print it with color
otherwise SIGABRT
ls libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: basic_string.
make
on a fresh checkout results in:
[ . . . ]
c++ -I./deps/leveldb/include -std=gnu++11 -stdlib=libc++ -I. -I./include -DOS_MACOSX -DLEVELDB_PLATFORM_POSIX -DSNAPPY -O2 -DNDEBUG -c port/port_posix.cc -o port/port_posix.o
rm -f libleveldb.a
ar -rs libleveldb.a db/builder.o db/c.o db/db_impl.o db/db_iter.o db/dbformat.o db/filename.o db/log_reader.o db/log_writer.o db/memtable.o db/repair.o db/table_cache.o db/version_edit.o db/version_set.o db/write_batch.o table/block.o table/block_builder.o table/filter_block.o table/format.o table/iterator.o table/merger.o table/table.o table/table_builder.o table/two_level_iterator.o util/arena.o util/bloom.o util/cache.o util/coding.o util/comparator.o util/crc32c.o util/env.o util/env_posix.o util/filter_policy.o util/hash.o util/histogram.o util/logging.o util/options.o util/status.o port/port_posix.o
ar: creating archive libleveldb.a
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ./deps/snappy-1.1.1
make[1]: *** No targets specified and no makefile found. Stop.
make: *** [snappy] Error 2
looks like we're expecting a makefile in ./deps/snappy-1.1.1, but there's nothing there :/
Receiving objects: 100% (21/21), 30.52 KiB | 781.00 KiB/s, done.
Resolving deltas: 100% (1/1), done.
c++ -o ldb ldb.cc ./lib/*.cc ./deps/docopt/docopt.cpp -I./deps/leveldb/include -std=gnu++11 -stdlib=libc++ -lpthread -L/usr/local/lib ./deps/leveldb/build/libleveldb.a linenoise.o -lsnappy
ld: library not found for -lsnappy
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ldb] Error 1
This is a feature request. Have you thought about implementing chrome's idb_cmp1
comparitor to enable working natively with webkit IndexDB
storage?
This stack overflow question seems to outline some of what might be necessary: http://stackoverflow.com/questions/35074659/access-google-chromes-indexeddb-leveldb-outside-of-chrome
similar to this
library.
should be the width of the terminal.
Just build as mentioned in Readme.
g++ -o ldb ldb.cc ./lib/.cc -I./deps/leveldb/include -std=gnu++11 -lpthread -L/usr/local/include ./deps/leveldb/out-static/libleveldb.a linenoise.o
./deps/leveldb/out-static/libleveldb.a(table_builder.o): In function leveldb::TableBuilder::WriteBlock(leveldb::BlockBuilder_, leveldb::BlockHandle_)': table_builder.cc:(.text+0x92f): undefined reference to
snappy::MaxCompressedLength(unsigned long)'
table_builder.cc:(.text+0x96d): undefined reference tosnappy::RawCompress(char const_, unsigned long, char_, unsigned long_)' ./deps/leveldb/out-static/libleveldb.a(format.o): In function
leveldb::ReadBlock(leveldb::RandomAccessFile*, leveldb::ReadOptions const&, leveldb::BlockHandle const&, leveldb::BlockContents*)':
format.cc:(.text+0x4d9): undefined reference tosnappy::GetUncompressedLength(char const_, unsigned long, unsigned long_)' format.cc:(.text+0x5ae): undefined reference to
snappy::RawUncompress(char const, unsigned long, char_)'
collect2: error: ld returned 1 exit status
make: *** [ldb] Error 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.