[runtime]

The [runtime] table — replication, changefeed capacity, and cascade depth, baked into database.rs at generate time.

The [runtime] table carries generate-time behavior knobs, schema-blind and baked into the emitted database.rs. Change one and run forgedb generate for it to take effect. Defaults reproduce the prior output byte-for-byte; the one exception is replication, which defaults to off.

[runtime]
replication = false        # Tier A — attach the durable replication broker
changefeed_capacity = 1024 # Tier B — broadcast/broker buffer size
max_cascade_depth = 64     # Tier B — @on_delete(cascade) recursion bound

Keys#

KeyTypeDefaultTierMeaning
replicationboolfalseAAttach the durable replication broker in open_at. Required for /replicate and the browser read-replica.
changefeed_capacityusize1024BIn-process changefeed broadcast channel capacity and the durable broker's in-memory buffer.
max_cascade_depthu3264BMaximum recursive @on_delete(cascade) depth — a structural safety bound against a pathological FK cycle.

replication (Tier A, default off)#

When true, open_at attaches a DurableBroker that records every committed change to a CRC-framed append-only log (<root>/_replication.log). It powers the generated /replicate WebSocket endpoint and the browser read-replica follower.

When false (the default), no broker is emitted. The write path's if let Some(broker) guard becomes static dead code the compiler removes.

Replication costs a second barrier per write

With replication = true, each insert/update/delete fsyncs the broker log in addition to the WAL — a second F_FULLFSYNC barrier. This roughly doubles single-write latency (measured ~3.95 ms → ~7.35 ms per insert). The default is off precisely so apps that never consume /replicate don't pay it. See durability and benchmarks.

Turn it on when you consume the replication stream or run a browser read-replica.

changefeed_capacity (Tier B, default 1024)#

The capacity of the in-process changefeed broadcast channel (used by the /subscribe and /live-query WebSocket endpoints) and the durable broker's buffer. It is a fan-out buffer, not on the durable write path, so raising it has no measured write-latency cost. Raise it freely for a high subscriber count.

max_cascade_depth (Tier B, default 64)#

Bakes const MAX_CASCADE_DEPTH. When you delete a parent whose relation FK declares @on_delete(cascade), the generated delete recurses into referencing children. This bound stops runaway recursion on a pathological FK cycle. Most schemas never approach 64.

  • [storage] — the durability/compaction knobs.
  • Generated REST API — the /replicate, /subscribe, and /live-query routes replication and changefeed_capacity feed.

Search documentation

Find pages across the ForgeDB docs