pub trait Process<W, A>{
// Required methods
fn init(
&mut self,
args: Vec<String>,
net: ProcNet<W, A>,
id: Id,
ids: Vec<Id>,
start_msg_id: MsgId,
);
fn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Status> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Maelstrom node process
A process receives, processes and, if necessary, responds to
- Maelstrom workload messages
- node-to-node messages according to the application’s protocol that are delivered by the crate::runtime::Runtime via the process’s ProcNet instance.
Parameters
W
the workload body type, e.g. EchoA
the application body type
Required Methods§
Sourcefn init(
&mut self,
args: Vec<String>,
net: ProcNet<W, A>,
id: Id,
ids: Vec<Id>,
start_msg_id: MsgId,
)
fn init( &mut self, args: Vec<String>, net: ProcNet<W, A>, id: Id, ids: Vec<Id>, start_msg_id: MsgId, )
Create a process
args
pass through command line argsnet
a network interface to Maelstromid
this node’s IDids
all protocol participants’ IDsstart_msg_id
the first message ID to use. Initialization messages are handled by the runtime, so this may be greater than 0.
Sourcefn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Status> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Status> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run the process
The call should return when the process is complete or the runtime has shutdown.
Return
- Ok IFF the process completed successfully,
- Err:Error::Shutdown IFF the runtime has shutdown,
- Err otherwise