Network API¶
Crate open/crates/oliviadb-server, binary oliviadb-server --config FILE: agent memory over
HTTPS, REST/JSON with server-sent events for watches. Enterprise binary
oliviadb-agent-server (crate oliviadb-enterprise/crates/oliviadb-agent-server) adds the replica's
databases as layer-1 data under agent PSBs. Contract: [spec/oliviadb-api.openapi.json]
(../spec/oliviadb-api.openapi.json) (OpenAPI 3.1, Apache-2.0), generated from the MCP tool
catalogue, so request bodies are exactly the MCP tools' arguments and responses their
structured results (a test fails when the file is stale).
One implementation, two transports¶
Each request is authenticated, becomes a session of the caller's identity over the
process's shared core (oliviadb_mcp::Core: memory, the handle sealing key, watches, packs,
confirmation nonces) and calls the same tool code as tools/call
(oliviadb_mcp::Server::call_tool). Policies, masks, sealed handles (bound to the principal),
the injection guard and the erasure step-up are the MCP server's. A Provider decides
what a session sees besides memory: oliviadb-agent-server attaches the agent view of the
principal's agent PSB with the caller's user attributes (views cached per principal and
attributes).
Routes¶
| route | tool / meaning | profile (scope) |
|---|---|---|
POST /v1/memory/remember |
memory_remember (Idempotency-Key = step id when the body has none) |
memory |
POST /v1/memory/recall |
memory_recall (valid_at, known_at, min_ts) |
read |
POST /v1/memory/expand |
memory_expand |
read |
POST /v1/memory/feedback |
memory_feedback |
memory |
POST /v1/memory/facts, /facts/retract |
memory_assert, memory_retract |
memory |
POST /v1/memory/consolidate |
memory_consolidate |
admin |
POST /v1/admin/subjects/export, /erase |
export; erase: 202 with the confirmation URL and request_state, repeated after approval (purge: the recall index's purge after it) |
admin |
POST /v1/admin/memory/index/purge |
memory_index_purge: flush and full compaction of the memory trees (spec memory-index.md, "Erasure") |
admin |
POST /v1/state/put, /append, /delete, /get, /list, /namespaces, /search |
agent state: namespaced JSON documents (state_* tools) |
memory (writes) / read |
GET /v1/path?p= |
the path language (memory and layer 1, ?as_of=, pages) |
read |
GET /v1/data/catalog, POST /v1/data/recall |
layer-1 catalog and search | read |
POST /v1/watches, GET /v1/watches/{id}, GET /v1/watches/{id}/events |
watches; events as SSE (id: position, resume with Last-Event-ID) |
memory / read |
GET /v1/changes?path=&from=&limit= |
the change stream (CDC) of layer 1, of native aggregates or of agent memory (path=MEMORY) under the paths: a JSON batch, or SSE with Accept: text/event-stream (id: position, resume with Last-Event-ID); see "Change stream" |
read |
GET /v1/aggregates/<path> |
native aggregates: a node, a listing (limit, after, prefix), ?as_of=, ?tree=true; see "Native aggregates" |
read |
POST, PATCH, DELETE /v1/aggregates/<path>, POST /v1/txn |
native aggregates: insert, update, delete, several writes as one transaction | memory |
GET /v1/lookup/<index>, POST /v1/search/<aggregate> |
native aggregates: entry through a declared index; ranked text within a token budget | read |
POST /v1/admin/aggregates/erase |
native aggregates: erase a data subject (crypto-shredding) | admin |
GET /v1/dli/<path> |
DL/I databases, read only: a segment (DBD/SEG/key/...), ?tree=true, a listing (limit, after); see "DL/I databases" |
read |
POST /mcp |
MCP over HTTP (Streamable HTTP, revision 2026-07-28; docs/mcp.md) |
as the tool called |
GET /v1/admin/stats, /v1/admin/check |
operator reports: the server's own storage (each tree of memory, agent state and native aggregates: counters, last version, write freeze; the storage check of oliviadb check, same JSON shape, code storage; src/reports.rs), or the provider's when it has them (oliviadb-agent-server: the replica's statistics and integrity check) |
admin |
GET /console |
the read-only web console's page and script (no data; docs/docker.md) |
unauthenticated |
GET /healthz, /readyz, /metrics, /v1/openapi.json |
unauthenticated | – |
Integers above 2^53 - 1 (transaction times such as wts, fact ids, cursors) are sent as
decimal strings in results: a client whose numbers are doubles (JavaScript) would round
them, and a rounded min_ts names another time. Arguments that take such a value
(min_ts, known_at, valid_at, fact_id, expected_version) accept a number or the
string; the schema types them ["integer", "string"]. The clients pass them through: the
TypeScript client's U64 (number, string or bigint, a bigint sent as a string; u64()
gives the exact bigint), Python's int(x), Java's JsonNode.asLong().
High availability (docs/ha.md, "Network API on the nodes"): each node of an HA pair
listens; only the primary serves, the other answers 503 (retryable, naming the primary).
The clients take every node's URL (OliviaDbClient(["https://a:8443", "https://b:8443"], ...),
baseUrl: [..], OliviaDbClient.builder(List.of(..))) and follow the primary by themselves.
Errors: application/problem+json (RFC 9457) with retryable; 401 unauthenticated, 403
tool not granted or confirmation missing, 404 not found or not visible (the same), 409
version conflict, 412 not yet visible, 413 body over 1 MiB, 422 invalid, 429 over the
quota, 503 unavailable, 504 outcome unknown. Data responses carry Cache-Control: private,
no-store.
retryable: true (with Retry-After) means sending the same request again, here after
Retry-After or to the node the answer names, cannot apply it twice: on 429 and 503 the
request was not done. Every other answer is not retryable, except the one below for
REMEMBER. In particular a write the
node has committed but could not confirm (its standby did not acknowledge it within
t_sync, the node lost the primary role before the standby did, or its own log sync
failed after the commit) is answered 504 with type .../problems/outcome-unknown,
retryable: false and version, the version the write is in on that node (a number, or a
decimal string above 2^53 - 1). Whether the write survives a failover is not known yet:
the client reads before it decides (the write is visible once the standby holds it; after
a failover it is there or not). Sending it again blindly can apply it twice: an insert
sent again conflicts (409), an increment would count twice. The clients (below) retry
only what is retryable, so they do not resend a 504 by themselves. The exception is
REMEMBER (/v1/memory/remember), idempotent per step_id: its 504 is retryable: true,
since the same step sent again replays the first call's result (once its writes are
confirmed) instead of writing the episode twice.
Authentication¶
- OAuth 2.1 bearer JWTs: RS256, PS256, ES256, EdDSA against the issuer's JWKS;
iss,aud(this server's resource indicator, RFC 8707),exp,nbf(60 s leeway);alg: noneand critical headers refused. Token exchange (RFC 8693):act.subis the agent (principal),subthe user; configured claims become user attributes for row predicates; scopesoliviadb.read,oliviadb.memory,oliviadb.adminbecome profiles; tenant from a configured claim. - API keys (development, Mem0-style clients):
Authorization: Bearer <key>orToken <key>, configured as SHA-256 digests (oliviadb-server --hash-key) with a fixed identity, compared in constant time. - TLS 1.3 only (rustls); plain HTTP is refused unless the listener is on loopback.
- A credential that does not authenticate is answered (401) after a back-off per client address: 100 ms, doubling per further failure up to 5 s, forgotten after 10 minutes without one (shared with the native protocol's listener).
- Audit: one JSON line per request (identity, user, method, route, status,
traceparent, which is echoed).
Change stream (CDC)¶
GET /v1/changes streams the changes of operational data (layer 1) under one or more
paths (path= repeated; paths of the path language, as for watches), after from
(start, now (the default), or a record's position). Each record is one change the
source applied, as the caller sees it:
{"key": "5da67ffa22c5b6d5771cbcc2b3bbca59", "position": "cdc_...", "collection": "CUSTDB",
"path": "CUSTDB/CUST=C001", "type": "CUST", "op": "replace", "version": 4711,
"source_time": 13, "before": {"CNO": "C001", "BAL": "12550"},
"after": {"CNO": "C001", "BAL": "12345"}, "layout": "sha256:..."}
- Decoded by the writer's layout.
beforeandafterare the node's versions before and after the change, each decoded by the layout its writer recorded (or the default valid when it was written);layoutis the registry id of the version shown last (spec/schema.md4.3). - Masked per consumer. The fields are rendered under the caller's agent policy (rows,
masks, personal-data class) and, with access profiles, under its profile: every path
needs a
watchgrant, andexcepttakes fields out. A change the caller cannot see (another branch's record, only a masked or hidden field changed) is not reported. A twin without a unique key is reported at its listing path with"occurrence_unknown": trueand no fields. - At least once, with an idempotency key.
keyis the same for the same change on every copy of the source; a consumer storespositionafter it has processed a record and drops a record whose key it has seen.positionis a source time and an ordinal among the changes of that source time, sealed with the installation's key: it means the same on the primary and on the standby (each applies the same IMS change stream), so a consumer resumes on the standby after a failover (SSE: reconnect withLast-Event-ID). -
File sink.
"cdc_sinks"in the configuration ({"tenant", "principal", "paths", "file", "from", "interval_ms"}) appends records as JSON lines tofileand keeps the position infile.position, written (synced, renamed) only after the lines are synced: after a crash the sink repeats at most the records it had not made durable, with the same keys. -
Native aggregates. Paths of
/v1/aggregates(*for any key:Customer/*/Account) stream the changes of native aggregates (alone, not with layer-1 paths):{"key", "position", "collection", "path", "type", "node_key", "op", "version", "before", "after", "layout"}, the fields typed as reads show them, each side decoded by its writer's layout, the change under the path and what is under it, under the caller's profile (awatchgrant on every path; fields, rows and masks as for reads; a change only hidden fields made is not reported). Positions areagg_<version>[_<ordinal>](after a whole commit, or after one of its records), the same on both copies of an HA pair (the journal record ships with the commit), andkeyis the same for the same change on both. - Agent memory.
path=MEMORY(alone) streams agent memory instead (Memory::changes_as): the claims and episodes each commit of the durable tree wrote, changed or deleted, as the caller's viewer and policy see them now:{"key", "position", "kind": "claim"|"episode", "op": "insert"|"replace"|"delete", "id", "version", "attr", "text", "status", "valid_from", "valid_to"}. A consumer keeps the latest record perid; a delete (an erasure: the subject's key is destroyed, nothing of the record can be shown) carries only the id. Positions aremem_<version>, the same on both HA copies (the journal record ships with the commit). Session and scratch records are not streamed; positions older than the kept history (history_ms, CONSOLIDATE) are refused. Memory is outside access profiles.
Tests: open/crates/oliviadb-memory/tests/operational.rs (change_stream), open/crates/oliviadb-memory/tests/changes.rs,
open/crates/oliviadb-server/tests/native.rs (change_stream_decoded_by_layout_and_masked),
open/crates/oliviadb-server/tests/http.rs (memory_change_stream_over_http),
oliviadb-enterprise/crates/oliviadb-agent/tests/cdc.rs, oliviadb-enterprise/crates/oliviadb-agent-server/tests/cdc_http.rs
(SSE and the file sink failing over to the standby).
Native aggregates¶
With a schema ("schema" in the configuration), oliviadb-server and the nodes of a
high-availability pair (oliviadb-ha-node --memory --serve) serve the schema's aggregates
natively: the data lives in the server, written and read over this API, under the
callers' access profiles (spec/schema.md 6). Code: open/crates/oliviadb-server/src/native.rs.
- Paths alternate keys and types after the aggregate, as grants are written:
/v1/aggregates/Customer/C1/Account/A1. A key of several parts is its parts separated by commas, each percent-encoded (Txn/2026-01-02T03:04:05Z,1); a path that ends with a key names one node, one that ends with the aggregate or a type lists nodes. - Twins. A node type with duplicate keys or without a key (
ordered) orders its twins by an ordinal (spec/path-keys.md): a path names a twin by<key>~<ordinal in hexadecimal>(its identity, as reads return it) or<key>@<n>(the n-th twin with that key now, from 0); an unkeyed type's level is~<ordinal>or@<n>alone. An insert of a path without~(or of a path ending with an unkeyed type) adds a twin: at the end ("position": "last", the default), at the start ("first"), or{"before": <level>}/{"after": <level>}a named twin of the same key. A listing gives twins in key order, equal keys in ordinal order. - Reads.
GETa node:{"path", "type", "key", "fields", "layout", "version"};?tree=trueadds its subtree (childrenby type, each listing the profile must grant; at most 1000 nodes);&each=N(1 to 1000) keeps the first N children of every listing in the subtree, in key order (a customer with its accounts and each account's newest 100 transactions is one request:?tree=true&each=100).GETa listing:{"nodes", "next", "version"}in key order (descending key parts reversed),limit(1 to 1000, default 100, within the grant's limit),after(thenextof the previous page),prefix(the first key parts),to(through these first key parts: the listing ends before the first node whose first key parts sort after them in listing order, soafterandtotogether read a key range, a week of transactions for instance).?as_of=<version>reads as of a version when the profile saysas_of allowed. - Values are shown as
oliviadb_schema::codecdecodes them: strings without their padding, decimals as strings at their scale ("100.50"), datesYYYY-MM-DD, timestampsYYYY-MM-DDTHH:MM:SS.ffffffZ, bytes in hexadecimal, enum members by name, integers as numbers (beyond 2^53 - 1 as strings), versions likewise. Writes take the same forms (decimals also as JSON numbers, read without rounding; timestamps with an offset). - References. A
reffield holds its target's levels below where the reference starts (ref Merchant: the merchant's key;ref ../Account: the account's key under the same customer; levels separated by/, a twin by~<ordinal>), or""for none. A write checks that the target exists (422 otherwise) and stores the value in its canonical form. When a node goes (with its subtree), every node that refers to it is found through a reference index in the same transaction and its field'son deleterule applies:restrict(the default) refuses the delete (409, naming the referrer),cascadedeletes the referrer with its subtree,keepleaves it (the reference then names nothing). A cascade into another aggregate record counts for the transaction scope (403 undertxn scope aggregate). - Indexes. A declared
indexon a type of a native aggregate has an entry per node (its parts, typed and ordered as declared, a reference by its text). A synchronous one is written in the writing transaction, and auniqueone refuses a second node with the same parts (409). Anasyncone is written by the server's maintenance pass (every second) from the change journal.GET /v1/lookup/<index>?key=<parts>(alookup <index> -> <aggregate>grant;keythe first parts, separated by commas) gives the nodes, each with its record and the record's root as the caller'sgetgrant shows it (records rows hide are left out); for an asynchronous index alsoapplied_through(the version applied) andpending(newer changes not applied yet). - Listing indexes.
listing index [include (fields)]on a type (spec/schema.md4.8) keeps an entry per node of the type, its key the node's path, in the children's key order, so a listing reads one range instead of seeking past each child's subtree. Withincludethe entry holds the node's value with the other fields cleared. It is written in the node's transaction on insert and delete, and on update only when an included field changes. A listing of the type is answered from the index when every field the caller's profile shows of the type, and every field itsrowsrules test, is included; otherwise from the nodes. Both answers are the same (open/crates/oliviadb-server/tests/listing_index.rs: random histories, profiles with masks and row rules, the index built while writers write). A declaration added to a store with nodes is built by the maintenance pass from a snapshot and the change journal since it, and read only once marked complete. Cost: one more key per node of the type, with the included fields' bytes; updates of other fields write nothing more. - Search.
POST /v1/search/<aggregate>with{"query", "budget", "limit"}(asearch <aggregate>grant, within its token budget) ranks, by BM25, the nodes the caller mayget, each by the text its profile shows (masked values are searched masked, fields taken out are not searched), and returns the best within the budget (about four characters a token). It reads the tenant's nodes of the aggregate at each call (at most 100 000; beyond that 501: a text index is not built yet). - Writes.
POSTinserts the node the path names ({"fields": {...}}: every field of the type and of the variant case its discriminator selects; 409 when it exists, 404 without its parent);PATCHchanges the fields given (a new discriminator value drops the old case's fields and needs the new case's) and adds the numbers of"add": {"balance": "-12.50"}to the current values of integer, decimal and float64 fields in the same transaction (a relative update: no read and conditional write needed; integers and decimals exactly, a decimal with more fraction digits than the field's scale and a sum beyond its precision refused with 400);DELETEdeletes the node and its subtree.POST /v1/txnwith{"ops": [{"op", "path", "fields"}...]}runs several as one transaction, all or none. Besidesinsert,updateanddeleteit takesput(an update when the node exists, an insert when not, each under its own grant),deletewith"if_exists": true(a missing node deletes nothing) andunchangedwith"since": <version>(a precondition needingget: 412precondition-failedwhen the node's stored value differs from its value at that version, 410 when the version is older than the history kept). Every write is an optimistic transaction (oliviadb_core::otx): serializable, retried on a conflict, pessimistic after three; a lock not granted in 5 s is 503 (retryable). Undertxn scope aggregate(the default) a transaction writes one aggregate record (the aggregate and its root key), otherwise 403. - Layouts. Each node type's layout (
spec/schema.md4.1, "Layouts of the schema language") is registered in the server's layout registry by the first write that uses it, in the same transaction; every version records its writer's layout number, and every read and change record decodes a version by it, so data written under an earlier schema version reads as it was written (layoutnames it). A read shows the fields the current layout adds with their defaults (empty string, zero, false, the first enum member, 1970-01-01, an empty reference:oliviadb_schema::codec::default_value), and a change of such a node keeps them unless it gives them; the change stream shows each version as written. - Profiles. A read needs
get(a node, orget .../**for anything under one),listorrange(a listing); a writeinsert(a grant ending with the type covers any key),update(itsfields(...)bound the fields changed;exceptfields cannot be changed) ordelete;proposegrants are not writes.fields(...)andexceptbound the fields shown;rows <type> where <field> <op> <values>hides nodes (and what is under them) whose field does not match, with$user.<attribute>from the caller's credentials (a write that would leave such a node is refused);maskandpii maskedmask values as agent policies do. Consistency, as-of reads, quota and observe mode as for the other data calls. - Data subjects. An aggregate with
subject <root key>seals every node's data (XChaCha20-Poly1305, the node's key as associated data) under a key of its record's subject, held in the key store as agent memory's subject keys are (replicated with the key material on an HA pair).POST /v1/admin/aggregates/erasewith{"aggregate", "subject"}(admin) deletes the record, its index and reference entries in one transaction (no reference stops an erasure; referrers keep a reference to nothing), then destroys the key: every copy of the record's data, in history, logs and backups, is unreadable from then on. Reads as of an earlier version find nothing; the change stream reports the record's nodes as deleted with"erased": trueand no fields. Index entries hold their parts in clear: the erasure deletes them, their earlier versions go with the history window. - History. Versions are kept for the longest
historyof the served aggregates, at least a day (change-stream consumers resume within it); the maintenance pass gives older ones up to garbage collection and trims the change journal. Reads as of an earlier version and change-stream positions before it answer 410. - Physical declarations.
placementandpartitionare accepted and, on one node (or an HA pair), a record's nodes are in key order;residencyandtierare recorded in the schema and not acted on yet. - Storage and high availability. A tenant's nodes are path keys (
spec/path-keys.md, format 2, ordinals for twins) undera <tenant> 0x00 <aggregate> 0x00in the agent-state tree, index and reference entries underx <tenant> 0x00, so they are synced, replicated and admitted like agent state: on an HA pair writes go to the primary, the other node answers 503 (retryable, naming the primary), and a write is acknowledged once the standby holds it (semi-synchronous). - Not served natively (501, the detail says why): types with format-1 keys (the DL/I
format: imported databases, served by the DL/I layer),
refstatements (relationships without a field), references into aggregates not served natively, asubjectthat is not the root's one-part unique key.
Tests: open/crates/oliviadb-schema/tests/codec.rs (bytes written out by hand),
open/crates/oliviadb-server/tests/native.rs (reads, writes, profiles, transactions, the
change stream, decoding by the writer's layout after a schema change),
open/crates/oliviadb-server/tests/native_more.rs (twins, references and their rules, history),
open/crates/oliviadb-server/tests/bank.rs (spec/schema/examples/bank.olv under its teller
and kyc_agent profiles: everything above at once),
oliviadb-enterprise/crates/oliviadb-ha/tests/e2e_native.rs (a pair: the standby refuses, failover,
the same change stream on the other node).
DL/I databases¶
With a dli section in the configuration, oliviadb-server serves DL/I databases read only:
GET /v1/dli/<path> over HTTP and route 0x07 DLI of the native protocol, answered as
spec/native-protocol.md 6.4 describes.
"dli": {"store": "dli/system", "library": "dli/library", "runtime": "ascii-le",
"databases": {"PARTDB": "dli/PARTDB"},
"views": {"parts-agent": "dli/PARTVIEW.psb"}}
store: the DL/I system's directory (the oneoliviadb_opentakes);library: the DBD and PSB sources (*.dbd,*.psb);databases(optional): databases kept in stores of their own, asoliviadb_map_databasemaps them;runtime: the data's representation,ebcdic(default),ascii-beorascii-le, as the programs that wrote it scheduled their PSBs.views: for each principal, the file of its view PSB: PSBGEN source (PCB, SENSEG, SENFLD, PROCOPT G, O, P or K) with OliviaDB's ROWS and MASK statements (agent data, "Agent PSBs"). A principal without a view gets 403; a database no PCB names, a segment type no SENSEG names, and a segment outside the ROWS predicates are not found (404). Fields outside SENFLD are left out; MASK fields show their mask. PDATA is refused at start.
The server holds these stores. At start the server opens the DL/I system and every
store of the databases the views name, and holds each exclusively until it ends (the store
lock, spec/storage-format.md, "Store lock"). While it runs, DL/I programs in other
processes cannot open those stores: oliviadb_open returns no system, or the schedule of a
PSB that uses one returns no program, and oliviadb_last_error() says the store is in use
by the server's process id. Run the batch programs that write the databases, then start the
server on their stores; stop the server before the next batch run. A server does not start
on a store a program holds (it names the holder and exits). A path through the server for
programs that write while it serves is not built yet.
Paths. PARTDB/PART/P00011 is the PART segment whose sequence field is P00011; with
?tree=true the answer has its children by type ("children": {"STOCK": [...]}) in
hierarchic sequence; PARTDB/PART/P00011/STOCK lists its STOCK segments (limit, at most
1000, default 100; after the next of the previous page). A segment type without a sequence
field, or with one that is not unique, gives its segments an ordinal: NOTE/~01, NOTE/~02
(also NOTE/[2] for the second). A sequence field whose bytes do not decode is written x:
and its hexadecimal.
Answers have the form of native aggregate answers (path, type, key, fields,
layout, version; listings nodes, next, version), so the clients read them as they
read aggregates. Fields are the segment's FIELD statements typed by TYPE=: C text without
trailing blanks, P a decimal string, H (2 bytes) and F (4 bytes) integers, X and every
other type lower-case hexadecimal. A field whose bytes are not a value of its type (a packed
field with a bad sign, an unprintable character) shows x: and its bytes. All of one
answer is read at one committed version. Examples: HTTP API by example,
"DL/I databases".
Tests: oliviadb-server/tests/dli.rs (a database written by a DL/I program, typed answers,
views with SENFLD, ROWS and MASK, rows equal to JSON under every view with small frames and an
evicting descriptor cap, never-leak over a randomized database, route 0x07 over a socket, the
store held by the server).
Native protocol¶
With "native_listen" (default port 7655) or "native_socket" in the configuration,
oliviadb-server also speaks the native protocol (spec/native-protocol.md, version 1):
length-prefixed frames with a stream id, many requests in flight on one connection, TLS
from the first byte with the HTTP listener's certificate (ALPN oliviadb/1), plain text only
on loopback unless native_plaintext_remote (which logs a warning). HELLO, READY, AUTH with
the credentials the Authorization header takes, then REQUEST frames, each one of the HTTP routes
above (GET, LOOKUP, SEARCH, TXN, WRITE, DLI) answered through the same handler: the JSON text of
the HTTP answer, or its status and problem document. Limits (native_limits): frame size,
streams in flight, connections, handshake and idle timeouts; a failed authentication is
answered after a back-off per address (100 ms doubling up to 5 s; the connection closes at
the third), which the HTTP listener applies too.
Reads (GET, DLI) answer in row form: each node's stored key component and value bytes, described
by type descriptors that a connection receives once (DESCRIBE; at most max_descriptors,
least recently used ones evicted with UNDESCRIBE). A profile's hidden and masked fields are
zeroed in a copy of the value, and the masked text is sent beside it, so their stored bytes never
leave the server. Results larger than a frame span several. LOOKUP answers the records'
root nodes with the indexed node's path (or the two paths, when the profile does not show
the root), SEARCH the ranked nodes with their parent path and score, and CHANGES (CHANGE
frames until CANCEL) each change record in binary form with its before and after nodes:
there is no JSON on the native path but the answers to writes. Not yet: lz4
(compression is answered none). The reference decoder of the row form is
oliviadb_server::native::rows::decode. Its tests compare every read under three profiles
with the HTTP answer (GET, LOOKUP, SEARCH, the change stream) under four profiles and
check that nothing hidden leaks. Tests: oliviadb-server/src/wire.rs (each rule, and a mutated corpus of
frames run by the test suite; fuzz/ is the cargo-fuzz target of the same entry point) and
tests/wire.rs (real sockets: answers byte for byte as over HTTP, thirty streams in flight,
errors and closing, the timeouts, the back-off, the connection limit).
Redis-protocol facade¶
With "resp_listen" in the configuration, oliviadb-server also speaks the Redis protocol
(RESP2 and RESP3) over the native aggregates, on the same TLS certificate and credentials
(AUTH with an API key or token): a key is a node's path, a node a hash of its fields,
MULTI/EXEC one transaction, WATCH an unchanged precondition in it; every command
goes through the calls above under the caller's profile. Commands, the differences from
Redis and the tests: docs/facades.md.
Generated clients¶
oliviadb schema client FILE --lang rust|ts --profile NAME --out DIR [--sdk ...] writes a typed client of
one access profile (code: open/crates/oliviadb-schema/src/codegen/). The profile is the
contract: every grant becomes one method, every node type it reaches a typed structure of
the fields it shows, and nothing the profile does not grant has a method or a field.
- Methods.
get A/{id}->get_a(id)(a node);get A/{id}/**->get_a_tree(id)(the node and the subtree it may list, typed per child type);list/range-> a page (limit, by default the grant's limit;afterthe previous page'snext;prefixthe first key parts);insert-> the new node's key and all its fields (positionfor twins: last, first, before or after a twin's ordinal);update ... fields(...)-> a patch with those fields alone (minusexcept);delete;lookup <index>-> the index's parts (the first required) and the record roots as the profile's get shows them;search <aggregate>-> ranked hits within the grant's budget, typed by node type;watch <path>-> a batch of change records under the path (from:start,nowor a position), typed by node type. A level of a path is its key parts as parameters, and for twin types aTwin(the ordinal a read returned, or a position);*in a read grant is a parameter too, in a watch the literal*.proposegrants have no method (a person confirms them); the generated file lists them.as_ofis a parameter of the reads when the profile saysas_of allowed. - Types. Fields as the native API shows them: strings, text, decimals at their scale, dates, timestamps, bytes in hexadecimal and references are strings; integers up to 32 bits numbers; 64-bit integers and versions numbers or decimal strings beyond 2^53
- 1 (Rust
Int64/Uint64/Version, TypeScriptnumber | string); enums their member names (a Rust enum, a TypeScript union of names). A field the profile masks (mask, or personal data underpii masked) is a string; a variant's fields are optional; a field some read of the type does not show (another grant'sfields(...)) is optional; a field taken out byexceptis absent. Search hits and change records of several node types are a union bytype(a Rust enum tagged bytype, a TypeScript discriminated union). - Paths are encoded as the server reads them (
native/keys.rs): each key part percent-encoded except letters, digits and-._:, the parts of a key joined by,, a twin's ordinal after~; query values (after,prefix,key,path) encoded once more. - Rust: a crate on the Rust SDK (crate
oliviadb, repositoryoliviadb-rust, Apache-2.0), its runtime:pub use oliviadb::typed::*gives theTransporttrait requests go through (send(method, path, body) -> (status, body), so any HTTP stack fits),Node,Page,Change,Twin,Position, the 64-bit types and path encoding; with the featurehttp(default) the client sends througholiviadb::Client(a list of nodes, failover to the primary, retries only of answers markedretryable):Client::connect(url, token), orClient::new(oliviadb_client)for several nodes and a CA file.--sdk version:REQ(default0.1),path:DIRorgit:URL[#REV]says where the crate takes the SDK from. Errors:Error::Api(Problem)with the status,retryableand an outcome-unknown write'sversion;Connect(not sent),Io(lost after sending),Decode. - TypeScript: one module,
client.ts, onfetch(or aTransportfunction), no dependencies, erasable syntax only (Node.js runs it as it is). Errors:OliviaDbErrorwithstatusandproblem.
The server enforces the profile whatever the client; the types only say what it will
answer. Tests: open/crates/oliviadb-schema/tests/codegen.rs (the model of teller and
kyc_agent, worked out by hand), open/crates/oliviadb-server/tests/generated_clients.rs (both
profiles generated in both languages, the Rust crates built clippy-clean with their
dependencies through tools/licenses.py --manifest-path, the TypeScript type-checked with
tsc --strict (TypeScript 5.9.3 through npx), and the programs in tests/generated/
run against a live server; a patch with an ungranted field and a call of a proposal do not
compile; the Rust part needs the SDK: OLIVIADB_RUST_SDK, or oliviadb-rust under
OLIVIADB_REPOS, default ..; skipped without it, a failure under
OLIVIADB_REQUIRE_CLIENTS=1), open/crates/oliviadb-ops/tests/schema.rs
(client_generation, --sdk); in oliviadb-rust, oliviadb/tests/generated.rs (a client of
its test schema on the SDK against a live server).
Access profiles¶
With "schema": "FILE" in the configuration (a schema in the .olv language or its JSON
form, spec/schema.md), every operational-data call is checked against the access profile
declared for the caller's principal: an undeclared path is refused (403
forbidden, detail refused by access profile: ...), a read the node cannot give at the
profile's consistency answers 503 (retryable), a call over the profile's quota 429
(retryable). "environment": "staging" honours profiles in observe mode (the call goes
through, and a record with "observe": true goes to the audit log) and lets callers
without a profile through the same way; production (the default) refuses to start with an
observe-mode profile and gives callers without a profile no data. Memory calls are outside
profiles. Native aggregates are under the same profiles (above). Tests:
open/crates/oliviadb-server/tests/profiles.rs, open/crates/oliviadb-server/tests/native.rs.
Tests¶
oliviadb-server/tests/http.rs over real sockets: refusals (no credentials, unknown key,
expired, wrong audience or issuer, no tenant, tampered, alg: none, read scope writing),
recall over HTTP equal to the tool called directly, packs and watches bound to their
principal, SSE events after a write, the erasure confirmation, TLS 1.3 and a refused TLS
1.2 client, plain HTTP refused off loopback. oliviadb-agent-server/tests/layer1_http.rs:
branch row predicates from the caller's credentials, masked values absent, hidden and
absent records both 404, search limited to the view, results equal to the agent view read
directly.
Mem0-compatible API¶
On the same listener: the routes of Mem0's platform API that its clients call
(POST /v3/memories/add/, /v3/memories/search/, /v3/memories/, GET|PUT|DELETE
/v1/memories/{id}/, /v1/memories/{id}/history/, DELETE /v1/memories/, /v1/ping/,
/v1/entities/, DELETE /v2/entities/{type}/{name}/, /v1/batch/, /v1/feedback/,
/v1/event/{id}/), with Mem0's payloads and response shapes (docs.mem0.ai API reference;
requests as the mem0ai 2.2.1 client sends them), authenticated with OliviaDB API keys (Token)
or tokens. An application changes only host=. Memories are agent-state documents of the
caller (oliviadb-server/src/mem0.rs). Differences: Mem0's LLM extraction (infer) is not run,
each user or assistant message is one memory as written; search ranks by the server's
embedder (cosine, threshold applies); filters AND/OR/NOT, in, gte, lte, gt,
lt, ne, contains, icontains, * on entity ids, dates, categories and metadata, other
fields refused (400); exports, summaries, profiles, projects and webhooks answer 501.
Evidence: adapters/mem0-compat of the oliviadb-python repository runs Mem0's own client against OliviaDB (add, search with
filters and thresholds, pagination, get, update, history, delete, delete all, entities,
batch, feedback, expiry, the async client, a wrong key refused).
Clients (repositories of their own, Apache-2.0)¶
| package | runtime | |
|---|---|---|
| Python | oliviadb-python: oliviadb (from oliviadb import OliviaDbClient) |
3.9+, standard library only |
| TypeScript | oliviadb-js: oliviadb-client (@olivia-db/client) |
fetch (Node 18+, Deno, Bun, browsers, edge) |
| Java | oliviadb-java: oliviadb-client (com.olivia-db:oliviadb-client) |
JDK 17+, java.net.http, Jackson |
| Rust | oliviadb-rust: crate oliviadb (also the runtime of generated Rust clients) |
blocking, ureq with rustls, serde_json |
Each has the routes above as methods, problem documents as an exception type with
retryable (retried with Retry-After), and watch events as an iterator or callback.
Their tests are contract tests in their repositories: each repository's check.sh runs
them against a server built from this repository (or its Docker image); COMPATIBILITY.md
of oliviadb-spec lists which versions work together.
Not built yet¶
JWKS fetched from the issuer's URL (the file is read at start), MCP Streamable HTTP on the same listener, rate limits, mTLS client identities, gRPC.