v hyper.dev · okvs - 0 - natural query

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:

  1. set will store a piece a data;
  2. query will fetch zero or more piece of data;
  3. 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 get3. 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.

Sunflowers turning into a white circle over a dark background, and morph to sunflowers in what appears like a (wanna be (infinite)) loop.

  1. I tried to avoid a name collision, and by the way the verbatim associate an unexpected sense to the action handle’s surface

  2. According to astute lispers, it could represent everything, and beyond, of what you take for granted

  3. In product terms: “describe a feature that is strict superset of what is enabled by get”, in algebraic terms it can be represented by a matrix with a bigger rank, see Scheme. The matrix can describe another space of features, a space where there is more features

  4. A cyclical, cynical, but not clinical, or poisonous, definition of bit sequence’s natural order