Skip to content

Using msgpackr independantly with lmdb #286

Answered by kriszyp
cysabi asked this question in Q&A
Discussion options

You must be logged in to vote

I think they may conflict, or result in unsynced structures. I would recommend you simply use the encoder that lmdb-js creates:

const packr = db.encoder; // this will have the structure persistent set up for you

And you can serialize new records and they will be written from the database (and deserializing will read the structs from the database as needd).

db.getKeys({reverse: true, limit: 1}) ... is this terribly inefficient?

No, getting the iterable entry from this query is quite efficient, it should pretty efficiently find the largest/last key. I don't think there is an at method on RangeIterator though (although it is a good idea), you would just need to iterate and use the first/o…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@cysabi
Comment options

@kriszyp
Comment options

Answer selected by cysabi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants