Trait bee_runtime::node::Node[][src]

pub trait Node: Send + Sized + 'static {
    type Builder: NodeBuilder<Self>;
    type Backend: StorageBackend;
    type Error: Error;
#[must_use]    fn stop<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
    where
        Self: 'async_trait
;
fn spawn<W, G, F>(&mut self, g: G)
    where
        W: Worker<Self>,
        G: FnOnce(Receiver<()>) -> F,
        F: Future<Output = ()> + Send + 'static
;
fn worker<W>(&self) -> Option<&W>
    where
        W: Worker<Self> + Send + Sync
;
fn register_resource<R: Any + Send + Sync>(&mut self, res: R);
fn remove_resource<R: Any + Send + Sync>(&mut self) -> Option<R>;
fn resource<R: Any + Send + Sync>(&self) -> ResourceHandle<R>; fn info(&self) -> ResourceHandle<NodeInfo> { ... }
fn storage(&self) -> ResourceHandle<Self::Backend> { ... }
fn bus(&self) -> ResourceHandle<Bus<'static>> { ... } }

A trait representing a node framework through which node workers may communicate.

Associated Types

type Builder: NodeBuilder<Self>[src]

The builder type used to create instances of this node.

type Backend: StorageBackend[src]

The storage backend used by this node.

type Error: Error[src]

The type of errors that may be emitted as a result of the build process.

Loading content...

Required methods

#[must_use]fn stop<'async_trait>(
    self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
    Self: 'async_trait, 
[src]

Stop the node, ending the execution of all workers in a timely manner.

fn spawn<W, G, F>(&mut self, g: G) where
    W: Worker<Self>,
    G: FnOnce(Receiver<()>) -> F,
    F: Future<Output = ()> + Send + 'static, 
[src]

Spawn a new node task associated with the given worker.

The task will be shut down with the worker to preserve topological worker ordering.

fn worker<W>(&self) -> Option<&W> where
    W: Worker<Self> + Send + Sync
[src]

Get a reference to the state of a worker.

fn register_resource<R: Any + Send + Sync>(&mut self, res: R)[src]

Register a new resource with the node such that other workers may access it via Node::resource.

fn remove_resource<R: Any + Send + Sync>(&mut self) -> Option<R>[src]

Attempt to remove a resource from the node, returning None if no such resource was registered with the node.

fn resource<R: Any + Send + Sync>(&self) -> ResourceHandle<R>[src]

Obtain an owning handle to a node resource.

Loading content...

Provided methods

fn info(&self) -> ResourceHandle<NodeInfo>[src]

Obtain an owning handle to the node's info.

fn storage(&self) -> ResourceHandle<Self::Backend>[src]

Obtain an owning handle to the node's storage backend.

fn bus(&self) -> ResourceHandle<Bus<'static>>[src]

Obtain an owning handle to the node's event bus.

Loading content...

Implementors

Loading content...