Ordered Key-Value Store has a small user interface that give us another good good reason to have a look at processing, memory, permanence, and pointer swizzling.
A useable database must offer the following actions:
set
will store a piece a data;query
will fetch zero or more piece of data;delete
supposed to do what you think it will, but
you will not use it, and even when you do, it will just acknowledge you
made a wish;The primary question that comes to mind is: what is a piece of data?
In the OKVS paradigm, “piece of data” has two parts: the key, similar
to what LISP call car
, and the value, similar to what LISP
call cdr
. So set
may be described with
set(car, cdr)
, in more parenthetical terms
(set object other)
1. In an OKVS, key, and
value, respectively car
, and cdr
, or
object
, and other
, are sequences of ones and
zeros2. The user interface of the OKVS
paradigm use bit low level data representation.
Data that is binary sequences is a clue into why OKVS is fractal.
We know what is a piece of data: two bit sequences called
key
, and value
. The database is a list of
associations between a key
, and a value
. At
any given point in time, given a bit sequence, it can only be associated
once, and only once to another bit sequence.
Let’s consider a procedure that would be called get
. One
must divine that get
is a shortcut to
(get key)
that returns, if any, the value that was
associated with key
using (set key value)
.
Comes query
.
To be an interesting user interface action, query
must
subsume get
3. The procedure get
will
read, and return something, if any. The procedure query
will also read, and return nothing, return something , and opt-in to
return strictly more than one thing. If there is at least two results,
one should consider what comes first, what comes next, and if any what
comes last... That is why
there is an O in OKVS. We want to specify a sorting strategy. The
procedure query
returns paired bit sequences in their
natural order4. To cover all use cases, the sorted
subspace returned by query
is described using two bit
sequences called start
, and end
.
That is why OKVS is fractal.