Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

u8sand/level-mount

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

level-mount

Mount multiple leveldown compatible stores by key prefix onto a single store.

LevelMount, like file system directory mounts and somewhat like the opposite of subleveldown. Can be used with subleveldown. Examples:

const hybrid_db = levelup(levelmount({
  db: leveldown('root'),
  options: {}, // options for leveldown open
  mounts: [
    {
      mount: '!tmp!',
      db: memdown(),
    },
    {
      mount: '!var!',
      db: someotherdown(),
      options: {}, // someotherdown options for leveldown open
    }
  ],
})

hybrid_db.put('hello', 'world') // ends up in root leveldown with key `hello`
hybrid_db.put('!tmp!blah', 'bleh') // ends up in memdown with key `blah`

const var_db = subleveldown(hybrid_db, 'var', { separator: '!' })
var_db.put('goodbye', 'world') // ends up in someotherdown with key `goodbye`

levelmount is a abstract leveldown complaint store meaning all other operations are also supported (batch, iterators, etc..) and work the way you'd expect. Iteration across multiple leveldbs seemlessly enables you to segregate key prefixes by store enabling things like storing indexes in different databases from the data itself!

About

Mount multiple leveldown compatible stores by key prefix onto a single store.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.