Skip to main content

APP_STATE

Constant APP_STATE 

Source
pub const APP_STATE: &str = "app_state";
Expand description

Versioned, namespaced application state (vta/app-state/{get,put,list, delete,get-many,put-many}/1.0) — the third store, beside VAULT (secrets and credentials) and MEMORY (agent memory), for JSON an application owns and the VTA does not interpret.

Four record shapes share the keyspace, distinguished by prefix:

  • app:<contextId>:<namespace>:<key> — the record itself. list in snapshot mode is an app:<contextId>:<namespace>: prefix scan.
  • appv:<contextId>:<namespace>:<version:020}> — version index, mapping a zero-padded counter value to its record key. Change-feed list scans this so it can return changes in version order and paginate over a stable storage key; a scan-and-sort over the records could do neither.
  • appc:<contextId>:<namespace> — the namespace’s monotonic write counter.
  • appt:<contextId>:<namespace> — the oldest version still covered by a retained tombstone, which is what sinceVersion is checked against.

Deliberately not MEMORY: clearing an agent’s memory has to stay a safe thing for a user to ask, which it cannot be if account state lives there. Durable user data — an account’s recoverability depends on it — so it is in BACKED_UP, and a restore that came back without it would defeat the point of the feature.