View Source Runbox.StateStore.Savepoint (runbox v21.2.0)

Savepoint represents state of runtime run valid to scheduled timestamp.

Summary

Functions

Predicate returning true when all registered states has been saved.

Returns entities with saved states.

Creates new savepoint with given timestamp and register entities.

Returns all registered entity ids.

Returns registered entities count of given savepoint.

Saves entity state in given savepoint.

Returns savepoint timestamp.

Types

@type t() :: %Runbox.StateStore.Savepoint{
  entity_registry: %{
    required(Runbox.StateStore.Entity.id()) =>
      :not_set_yet | Runbox.StateStore.Entity.state()
  },
  stats: %{registered: integer(), saved: integer()},
  timestamp: Runbox.StateStore.ScheduleUtils.epoch_ms()
}

Functions

@spec all_saved?(t()) :: boolean()

Predicate returning true when all registered states has been saved.

Link to this function

entity_states(savepoint)

View Source
@spec entity_states(t()) :: [
  {Runbox.StateStore.Entity.id(), Runbox.StateStore.Entity.state()}
]

Returns entities with saved states.

Link to this function

new(entity_ids, timestamp)

View Source

Creates new savepoint with given timestamp and register entities.

Link to this function

registered_entities(savepoint)

View Source
@spec registered_entities(t()) :: [Runbox.StateStore.Entity.id()]

Returns all registered entity ids.

Link to this function

registered_entities_count(savepoint)

View Source
@spec registered_entities_count(t()) :: integer()

Returns registered entities count of given savepoint.

Link to this function

save(savepoint, entity_id, entity_state)

View Source

Saves entity state in given savepoint.

Returns savepoint timestamp.