Skip to content

Instantly share code, notes, and snippets.

@davidlee
Created June 17, 2011 10:05
Show Gist options
  • Save davidlee/1031158 to your computer and use it in GitHub Desktop.
Save davidlee/1031158 to your computer and use it in GitHub Desktop.
MNEM - the object database I'd quite like
;; This buffer is for notes you don't want to save, and for Lisp
;; evaluation. If you want to create a file, visit that file with C-x
;; C-f, then enter the text in that file's own buffer.
MNEM
An object database which stores and manipulates simple structures of
data (hashes, arrays, strings, and numbers), knows how to talk JSON,
keeps a copy of everything that has ever been entered, and implements
updates as pull requests.
Versioning is deeply baked in. Each database is just an object; the
data structures are collections of references, to either other data
structures or value objects. Values are immutable; they are "updated"
by cloning the previous version of a database, updating the reference
to the new object, and sending an "object diff" to the owner of the
first database; if accepted, the owner clones the previous version of
the database, applies the diff, and updates the database's current
version reference to point to the new version. In this way, nothing is
ever destroyed, and updates can be consumed individually, with the
decision to do so based on the merits of their contents, rather than
granting pre-emptive permissions as is more traditional. Essentially,
it's git for complex objects rather than text files.
Each version may also have a set of metadata which can be used to
store comments, urls to other representations of the data, information
about the author, etc.
A database may have a schema to which it must adhere. A schema is just
an pointer; databases are validated against their schema by sending a
JSON representation of the data to an external service. Or, perhaps
there is a way to satisfactorily model a good, generic validation DSL
inside the database.
The first version will be purely an in-memory database, with all the
limitations that come with that. Simple persistence - writing a binary
dump of memory - is an obvious and cheap improvement, but it would be
nice to be able to write out a transaction log which can be replayed,
and possibly to allow databases larger than available memory.
All writes are atomic. It should be able to support transactions at
some stage. At some point references to data at urls rather than
memory locations might be interesting. File under "scaling, can of
worms".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment