In-memory DurableServer.StorageBackend for dev and test.
Drop-in compatible with DurableServer.Backends.ObjectStore, including its
JSON round-trip: stored bodies are encoded with JSON.encode!/1, so state
comes back with string keys exactly as it would from S3. Etag CAS
(try_claim/3, put_object/4 with :etag, update_object/4) is
implemented faithfully — DurableServer's locking depends on it.
Storage lives in a named Agent, so it survives DurableServer supervisor
restarts (the deploy-simulation scenario). Start it explicitly:
# test
start_supervised!({DurableStash.TestBackend, name: MyBackend})
# dev supervision tree
children = [
{DurableStash.TestBackend, name: MyBackend},
{DurableServer.Supervisor,
name: MySupervisor, prefix: "dev/", backend: {DurableStash.TestBackend, name: MyBackend}}
]If the named agent is not running when init_backend/1 is called, it is
started unlinked as a convenience for one-off scripts.
Summary
Functions
Returns the raw stored objects (%{key => %{body: encoded, etag: etag}}).
Drops every stored object. Useful between tests sharing a named backend.