Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The Typed-Graph Model

This page answers the question “what is Yuneta, as a model?” — the conceptual claim that underpins the engineering choices laid out in Design Principles and the vocabulary in Domain Model.

The short version: Yuneta treats data and behavior as two views of the same typed graph. Most stacks have a database for “what is” and a separate process model for “what happens”; Yuneta unifies them under one set of primitives. Everything you build — a node in a topic, a running service, a TCP socket, a subscription, an authorization rule — is an instance of a typed class connected to other instances by typed links.

This page is for readers who want to understand the framework as a whole before learning its surface area. None of it is required to write working code, but it explains why the surface area is shaped the way it is.

The unit is not “node + edge”; it is “typed instance with typed bindings”

A graph in mathematics has nodes and edges. The distinctive choice in Yuneta is that every edge carries a contract:

This is what separates the model from neighbouring designs:

Yuneta types all three at once: the node, the link, and the lifecycle.

Two graphs, one set of primitives

Yuneta has two graphs running side by side. They are not analogous — they are isomorphic in primitive shape:

Information plane (treedb)Behavior plane (gobj-tree)
topicgclass
node (with id)gobj (with gobj_name)
hook / fkeyparent / subscribe / bottom_gobj
field schema (sdata_desc_t)attribute schema (sdata_desc_t) — same macro family
EV_TREEDB_UPDATE_NODEEV_ON_OPEN, EV_TIMEOUT, …
timeranger2 (persistence)yev_loop (scheduler)

The same SDATA() macro family declares the columns of a user record in treedb_authzs and the attributes of a C_TCP gobj. The same notion of “subscriber” expresses both “this gobj listens for events from that one” and “this node points to that one”. One mental model covers both planes — the difference is whether the binding is static (data: who relates to whom) or dynamic (behavior: who reacts to whom).

See GObj crash course and TreeDB crash course for the concrete APIs on each plane.

What this lets you model

Because both planes share primitives, you can express almost any kind of organisation as some combination of typed nodes and typed links:

What this doesn’t let you model cleanly

The same constraint that gives you uniform composition also has costs. Worth being honest about where the model strains:

The implicit axiom

Pulled tight, the philosophy is one sentence:

A system is fully described by (a) the set of typed instances that exist plus (b) the set of typed bindings between them. Everything else — state, capacity, behavior, authorization, communication — is an attribute of an instance or a property of a binding.

This is reductive in the same way physics is reductive. It forces you to express things in a small vocabulary, and in exchange the rest of the system can reason about them uniformly. The reward shows up at scale: tools, traces, FSM enforcement, supervision and substitution all keep working as the codebase grows, because every new piece slots into the same shape.

The price shows up when something really does not fit (a free-form blob, an unowned side-effect, an operation with no clear locus). You either deform it to fit or leave it as a leak in the model. Catching those moments early — and either tightening the schema or admitting the leak explicitly — is the running design discipline.

What you get in practice

The payoffs that justify the upfront typing cost:

The empirical justification

The implicit bet of Yuneta is that paying to type everything amortises over many years of production. The bet has been honoured: the same model (under earlier names — v2, v6) has been running at industrial scale for over fifteen years in deployments where downtime is expensive and operator turnover is real. The current v7 codebase inherits from that empirical history; consequently, when a design choice looks strange, the answer is more often “this was learned in production” than “this is theory”.

Where to go next