module

Arcana::Snapshot

Shutdown snapshots for crash recovery.

Captures the full bus state (directory listings, mailbox messages, frozen messages, tokens) into a single JSON file. Reloaded at startup to restore everything as it was at last clean shutdown.

See bin/arcana.cr for the SIGTERM/SIGINT trap that calls save, and the startup load that calls load.

Constants

VERSION = 1

Class methods

load(bus : Bus, directory : Directory, server : Server, backend : StateBackend) : Bool

Restore bus state from the supplied StateBackend. Returns true if state was loaded, false if the backend has no saved state. Raises on malformed JSON.

Source
load(bus : Bus, directory : Directory, server : Server, path : String) : Bool

Path-taking convenience wrapper.

Source
save(bus : Bus, directory : Directory, server : Server, backend : StateBackend) : Nil

Write the full bus state via the supplied StateBackend. The backend is responsible for atomicity and durability semantics.

Source
save(bus : Bus, directory : Directory, server : Server, path : String) : Nil

Path-taking convenience wrapper. Constructs a LocalFileBackend on the fly. Existing callers that pass a path keep working.

Source