Closed mikepb closed 12 years ago
Some thoughts in hindsight:
handle.get()
and batch.del()
already do this for keys; batch.put()
does this for both the key and value; there's the iterator.refSlice = true
option that makes this true for keys and values returned from the iterator as well.Will remove sync functions to simplify C++ code, other improvements before merging.
I'm satisfied with the stability of the new API:
cake build:coffee
to compile to JS. It more or less reads just as well.There are also some caveats from the requirements of the underlying leveldb library:
batch.write()
(async) with concurrentbatch.put()
orbatch.del()
will throw an error.iterator.self.refSlice = true
to return buffers which ref the returned leveldb Slice instances instead of copying the data into a new buffer. Doesn't work without theas_buffer
option for iterator read operations. The caveat is that the buffer is only valid until the next seek and may crash the program if used after seek. Use with care.Cheers.