question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable abstract-leveldown stores to emit events for levelup

See original GitHub issue

In some cases, an underlying store may change via some other external event, it would be nice if it were possible to capture this and utilize it in the levelup event emitter.

Example: browser localStorage can be updated on a different browser window; if we catch it we could potentially trigger a levelup.emit('put', key, val).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
vweeverscommented, Dec 27, 2018

But I hope this discussion can continue to consider this feature being an added part to abstract leveldown. As mentioned, there are certainly at least a few stores which could be extended to take advantage of this already.

Yes!

1reaction
u8sandcommented, Dec 27, 2018

Google Drive documents can be modified at any time, suppose we’re writing key/values to a database which is built out of a google drive document–say just a JSON text file, location refers to the name of the file. We can do batch writes and reads to that file and eventually flush it to the remote store (google drive).

But because it’s google drive, that file may have changed since the last time we looked at it, effectively causing some batch put/delete to our store (not by us directly, so we would not have called “put” or “del” explicitly)–if we can emit those events, our application will be aware of how our underlying store has mutated. It can then update whatever information used to be in it if keys were overwritten or deleted, etc…

The alternative to this is to constantly sync to an in-memory store of some kind, which may not be desirable if, for instance it’s too big to fit in memory. We can use things like cachedown to speed up these potentially slow remote dbs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

levelup/UPGRADING.md at master · Level/levelup - GitHub
A wrapper for abstract-leveldown compliant stores, for Node.js and browsers. ... function and there was an error, levelup would emit an error event...
Read more >
Level-js: An Abstract-leveldown Compliant Store on top Of ...
In today's post we will learn about Level-js: An abstract-leveldown compliant store on top of IndexedDB. Level which conveniently bundles levelup, level-js ...
Read more >
levelup | Yarn - Package Manager
A Node.js wrapper for abstract-leveldown compliant stores, which follow the characteristics of LevelDB. LevelDB is a simple key-value store built by Google.
Read more >
abstract-leveldown - npm
Start using abstract-leveldown in your project by running `npm i ... There are 204 other projects in the npm registry using abstract-leveldown.
Read more >
https://raw.githubusercontent.com/rvagg/node-level...
_levelup` property ([`cfce6bb`](https://github.com/Level/levelup/commit/cfce6bb)) (Vincent Weevers). - Align `nextTick` behavior with `abstract-leveldown` ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found