Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/sublevel|the CHICKEN 5 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. == sublevel [[toc:]] === Description Provides easy namespacing of keys inside a single LevelDB database. This is an implementation of the [[https://wiki.call-cc.org/eggref/4/level|level]] API. === Example use <enscript highlight="scheme">(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-pairs books)) ;; => (("book1" "foo") ("book2" "bar")) (lazy-seq->list (db-pairs cds)) ;; => () </enscript> === API <procedure>(sublevel db prefix)</procedure> Wraps a level implementation with namespaced access. Keys are generated by joining name space strings with the {{null}} character. <procedure>(expand-sublevels root db ops)</procedure> Takes a list of operations (as you would pass to the db-batch procedure) and expands the keys in the list to match the full key that would be written for the provdided sublevel(s). The key namespaces between 'root' and 'db' are expanded. The 'root' argument can be any level implementation (eg, a raw leveldb object or another sublevel). This can be useful if you find yourself needing to apply a transaction across multiple sublevels. You can use this for each sublevel to build the final batch operations list then use db-batch on the underlying resource. <enscript highlight="scheme"> ;; Example (define db (open-db "./my-database")) (define sub1 (sublevel db '("one"))) (define sub2 (sublevel sub1 '("two"))) (expand-sublevels db sub2 '((put "example" "value"))) ;; => '((put "one\x00two\x00example" "value")) (expand-sublevels sub1 sub2 '((put "example" "value"))) ;; => '((put "two\x00example" "value")) </enscript> === Source code / issues [[https://github.com/caolan/chicken-sublevel]] === Changelog ==== 4.0.0 * update to latest level egg api (v3.0.0) ==== 3.0.0 * update to latest level egg api (v2.0.0) ==== 2.0.0 * expand-sublevels now requires a 'root' argument to expand up until (backwards incompatible change) - this is to make sure it can be safely used by libraries operating inside external sublevels ==== 1.1.0 * added expand-sublevels procedure * now using records for underlying sublevel resources
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 5 to 11?