https://github.com/codr7/whirlog Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} codr7 / whirlog * Notifications * Star 18 * Fork 0 a minimal versioned log structured relational DB in Common Lisp 18 stars 0 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 0 tags Code Clone HTTPS GitHub CLI [https://github.com/c] Use Git or checkout with SVN using the web URL. [gh repo clone codr7/] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @codr7 codr7 description ... 0f8052b Jun 28, 2021 description 0f8052b Git stats * 69 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .gitignore added context Feb 28, 2021 README.md description Jun 28, 2021 lisp.png commit improvements/readme Mar 5, 2021 rb.lisp Shedulr bugfix. Jun 25, 2021 sort.lisp example Jun 28, 2021 todo.org Added lazy? flag. Jun 19, 2021 util.lisp Remove debug. Jun 25, 2021 whirlog.asd description Jun 28, 2021 whirlog.lisp Always decode. Jun 26, 2021 View code Whirlog Introduction Databases Contexts Tables Keys Records Versioning Threads README.md Lisp Mascot Whirlog Introduction Whirlog is a minimal versioned log structured relational DB implemented in Common Lisp. (let-tables ((tbl (key :key? t) val)) (with-db ("/tmp/db/" (tbl)) (let ((rec (new-record 'key "foo" 'val "bar"))) (do-context () (store-record tbl rec) (assert (string= (column-value (find-record tbl #("foo")) 'val) "bar"))) (do-context () (let ((rec (set-column-values rec 'val "baz"))) (store-record tbl rec)) (assert (string= (column-value (find-record tbl #("foo")) 'val) "baz")))) (do-context () (delete-record tbl #("foo")) (assert (null (find-record tbl #("foo"))))))) You may find a more real worldish example here. Databases Databases are implemented as directories containing one file per table. with-db may be used to indicate a root path and open/close specified tables. Contexts Contexts are independent atomic transactions. Changes are committed on success and rolled back on error by default, but the behavior may be customized by manually calling commit-changes and/or rollback-changes as needed. Tables Tables are implemented as persistent, ordered trees of lazy loaded records. Each table has a set of columns and a key. Keys Keys are compared using whirlog:compare-column which defaults to rb:compare. Records Records are implemented as immutable lists of pairs (or alists); and written as is to disk. This means that any readable/writeable value will do as field value, and that log files are human readable as well as trivial to process. #("foo")((WHIRLOG::VAL . "bar")) #("foo")((WHIRLOG::VAL . "baz")) #("foo"):D Versioning Each logged version of a record (as identified by its key) is available on demand. Threads Threaded table access has to be protected either by enclosing in do-sync or passing :sync? t (which is the default) where appropriate. Calls that require exclusive table access will eventually fail with an error unless they're able to acquire a table specific spinlock implemented using SBCL atomics. About a minimal versioned log structured relational DB in Common Lisp Resources Readme Releases No releases published Packages 0 No packages published Languages * Common Lisp 100.0% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.