Data Model

ReifyDB models application state with a small set of purpose-built primitives instead of tables-for-everything. Each storage shape has distinct semantics - how rows are kept, ordered, evicted, or derived - and all of them participate in the same transactions. This page is the map; every primitive has its own page with runnable examples.

Namespaces organize everything

Every object lives in a namespace and is addressed as namespace::object, for example shop::orders. Namespaces nest, isolate names, and are the natural boundary for environments and tenants. The engine's own catalog is exposed the same way, under system::*.

The storage shapes

Six shapes hold rows. Two store what your application asserts, three specialize how state is kept, and one derives state from the others:

  • --Tables - authoritative, mutable state; the primary shape. Typed columns, optional columns, auto-increment, primary keys, in-place schema evolution.
  • --Views - derived state the engine maintains incrementally. Transactional (correct at commit) or deferred (catches up moments later), materialized into table, ring buffer, or series storage.
  • --Ring Buffers - fixed capacity, oldest row evicted when full; optionally one buffer per partition key. "Keep the last N" without cleanup jobs.
  • --Series - rows ordered by a required time or integer key. Measurements, audit trails, historical records; range queries follow the key.
  • --Dictionaries - value interning: strings stored once, referenced by compact IDs, wired into table columns transparently.

Reacting to change

  • --Subscriptions - an append-only change stream over a source, tagged insert / update / delete; what a live frontend consumes.
  • --Events - declared domain events with typed payloads, dispatched inside a transaction.
  • --Handlers - reactions bound to event variants; they run synchronously in the dispatching transaction and can chain further dispatches.
  • --Procedures - named, callable logic stored next to the data: typed parameters, scripted bodies, in-database tests.

Types and identity

  • --Enums - closed variant sets as column types, with optional payload fields.
  • --Tags - variant sets that classify series entries.
  • --Sequences - the counters behind auto-increment columns; inspectable and repositionable.

Access control

Because clients query the database directly, policies replace the API layer as the place where access rules live: row filters, column masks, and write constraints per identity, attached to tables, views, namespaces, sessions, and procedures. Non-root identities are denied by default.

Where to start
If you are new to ReifyDB, read Tables and Views first - together they carry most applications. Reach for the specialized shapes when a table plus application code starts reimplementing eviction, ordering, or interning by hand.