pub trait SupervisorPort: Send + Sync {
// Required methods
fn run_turn(
&self,
request: TurnRequest,
access: Arc<dyn TurnAccess>,
) -> BoxFuture<'_, Result<TurnOutcome, SupervisorError>>;
fn close_session(
&self,
print_id: PrintId,
close_reason: String,
) -> BoxFuture<'_, Result<(), SupervisorError>>;
// Provided method
fn idle_work_ended(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<(), SupervisorError>> { ... }
}Expand description
The port the supervising agent is reached 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 SupervisorPort>.
Required Methods§
Sourcefn run_turn(
&self,
request: TurnRequest,
access: Arc<dyn TurnAccess>,
) -> BoxFuture<'_, Result<TurnOutcome, SupervisorError>>
fn run_turn( &self, request: TurnRequest, access: Arc<dyn TurnAccess>, ) -> BoxFuture<'_, Result<TurnOutcome, SupervisorError>>
Run one supervision turn, opening the session if it is not open.
access issues each run of the turn the credential it authenticates
to the server with; see access.
Sourcefn close_session(
&self,
print_id: PrintId,
close_reason: String,
) -> BoxFuture<'_, Result<(), SupervisorError>>
fn close_session( &self, print_id: PrintId, close_reason: String, ) -> BoxFuture<'_, Result<(), SupervisorError>>
Close the session watching one print.
Provided Methods§
Sourcefn idle_work_ended(
&self,
print_id: PrintId,
) -> BoxFuture<'_, Result<(), SupervisorError>>
fn idle_work_ended( &self, print_id: PrintId, ) -> BoxFuture<'_, Result<(), SupervisorError>>
Answer once no idle work of this port on one print’s session is under way: at once when there is none, and otherwise when it ends.
What the periodic observation awaits before it claims the print, so a scheduled check does not cancel a compaction of the session it is about to continue; every other event’s turn starts at once. A port does all its work inside a turn unless it says otherwise, which is why this answers at once by default.
§Errors
None this default answers; a port whose wait could not be taken answers
SupervisorError::Unavailable, and the check runs regardless.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".