DSL reference
A summary of the schema and program documents. The full specification, with every rule and the SQL each statement becomes, is API-008. For the Rust functions, see Rust crates.
Both documents are YAML or JSON; unknown keys are refused. Object, field,
parameter and read names match [a-z][a-z0-9_]{0,47}.
Durations are a string with a unit (250ms, 30s,
5m, 2h, 7d) or milliseconds.
Schema document
| Key | Meaning |
|---|---|
version | Increases with every change. apply_schema takes the version it expects to replace. |
request_retention | How long request ids are remembered. Default 1d. |
queues.<name> | max_attempts (default 10, or unlimited), retention of finished items (default 7d), priority (asc or desc), fields. |
tables.<name> | key (fields that identify a row), or sequenced: true; expire_after_write; fields. |
fields.<name> | type; index: true; merge (add_only or non_decreasing). |
reads | Named, versioned selects with typed params. A name and version, once declared, never change. |
Program document
| Key | Meaning |
|---|---|
request_id | Required if any statement writes. A replay returns the recorded response. |
issued_at | Required with request_id: when the caller created it. Resent unchanged on every retry. |
durability | durable (default) or fire_and_forget. |
params | Values the statements refer to as {param: name}. |
statements | Run in order, as one transaction. The response has one result per statement. |
Statements
| Statement | Does | Result |
|---|---|---|
insert | Adds queue items or table rows. on_conflict: skip (default), reject, or update on tables. | [{id, key?, status}] |
claim | Leases up to limit due items for lease, in claim order, skipping rows other transactions hold. | Items with token |
settle | Ends leases as complete, fail, retry or release, with set and body patches. | [{id, status: ok | stale}] |
renew | Extends unexpired leases. | As settle |
update | Changes matched rows. expect bounds the match count; on_limit: step pages large changes; leased picks how leased items are treated. | {matched, met?, more?, last?} |
delete | Deletes matched rows. | {matched, met?} |
assert | Counts matched rows against expect; writes nothing. | {matched, met} |
select | Reads fields, or an aggregate with group_by; order_by; limit required. | Row objects |
read | Runs a declared read with its parameters. | Row objects |
pause, resume | A paused queue's claims return nothing. | {} |
Inside a statement
- Operands: a column,
{field: name},{param: name},{value: v},{now: "-5m"},{path: /a/b, type: text}into a queue item's body. No implicit casts. - Predicates:
and,or,not;eq,ne,lt,le,gt,ge;in;contains;is_null,not_null;exists, a lookup in another object of the space. - Assignments: a value or operand,
add,sub,coalesce,set_add,set_remove. - Body patches:
set,remove,appendwithkeep_last,replace.
Rejections and errors
A rejection rolls back every statement, keeps the request record and
reports the statement and reason: key_conflict,
stale_lease, limit_exceeded,
expect_unmet, merge_violation. Errors change
nothing and are not recorded: invalid,
space_not_found, schema_conflict,
request_id_conflict, request_expired,
contention, unavailable.
Limits
| Limit | Value |
|---|---|
| Statements per program | 64 |
Rows per insert; items per settle or renew | 1,000 |
claim limit | 1,000 |
update, delete and select limit | 10,000 |
| Program size | 8 MiB |
Programs per execute_batch | 64 |
| Statement timeout | 5 s |