-
-
Notifications
You must be signed in to change notification settings - Fork 16
Description
So, we have had quite a bit of discussion, and tried various approaches to implementing plugins in levelup
https://github.com/rvagg/node-levelup/issues/search?q=plugins
quick summation of what has happened so far, I started experimenting with a crude monkey patching based approach, but ran into trouble with handling ranges - each plugin had manage which ranges it affected, which was tricky. I later refactored this to create a subsection of the database, with level-sublevel. This is a great improvement, because it allows you to extend a range within leveldb as if it's a whole db.
@rvagg has also experimented with exposing various integration points into levelup, https://github.com/rvagg/node-levelup/issues/92
personally, I am highly in favor of combining these two, and even merging sublevel into levelup, or at least, adding integration points to levelup so that level-sublevel does not have to monkey patch it.
the question is: what is the list of integration points that we need?
- prehooks (intercept a mutation [batch, put, del])
- posthooks (intercept a mutation callback)
- encoding/key-encoding
- setup (register special jobs that run first, after the database opens,
- asynchronously delay mutations. **
** maybe. The ability to get the current values for keys before performing a mutation.
this would be useful for validation, and merging concurrent updates.
I have a plugin for this, but it hasn't been updated to work with level-sublevel yet. This differs from level-hooks, which only provides
a sync api.
A setup integration point will be useful for saving metadata about the database in the database, and maybe stuff like summaries about the current overall state - whether a schema change migration is complete, etc.
Any other suggestions?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status