-
Hey there, I am trying to serialize some data with msgpackr, and both send it over a webhook, as well as persist it inside of lmdb. I've found some helpful resources but am struggling with the specifics about how to string them together:
but will there be conflicts when attempting to connect both at the same time? aka: const db = open({
path: fp,
sharedStructuresKey: Symbol.for("structs"),
});
const packr = new Packr({
getStructures: () => db.get(Symbol.for("structs")) || [],
saveStructures: (s) => db.putSync(Symbol.for("structs"), s),
}); It would be lovely to be able to pass in my own Encoder object as a custom encoder into lmdb.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think they may conflict, or result in unsynced structures. I would recommend you simply use the encoder that lmdb-js creates:
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).
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 |
Beta Was this translation helpful? Give feedback.
I think they may conflict, or result in unsynced structures. I would recommend you simply use the encoder that lmdb-js creates:
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).
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…