this.ctx.storage (an ActorStorage) is the actor’s per-key persistent storage. Writes that return successfully are persisted.
- Lazy per
get— state is not preloaded on activation. Callgetwhen you need it. - Read-your-writes — reads always reflect prior writes from the same actor.
- Per-actor method serialization — calls to one actor instance are dispatched one at a time, giving you effective ACID at the actor level.
- Values round-trip through a codec. JSON natives plus
Date,Map,Set, typed arrays,ArrayBuffer,BigInt, andRegExpcome back as what you stored. Unstorable values — functions, class instances, circular structures, promises, streams — are rejected with aCodecErrorat the write. - Keys starting with
__telnyx_are reserved for the runtime’s own bookkeeping — writes to them are rejected.
list(options)
Lexicographic key order; reverse: true flips it. Returns a Map<string, T> to preserve ordering.
transaction(fn)
Atomic batch. fn receives a StorageTransaction with the same get/put/delete/list surface.
fn throws, the buffered writes are discarded — and the enclosing method call
fails with ActorOutputGateError, even if your code catches the rejection. Only the
transaction’s own writes are undone: writes you make after catching the rejection still
commit, but the caller sees the error instead of your return value. A thrown transaction
is not a control-flow tool for “try the write, continue on failure”.
Related
- Actor Context —
ctx.storagelives here - Alarms — the
setAlarm/getAlarm/deleteAlarmcontract