class

Arcana::StateBackend

Inherits Reference < Object

Abstract pluggable persistence for the bus snapshot blob.

Decouples how state is stored (filesystem today; Postgres or S3 tomorrow) from what gets stored (the JSON snapshot built by Arcana::Snapshot). Implementations must be safe for concurrent save calls: a partial write must never be observable by load.

The backend handles bytes-on-the-wire only. Serialization / deserialization stays in Snapshot.

Instance methods

close

Release any resources (file handles, DB connections). The default is a no-op for backends that hold nothing open.

Source
exists?

Has anything been saved yet?

Source
load

Return the most recent saved payload, or nil if nothing has ever been saved.

Source
save(payload : String) : Nil

Persist the given payload (typically a JSON string). Must be atomic — a crash mid-save should leave the prior state intact, not a torn or empty file.

Source