pub struct Recovery { /* private fields */ }Expand description
Reads what a crashed turn left behind and decides what to do about it.
Implementations§
Source§impl Recovery
impl Recovery
Sourcepub fn new(
conversations: Arc<dyn ConversationStore>,
journal: Arc<dyn CommandJournal>,
events: Arc<dyn EventJournal>,
replay: Arc<dyn ReplayStore>,
) -> Self
pub fn new( conversations: Arc<dyn ConversationStore>, journal: Arc<dyn CommandJournal>, events: Arc<dyn EventJournal>, replay: Arc<dyn ReplayStore>, ) -> Self
Builds a recovery reader over the stores a turn writes to.
Sourcepub async fn unfinished(
&self,
scope: RecoveryScope,
limit: usize,
) -> Result<Vec<TurnPhaseMarker>, OrchestratorError>
pub async fn unfinished( &self, scope: RecoveryScope, limit: usize, ) -> Result<Vec<TurnPhaseMarker>, OrchestratorError>
The unfinished turns, oldest first, for a sweep to work through.
§Errors
OrchestratorError::Store when the sweep could not read.
Sourcepub async fn decide(
&self,
account: &AccountId,
turn_id: &TurnId,
) -> Result<RecoveryAction, OrchestratorError>
pub async fn decide( &self, account: &AccountId, turn_id: &TurnId, ) -> Result<RecoveryAction, OrchestratorError>
Decides what one turn needs (spec §23.1).
§Errors
OrchestratorError::Store when the phase marker or the journal could
not be read. A turn that does not exist for account is
StoreError::NotFound, indistinguishable from another tenant’s.
Sourcepub async fn stored_turn(
&self,
account: &AccountId,
turn_id: &TurnId,
) -> Result<StoredTurn, OrchestratorError>
pub async fn stored_turn( &self, account: &AccountId, turn_id: &TurnId, ) -> Result<StoredTurn, OrchestratorError>
The stored turn, for a caller that regenerates a response.
§Errors
OrchestratorError::Store; a turn of another tenant is
StoreError::NotFound.
Sourcepub async fn record(
&self,
account: &AccountId,
turn_id: &TurnId,
) -> Result<Option<ReplayRecord>, OrchestratorError>
pub async fn record( &self, account: &AccountId, turn_id: &TurnId, ) -> Result<Option<ReplayRecord>, OrchestratorError>
The replay record of a turn, when one was written.
§Errors
OrchestratorError::Store for anything but a missing record, which is
reported as Ok(None): a turn that crashed before its first record is a
normal thing to find.
Sourcepub async fn case_events(
&self,
account: &AccountId,
case_key: &CaseKey,
since: CaseRevision,
) -> Result<Vec<StoredEvent>, OrchestratorError>
pub async fn case_events( &self, account: &AccountId, case_key: &CaseKey, since: CaseRevision, ) -> Result<Vec<StoredEvent>, OrchestratorError>
Every event of one case since a revision, for a regeneration that needs more than the turn’s own events.