View Source Runbox.StateStore.Storage.BinaryStorage (runbox v25.0.1)
Runbox.StateStore.Storage behaviour implementation.
This implementation uses erlang built-in :erlang.term_to_binary/1 and :erlang.binary_to_term/1
functions to persist and restore run state.
Savepoints are persisted atomically - the savepoint is first written into a temporary file next to its target location and only then renamed, so that a crash during the write can never leave a partially written savepoint under the name from which it would be restored.
Summary
Types
@type run_id() :: String.t()
Functions
@spec decode_savepoint(binary()) :: {:ok, Runbox.StateStore.ScheduleUtils.epoch_ms(), [{Runbox.StateStore.Entity.id(), Runbox.StateStore.Entity.state()}]} | {:error, :corrupted_savepoint}
@spec encode_savepoint(Runbox.StateStore.ScheduleUtils.epoch_ms(), [ {Runbox.StateStore.Entity.id(), Runbox.StateStore.Entity.state()} ]) :: {:ok, binary()}