pub trait ChannelHost:
Send
+ Sync
+ 'static {
Show 13 methods
// Required methods
fn app_name(&self) -> &str;
fn now(&self) -> DateTime<Utc>;
fn approvals(&self) -> Option<Arc<dyn ApprovalService>>;
fn audit_trail(&self) -> Option<AuditTrail>;
fn start_turn<'life0, 'async_trait>(
&'life0 self,
run: NewRun,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn finished_turns<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, RunRecord>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stop_all<'life0, 'life1, 'async_trait>(
&'life0 self,
reason: &'life1 str,
by: AuditActor,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn quiet_until(&self, at: DateTime<Utc>) -> Option<DateTime<Utc>> { ... }
fn quiet_ends<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ApprovalRequest,
at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Option<DateTime<Utc>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn rates_high(&self, request: &ApprovalRequest) -> bool { ... }
fn moves_money(&self, request: &ApprovalRequest) -> bool { ... }
fn steer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user: &'life1 str,
session: &'life2 str,
text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SteerReceipt>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn turn<'life0, 'life1, 'async_trait>(
&'life0 self,
pid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RunRecord>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
What the gateway runs on (spec 3.3 §10 K1): the Kernel, or a test
double such as the contract suite’s.
Required Methods§
Sourcefn approvals(&self) -> Option<Arc<dyn ApprovalService>>
fn approvals(&self) -> Option<Arc<dyn ApprovalService>>
The approval service decisions go through; None when the host has none.
Sourcefn audit_trail(&self) -> Option<AuditTrail>
fn audit_trail(&self) -> Option<AuditTrail>
The audit trail the kernel.channel records go to.
Sourcefn start_turn<'life0, 'async_trait>(
&'life0 self,
run: NewRun,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_turn<'life0, 'async_trait>(
&'life0 self,
run: NewRun,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Starts run, a paired account’s turn; a run whose idempotency key was used returns
the process that key started. Returns the process id.
§Errors
Returns KernelError::Frozen while everything is stopped, or the host’s error.
Sourcefn finished_turns<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, RunRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn finished_turns<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, RunRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The turns that finish from now on, as their final run records.
§Errors
Returns the host’s error when it cannot follow its runs.
Provided Methods§
Sourcefn quiet_until(&self, at: DateTime<Utc>) -> Option<DateTime<Utc>>
fn quiet_until(&self, at: DateTime<Utc>) -> Option<DateTime<Utc>>
When quiet time that holds at ends, or None when at is not in quiet time; no
card is delivered before then.
Sourcefn quiet_ends<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ApprovalRequest,
at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Option<DateTime<Utc>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn quiet_ends<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ApprovalRequest,
at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Option<DateTime<Utc>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
When quiet time that holds at ends for request, or None when at is not in
quiet time; no card of it is delivered before then. The kernel answers with the
quiet time of the decision’s area in force now, a change made while it runs included
(spec 3.3 §10 K3); the default answers quiet_until.
Sourcefn rates_high(&self, request: &ApprovalRequest) -> bool
fn rates_high(&self, request: &ApprovalRequest) -> bool
Whether the host rates request’s call high risk whatever the request says, so chat
links it to the home (spec 3.3 §7.2, S-I6). The kernel rates so a tool a mounted
driver declares publish_public or financial, the classes nothing may allow without
a person (spec 3.2 K-I9). false by default.
Sourcefn moves_money(&self, request: &ApprovalRequest) -> bool
fn moves_money(&self, request: &ApprovalRequest) -> bool
Whether request’s call moves money, which chat never decides (spec 3.3 §7.4 rule
4). The kernel answers for the tools its mounted drivers declare financial; the
gateway adds the tools ChannelGatewayBuilder::money_tools names. false by
default.
Sourcefn steer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user: &'life1 str,
session: &'life2 str,
text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SteerReceipt>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn steer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user: &'life1 str,
session: &'life2 str,
text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SteerReceipt>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Sends text to the turn of user’s session session that runs on this host (spec
3.3 §6 “steer”): its agent takes the message at its next safe point, and the receipt
says whether it did. None, the default, when no turn of the session takes messages
here — none runs, or another replica runs it — so the gateway starts a turn with the
message instead.
§Errors
Returns the host’s error when it refuses the message; the gateway then starts a turn with it, which answers the thread as any turn does.
Sourcefn turn<'life0, 'life1, 'async_trait>(
&'life0 self,
pid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RunRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn turn<'life0, 'life1, 'async_trait>(
&'life0 self,
pid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<RunRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The run of turn pid as it stands, wherever it runs: the gateway asks after the
turns it started, so a turn another replica ran still gets its reply. None by
default, for a host whose turns all finish in finished_turns.
§Errors
Returns the host’s error when it cannot read the run.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".