Expand description
Opt-in periodic snapshots of in-memory server state (VM entity tables + projection caches) and a restore path that rehydrates on startup, so a restarted server comes back with its history instead of starting empty.
arete-server owns all snapshot logic. The generated runtime’s only
responsibilities are (1) registering the VmContext/SlotTracker it
creates via register_runtime and (2) hydrating from a restored blob via
take_restored before connecting to Yellowstone. Those hooks resolve
through a task-local SnapshotRuntime, so multiple servers embedded in
one process cannot consume or replace each other’s snapshot state. A stack
built with an older arete-macros simply never registers a VM; snapshots
stay disabled with a warning.
Consistency cut: every generated VM update holds a shared snapshot barrier guard until its mutation batch has been applied by the projector. Snapshot capture takes the exclusive guard before dumping either side, so the VM, projection caches, and resume watermark all describe the same processing cut. On restore the stream replays from that watermark; the snapshotted version trackers drop the overlap.
Re-exports§
pub use envelope::SnapshotContract;pub use envelope::SnapshotHeader;pub use envelope::SnapshotPayload;pub use store::FsStore;pub use store::SnapshotStore;
Modules§
- envelope
- On-disk snapshot format: a JSON header (readable with
head/jqafter skipping 12 bytes) followed by a zstd-compressed JSON payload. - store
- Pluggable snapshot blob storage.
Structs§
- Restored
State - VM state handed from the restore path to the generated runtime, consumed
exactly once via
take_restored. - Snapshot
Barrier - Per-runtime barrier that keeps snapshot capture from splitting a VM update from the projection batch it produced.
- Snapshot
Config - Configuration for state snapshots. Disabled by default; enable via
ServerBuilder::snapshots(...)orARETE_SNAPSHOT_*env vars. - Snapshot
Processing Guard - Shared processing guard carried by a mutation batch until projection is complete. The inner guard is intentionally opaque outside arete-server.
- Snapshot
Runtime - Per-server snapshot coordination shared by its parser, projector, snapshot manager, and readiness endpoint.
- Snapshot
Service - Owns the store plus everything needed to dump and restore state. Created by
Runtime::runwhen snapshots are enabled.
Enums§
- Reconnect
Position - Where the generated Yellowstone runtime should resume its stream.
- Snapshot
Trigger - What kicked off a snapshot cycle.
Functions§
- register_
runtime - Called by the generated runtime after it creates its
VmContextandSlotTracker, so the snapshot manager can dump them later. - take_
restored - Called by the generated runtime before connecting: returns the restored VM state (if any) exactly once.