kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
505 stars 41 forks source link

Subscribe to updates? #58

Closed KyleAMathews closed 3 years ago

KyleAMathews commented 3 years ago

Does LMDB have some sort of way of subscribing to changes? That'd make for a powerful way to communicate between processes.

kriszyp commented 3 years ago

No, LMDB doesn't offer any type of subscriptions. It is conceivable that it could be possible to modify or build on to LMDB itself in such a way that you could compare page numbers of cursor positions to search for changes between transactions, but that is certainly beyond what LMDB currently offers.

It is certainly true that LMDB pairs very nicely with inter-process communication. In our application we frequently send update notification over pipes, and only have to send the key of what was updated, and another process can quickly get the updated data directly from LMDB (and there is where resetReadTxn is important for ensuring consistency).

KyleAMathews commented 3 years ago

Ah yeah, sending keys directly to other processes would work great too. Thanks!