4.3 KiB
4.3 KiB
- A
delta
is an immutable atomic unit that relates one or more values in semantically meaningful ways as of some point in time. A delta can be thought of as both aCRDT
and as ahyper-edge
in the implicit hypergraph that makes up the rhizome. A delta contains one or morepointers
. - A
pointer
is composed of at least two and possibly three fields. Adelta
contains a set ofpointers
. The fields of a pointer are:name
- identifies the meaning of the pointer from the perspective of the delta that contains it.target
- identifies avalue
to associate with thename
.context
- optionally, when pointing at anobject
, thecontext
identifies the field or property of that object with which this delta is associated.
- A
value
is one of two kinds of primitive that can be referred to by adelta
:- a
reference
is a UUID or other value understood to be pointing at either adelta
or anobject
. - a
primitive
is a literal string, number or boolean value whose meaning is not tied up in its being a reference to a larger whole.
- a
- An
object
is a composite object whose entire existence is encoded as the set of deltas that reference it. An object is identified by a uniquereference
, and every delta that includes thatreference
is asserting a claim about some property of that object. - A
negation
is a specific kind of delta that includes a pointer with the namenegates
, atarget
reference to another delta, and acontext
callednegated_by
. - a
schema
represents a template by which anobject
can be compiled into alossless view
. A schema specifies which properties of that object are included, and it specifies schemas for the objects references by the deltas within those properties. A schema must terminate in primitive schemas to avoid an infinite regress.- For instance, a
lossless view
"User" of a user may include references to friends. If those friends are in turn encoded as instances of the "User" schema then all of their friends would be fully encoded, etc. - This could lead to circular references and arbitrarily deep nesting, which runs into the problem of "returning the entire graph". So our schema should specify, for instance, that the "friends" field apply the "Summary" schema to referenced users rather than the "User" schema, where the "Summary" schema simply resolves to username and photo.
- For instance, a
- A
lossless view
is a representation of anobject
that includes a full inventory of all of the deltas that compose that object. So for instance, a lossless view of the object representing the user "Alice" might includealice.name
, which contains an array of all deltas with a pointer whosetarget
is the ID of Alice and whose context isname
. Such deltas would likely include a second pointer with the namename
and the target a primitive string "Alice", for instance.- A
lossless view
may also include nested delta/object layering. Consideralice.friends
, which would include all deltas asserting friendship between Alice and some other person. Each such delta would reference a different friend object. In a lossless view, these references would be expanded to contain lossless views of those friends. Schemas, as defined above, would be applied to constrain tree depth and avoid infinite regress.
- A
- A
lossy view
is a compression of alossless view
that removes delta information and flattens the structure into a standard domain object, typically in JSON. So instead ofalice.name
resolving to a list of deltas that assert the object's name it might simply resolve to"alice"
.- Note that in a lossless view any property of an object necessarily resolves to a set of deltas, even if it's an empty set, because we cannot anticipate how many deltas exist that assert values on that context.
- In collapsing a lossless view into a lossy view we may specify
resolution strategies
on each field of the schema. A resolution strategy takes as input the set of all deltas targeting that context and returns as output the value in the lossy view. So if we have 15 deltas asserting the value for an object's name, our resolution strategy may simply say "return the target of thename
pointer associated with the most recent delta", or it may say "return an array of names". If the value is numeric it may say "take the max" or "take the min" or "take the average".