Struct ockam_node::Executor
source · pub struct Executor { /* private fields */ }
Expand description
Underlying Ockam node executor
This type is a small wrapper around an inner async runtime (tokio
by
default) and the Ockam router. In most cases it is recommended you use the
ockam::node
function annotation instead!
Implementations§
source§impl Executor
impl Executor
sourcepub fn new(rt: Arc<Runtime>, flow_controls: &FlowControls) -> Self
pub fn new(rt: Arc<Runtime>, flow_controls: &FlowControls) -> Self
Create a new Ockam node Executor
instance
sourcepub async fn start_router(&mut self) -> Result<()>
pub async fn start_router(&mut self) -> Result<()>
Start the router asynchronously
sourcepub fn execute<F, T, E>(&mut self, future: F) -> Result<F::Output>
pub fn execute<F, T, E>(&mut self, future: F) -> Result<F::Output>
Initialise and run the Ockam node executor context
In this background this launches async execution of the Ockam router, while blocking execution on the provided future.
Any errors encountered by the router or provided application code will be returned from this function.
sourcepub fn execute_no_abort<F, T>(&mut self, future: F) -> Result<F::Output>
pub fn execute_no_abort<F, T>(&mut self, future: F) -> Result<F::Output>
Initialise and run the Ockam node executor context
In this background this launches async execution of the Ockam router, while blocking execution on the provided future.
Any errors encountered by the router or provided application code will be returned from this function.
Don’t abort the router in case of a failure
sourcepub fn execute_future<F>(future: F) -> Result<F::Output>
pub fn execute_future<F>(future: F) -> Result<F::Output>
Execute a future and block until a result is returned This function can only be called to run futures before the Executor has been initialized. Otherwise the Executor rt attribute needs to be accessed to execute or spawn futures