You are looking at historical revision 31154 of this page. It may differ significantly from its current revision.

sublevel

Provides easy namespacing of keys inside a single LevelDB database. This is an implementation of the level API.

Example use

    
(use level leveldb sublevel lazy-seq)

(define db (open-db "./my-database"))

(define books (sublevel db '("books")))
(define cds (sublevel db '("music" "cds")))

(db-put books "book1" "foo")
(db-put books "book2" "bar")

(lazy-seq->list (db-stream books)) ;; => (("book1" "foo") ("book2" "bar"))
(lazy-seq->list (db-stream cds)) ;; => ()

API

sublevel

    
(sublevel db prefix)

Wraps a level implementation with namespaced access. Keys are generated by joining name space strings with the null character.