Skip to main content

Node

Struct Node 

Source
pub struct Node { /* private fields */ }
Expand description

A bot’s peer side: Peers for delegating, a Channel per team for tasks it receives.

Implementations§

Source§

impl Node

Source

pub fn new( config: NodeConfig, store: Arc<dyn ConversationStore>, clock: Arc<dyn Clock>, ) -> Result<Self, Error>

A node for config; file manifests are read now.

Source

pub async fn start(&self) -> Vec<String>

Fetches the manifests of URL teams, marks tasks left by a stop as failed, and returns problems worth a warning (this bot missing from a team, a manifest that cannot be read).

Source

pub fn channels(&self) -> Vec<Arc<dyn Channel>>

One peer:<team> channel per team: it serves the team’s endpoint (tasks when the team’s accept allows them, relaying, refusals that say why) and the bot’s socket.

Source

pub async fn check(&self) -> Vec<(String, bool, String)>

Checks each team without changing anything: its manifest (fetched for URL teams), this bot’s membership, and whether the members it may call are reachable. One line per finding, with true when it is fine.

Source

pub fn teams(&self) -> Vec<String>

The team ids.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Node

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Peers for Node

Source§

fn directory<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>, PeerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Members this bot may delegate to (the manifest’s links from this bot).
Source§

fn delegate<'life0, 'async_trait>( &'life0 self, delegation: Delegation, ) -> Pin<Box<dyn Future<Output = Result<PeerTask, PeerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Hands work to a member and waits up to Delegation::wait for it to end.
Source§

fn status<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, team: &'life1 str, peer: &'life2 str, task: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<PeerTask, PeerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

The current state of a task this bot delegated.
Source§

fn cancel<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, team: &'life1 str, peer: &'life2 str, task: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<PeerTask, PeerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Asks the other bot to stop a task this bot delegated.
Source§

fn report_usage<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, conversation: &'life1 ConversationKey, task: Option<&'life2 str>, tokens: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The tokens the turn answering the task of conversation (task, or the oldest) used, its own delegations included; reported with the task’s end.
Source§

fn progress( &self, conversation: &ConversationKey, task: Option<&str>, text: &str, )

What the turn answering the task of conversation (task, or the oldest) is doing now, shown to the caller while the task works. Called from the agent’s output reader: quick.
Source§

fn fail<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, conversation: &'life1 ConversationKey, task: Option<&'life2 str>, reason: &'life3 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

The runtime could not answer the task of conversation (task, or the oldest): it fails with reason instead of completing with a fixed reply.
Source§

fn answer<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, task: &'life1 PeerTask, prompt: &'life2 str, button: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<PeerTask, PeerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Answers the question of a task waiting for input (the origin person pressed button).
Source§

fn caller<'life0, 'life1, 'async_trait>( &'life0 self, conversation: &'life1 ConversationKey, ) -> Pin<Box<dyn Future<Output = Option<PeerCaller>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The authenticated sender of an inbound event of a peer channel; None for other events.
Source§

fn team_person(&self, account: &str) -> Option<String>

The team person whose accounts include account (platform:instance/user-id).
Source§

fn member_name(&self, team: &str) -> Option<String>

This bot’s member name in team.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Node

§

impl !UnwindSafe for Node

§

impl Freeze for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more