pub trait StorePort: Send + Sync {
Show 21 methods
// Required methods
fn open_print(
&self,
obico_print_id: Option<i64>,
file_name: Option<String>,
) -> BoxFuture<'_, Result<PrintRecord, StoreError>>;
fn print(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<Option<PrintRecord>, StoreError>>;
fn open_prints(&self) -> BoxFuture<'_, Result<Vec<PrintRecord>, StoreError>>;
fn print_by_obico_id(
&self,
obico_print_id: i64,
) -> BoxFuture<'_, Result<Option<PrintRecord>, StoreError>>;
fn end_print(
&self,
print_id: PrintId,
state: PrinterState,
ended_at: Timestamp,
reason: String,
) -> BoxFuture<'_, Result<PrintRecord, StoreError>>;
fn record_narrowing(
&self,
print_id: PrintId,
narrowing: ManifestNarrowing,
) -> BoxFuture<'_, Result<PrintRecord, StoreError>>;
fn append_event(
&self,
draft: EventDraft,
) -> BoxFuture<'_, Result<EventRecord, StoreError>>;
fn put_image(
&self,
print_id: PrintId,
event_id: EventId,
source_url: Option<String>,
content_type: String,
bytes: RawBytes,
) -> BoxFuture<'_, Result<ImageRecord, StoreError>>;
fn image(
&self,
image_id: ImageId,
) -> BoxFuture<'_, Result<ImageLookup, StoreError>>;
fn record_action(
&self,
request: ActionRequest,
decision: PolicyDecision,
) -> BoxFuture<'_, Result<ActionRecord, StoreError>>;
fn record_execution(
&self,
action_id: ActionId,
outcome: ExecutionOutcome,
) -> BoxFuture<'_, Result<ActionRecord, StoreError>>;
fn open_intervention(
&self,
action_id: ActionId,
adjustable: Adjustable,
prior_value: Option<f64>,
applied_value: f64,
applied_at: Timestamp,
expires_at: Timestamp,
) -> BoxFuture<'_, Result<Intervention, StoreError>>;
fn settle_intervention(
&self,
intervention_id: InterventionId,
outcome: InterventionOutcome,
) -> BoxFuture<'_, Result<SettleOutcome, StoreError>>;
fn due_interventions(
&self,
at: Timestamp,
) -> BoxFuture<'_, Result<Vec<Intervention>, StoreError>>;
fn active_interventions(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<Vec<Intervention>, StoreError>>;
fn put_manifest(
&self,
print_id: PrintId,
manifest: JobManifest,
) -> BoxFuture<'_, Result<(), StoreError>>;
fn manifest(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<Option<JobManifest>, StoreError>>;
fn history(
&self,
query: HistoryQuery,
) -> BoxFuture<'_, Result<Vec<EventRecord>, StoreError>>;
fn audit_page(
&self,
print_id: PrintId,
after: Option<EventId>,
page_size: u32,
) -> BoxFuture<'_, Result<AuditPage, StoreError>>;
fn put_session(
&self,
session: SupervisionSession,
) -> BoxFuture<'_, Result<(), StoreError>>;
fn session(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<Option<SupervisionSession>, StoreError>>;
}Expand description
The port durable state speaks through.
Every method is asynchronous, the trait is dyn-compatible, and it is
shareable across threads, because the supervision core holds it behind
Arc<dyn StorePort>.
Required Methods§
Sourcefn open_print(
&self,
obico_print_id: Option<i64>,
file_name: Option<String>,
) -> BoxFuture<'_, Result<PrintRecord, StoreError>>
fn open_print( &self, obico_print_id: Option<i64>, file_name: Option<String>, ) -> BoxFuture<'_, Result<PrintRecord, StoreError>>
Open a print, minting its identifier.
Sourcefn print(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<Option<PrintRecord>, StoreError>>
fn print( &self, print_id: PrintId, ) -> BoxFuture<'_, Result<Option<PrintRecord>, StoreError>>
Read one print by its identifier.
Sourcefn open_prints(&self) -> BoxFuture<'_, Result<Vec<PrintRecord>, StoreError>>
fn open_prints(&self) -> BoxFuture<'_, Result<Vec<PrintRecord>, StoreError>>
Read every print with no end recorded, most recently opened first.
This is what a supervisor adopts on start: the port already binds an action to the most recently opened print with no end recorded, and without this method nothing above the port could name that print in order to say it had adopted it.
Sourcefn print_by_obico_id(
&self,
obico_print_id: i64,
) -> BoxFuture<'_, Result<Option<PrintRecord>, StoreError>>
fn print_by_obico_id( &self, obico_print_id: i64, ) -> BoxFuture<'_, Result<Option<PrintRecord>, StoreError>>
Read one print by Obico’s own identifier for it.
Sourcefn end_print(
&self,
print_id: PrintId,
state: PrinterState,
ended_at: Timestamp,
reason: String,
) -> BoxFuture<'_, Result<PrintRecord, StoreError>>
fn end_print( &self, print_id: PrintId, state: PrinterState, ended_at: Timestamp, reason: String, ) -> BoxFuture<'_, Result<PrintRecord, StoreError>>
End a print, in a terminal state, at an instant, for a reason.
Sourcefn record_narrowing(
&self,
print_id: PrintId,
narrowing: ManifestNarrowing,
) -> BoxFuture<'_, Result<PrintRecord, StoreError>>
fn record_narrowing( &self, print_id: PrintId, narrowing: ManifestNarrowing, ) -> BoxFuture<'_, Result<PrintRecord, StoreError>>
Record that a manifest range was narrowed to the envelope’s.
Sourcefn append_event(
&self,
draft: EventDraft,
) -> BoxFuture<'_, Result<EventRecord, StoreError>>
fn append_event( &self, draft: EventDraft, ) -> BoxFuture<'_, Result<EventRecord, StoreError>>
Append one event, minting its identifier.
Sourcefn put_image(
&self,
print_id: PrintId,
event_id: EventId,
source_url: Option<String>,
content_type: String,
bytes: RawBytes,
) -> BoxFuture<'_, Result<ImageRecord, StoreError>>
fn put_image( &self, print_id: PrintId, event_id: EventId, source_url: Option<String>, content_type: String, bytes: RawBytes, ) -> BoxFuture<'_, Result<ImageRecord, StoreError>>
Store one image’s bytes, minting its identifier.
Sourcefn image(
&self,
image_id: ImageId,
) -> BoxFuture<'_, Result<ImageLookup, StoreError>>
fn image( &self, image_id: ImageId, ) -> BoxFuture<'_, Result<ImageLookup, StoreError>>
Read one image by its identifier.
Sourcefn record_action(
&self,
request: ActionRequest,
decision: PolicyDecision,
) -> BoxFuture<'_, Result<ActionRecord, StoreError>>
fn record_action( &self, request: ActionRequest, decision: PolicyDecision, ) -> BoxFuture<'_, Result<ActionRecord, StoreError>>
Record one request together with the decision taken on it.
This is the only method that takes either half, and it takes them only
together; the ActionId it answers is minted for the pair.
Sourcefn record_execution(
&self,
action_id: ActionId,
outcome: ExecutionOutcome,
) -> BoxFuture<'_, Result<ActionRecord, StoreError>>
fn record_execution( &self, action_id: ActionId, outcome: ExecutionOutcome, ) -> BoxFuture<'_, Result<ActionRecord, StoreError>>
Record what the printer made of an action that reached it.
Sourcefn open_intervention(
&self,
action_id: ActionId,
adjustable: Adjustable,
prior_value: Option<f64>,
applied_value: f64,
applied_at: Timestamp,
expires_at: Timestamp,
) -> BoxFuture<'_, Result<Intervention, StoreError>>
fn open_intervention( &self, action_id: ActionId, adjustable: Adjustable, prior_value: Option<f64>, applied_value: f64, applied_at: Timestamp, expires_at: Timestamp, ) -> BoxFuture<'_, Result<Intervention, StoreError>>
Open a bounded intervention, minting its identifier.
The print is the one the action was recorded against, so that a caller cannot name a print the action does not belong to.
Sourcefn settle_intervention(
&self,
intervention_id: InterventionId,
outcome: InterventionOutcome,
) -> BoxFuture<'_, Result<SettleOutcome, StoreError>>
fn settle_intervention( &self, intervention_id: InterventionId, outcome: InterventionOutcome, ) -> BoxFuture<'_, Result<SettleOutcome, StoreError>>
Settle one intervention, or report the outcome that already won.
Sourcefn due_interventions(
&self,
at: Timestamp,
) -> BoxFuture<'_, Result<Vec<Intervention>, StoreError>>
fn due_interventions( &self, at: Timestamp, ) -> BoxFuture<'_, Result<Vec<Intervention>, StoreError>>
Read every intervention due to expire at or before an instant.
Sourcefn active_interventions(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<Vec<Intervention>, StoreError>>
fn active_interventions( &self, print_id: PrintId, ) -> BoxFuture<'_, Result<Vec<Intervention>, StoreError>>
Read every intervention still active on one print.
Sourcefn put_manifest(
&self,
print_id: PrintId,
manifest: JobManifest,
) -> BoxFuture<'_, Result<(), StoreError>>
fn put_manifest( &self, print_id: PrintId, manifest: JobManifest, ) -> BoxFuture<'_, Result<(), StoreError>>
Store one print’s manifest.
Sourcefn manifest(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<Option<JobManifest>, StoreError>>
fn manifest( &self, print_id: PrintId, ) -> BoxFuture<'_, Result<Option<JobManifest>, StoreError>>
Read one print’s manifest.
Sourcefn history(
&self,
query: HistoryQuery,
) -> BoxFuture<'_, Result<Vec<EventRecord>, StoreError>>
fn history( &self, query: HistoryQuery, ) -> BoxFuture<'_, Result<Vec<EventRecord>, StoreError>>
Read a print’s events, newest first.
Answers newest first. An empty kinds means every kind rather
than no kinds. An absent limit takes DEFAULT_HISTORY_WINDOW, and a
limit above MAX_HISTORY_LIMIT is refused rather than clamped —
resolve_history_limit is the one resolution of that rule.
Sourcefn audit_page(
&self,
print_id: PrintId,
after: Option<EventId>,
page_size: u32,
) -> BoxFuture<'_, Result<AuditPage, StoreError>>
fn audit_page( &self, print_id: PrintId, after: Option<EventId>, page_size: u32, ) -> BoxFuture<'_, Result<AuditPage, StoreError>>
Read one page of a print’s whole history, oldest first.
after is the identifier of the last event of the previous page, and is
absent for the first page. The page size is resolved by
resolve_history_limit like a history read’s limit, so a page above
MAX_HISTORY_LIMIT is refused rather than clamped.
Sourcefn put_session(
&self,
session: SupervisionSession,
) -> BoxFuture<'_, Result<(), StoreError>>
fn put_session( &self, session: SupervisionSession, ) -> BoxFuture<'_, Result<(), StoreError>>
Store one print’s supervision session.
Sourcefn session(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<Option<SupervisionSession>, StoreError>>
fn session( &self, print_id: PrintId, ) -> BoxFuture<'_, Result<Option<SupervisionSession>, StoreError>>
Read one print’s supervision session.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".