((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/leveldb" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "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.")) (section 2 "leveldb" (toc) (section 3 "Description" (p "Bindings to " (link "https://code.google.com/p/leveldb/" "LevelDB") ", a fast and lightweight key/value database library by Google. Provides an implementation of the " (link "https://wiki.call-cc.org/eggref/4/level" "level") " egg. Include both eggs to provide the API used in these examples.")) (section 3 "Examples" (section 4 "Basic operation" (highlight scheme "    \n(use level leveldb)\n\n(define db (open-db \"./example\"))\n\n(db-put db \"hello\" \"world\")\n(display (db-get db \"hello\")) ;; => world\n(db-delete db \"hello\")\n\n(close-db db)")) (section 4 "Batches and ranges" (highlight scheme "    \n(use level leveldb lazy-seq)\n\n(define operations\n  '((put \"name:123\" \"jane\")\n    (put \"name:456\" \"joe\")))\n\n(define (print-names pairs)\n  (lazy-each print pairs))\n\n(call-with-db \"./example\"\n  (lambda (db)\n    (db-batch db operations)\n    (print-names (db-pairs db start: \"name:\" end: \"name::\"))))\n\n;; prints\n;; => (name:123 jane)\n;; => (name:456 joe)"))) (section 3 "API" (def (sig (procedure "(open-db loc #!key (create #t) (exists #t))" (id open-db))) (p "Opens database with path " (tt "loc") " and returns a database object. By default, this method will create the database if it does not exist at " (tt "loc") " and will not error if the database already exists. This behaviour can be modified using the keyword arguments. Setting " (tt "exists") " to " (tt "#f") " will mean an exception occurs if the database already exists. Setting " (tt "create") " to " (tt "#f") " will mean an exception occurs if the database does not exist.")) (def (sig (procedure "(close-db db)" (id close-db))) (p "Closes database " (tt "db") ".")) (def (sig (procedure "(call-with-db loc proc #!key (create #t) (exists #t))" (id call-with-db))) (p "Opens database at " (tt "loc") " and calls (proc db). The database will be closed when proc returns or raises an exception."))) (section 3 "Source code / issues" (p (link "https://github.com/caolan/chicken-leveldb"))) (section 3 "Changelog" (section 4 "4.0.0" (ul (li "update to new level interface (v3.0.0):") (li "remove db-stream, add db-keys, db-values and db-pairs") (li "change missing key condition to type (exn level not-found) instead of (exn leveldb not-found)"))) (section 4 "3.0.3" (ul (li "add test-generative as dependency"))) (section 4 "3.0.2" (ul (li "add missing miscmacros dependency"))) (section 4 "3.0.1" (ul (li "fixed out of date dependencies in meta file"))) (section 4 "3.0.0" (ul (li "Re-written using the LevelDB C API ") (li "All conditions are now of type (exn leveldb)") (li "Uses new level egg interface and added db-get/default support") (li "db-stream now returns key+value combinations as pairs instead of lists eg, ((\"key\" . \"value\")) instead of ((\"key\" \"value\"))") (li "all write operations now return #<unspecified> instead of #t"))))))