Struct Node

Source
pub struct Node<Service: Service> { /* private fields */ }
Expand description

The Node is the entry point to the whole iceoryx2 infrastructure and owns all entities.

As soon as a process crashes other processes can detect dead Nodes via Node::list() and clean up the stale resources - the entities that were created via the Node.

Can be created via the NodeBuilder.

Implementations§

Source§

impl<Service: Service> Node<Service>

Source

pub fn name(&self) -> &NodeName

Returns the NodeName.

Source

pub fn config(&self) -> &Config

Returns the Config that the Node will use to create any iceoryx2 entity.

Source

pub fn id(&self) -> &NodeId

Returns the NodeId of the Node.

Source

pub fn service_builder(&self, name: &ServiceName) -> Builder<Service>

Instantiates a ServiceBuilder for a service with the provided name.

Source

pub fn list<F: FnMut(NodeState<Service>) -> CallbackProgression>( config: &Config, callback: F, ) -> Result<(), NodeListFailure>

Calls the provided callback for all Nodes in the system under a given Config and provides NodeState<Service> as input argument. With every iteration the callback has to return CallbackProgression::Continue to perform the next iteration or CallbackProgression::Stop to stop the iteration immediately.

Node::<ipc::Service>::list(Config::global_config(), |node_state| {
    println!("found node {:?}", node_state);
    CallbackProgression::Continue
});
Source

pub fn wait(&self, cycle_time: Duration) -> Result<(), NodeWaitFailure>

Waits until the cycle time has passed. It returns NodeWaitFailure::TerminationRequest when a SIGTERM signal was received or NodeWaitFailure::Interrupt when a SIGINT signal was received.

Source

pub fn signal_handling_mode(&self) -> SignalHandlingMode

Returns the SignalHandlingMode with which the Node was created.

Source

pub fn cleanup_dead_nodes(config: &Config) -> CleanupState

Removes the stale system resources of all dead Nodes. The dead Nodes are also removed from all registered Services.

If a Node cannot be cleaned up since the process has insufficient permissions then the Node is skipped.

Trait Implementations§

Source§

impl<Service: Debug + Service> Debug for Node<Service>

Source§

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

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

impl<Service: Service> Send for Node<Service>

Auto Trait Implementations§

§

impl<Service> Freeze for Node<Service>

§

impl<Service> !RefUnwindSafe for Node<Service>

§

impl<Service> Sync for Node<Service>

§

impl<Service> Unpin for Node<Service>

§

impl<Service> !UnwindSafe for Node<Service>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.