Enum ockam_node::RouterReply
source · pub enum RouterReply {
Ok,
Workers(Vec<Address>),
Sender {
addr: Address,
sender: MessageSender<RelayMessage>,
},
State(bool),
TerminalAddress(Option<AddressAndMetadata>),
Metadata(Option<AddressMetadata>),
}
Expand description
Successful return values from a router command
Variants§
Ok
Success with no payload
Workers(Vec<Address>)
A list of worker addresses
Sender
Message sender to a specific worker
Fields
sender: MessageSender<RelayMessage>
The relay sender
State(bool)
Indicate the ‘ready’ state of an address
TerminalAddress(Option<AddressAndMetadata>)
Metadata value of the first terminal address in the route
Metadata(Option<AddressMetadata>)
Optional metadata value
Implementations§
source§impl RouterReply
impl RouterReply
sourcepub fn ok() -> NodeReplyResult
pub fn ok() -> NodeReplyResult
Return RouterReply::Ok
sourcepub fn state(b: bool) -> NodeReplyResult
pub fn state(b: bool) -> NodeReplyResult
Return RouterReply::State
sourcepub fn no_such_address(a: Address) -> NodeReplyResult
pub fn no_such_address(a: Address) -> NodeReplyResult
Return NodeError::Address not found
sourcepub fn worker_exists(a: Address) -> NodeReplyResult
pub fn worker_exists(a: Address) -> NodeReplyResult
Return NodeError::Address already exists for the given address
sourcepub fn router_exists() -> NodeReplyResult
pub fn router_exists() -> NodeReplyResult
Return NodeError::RouterState already exists
sourcepub fn node_rejected(reason: NodeReason) -> NodeReplyResult
pub fn node_rejected(reason: NodeReason) -> NodeReplyResult
Return NodeError::NodeState conflict
sourcepub fn worker_rejected(reason: WorkerReason) -> NodeReplyResult
pub fn worker_rejected(reason: WorkerReason) -> NodeReplyResult
Return NodeError::WorkerState conflict
sourcepub fn workers(v: Vec<Address>) -> NodeReplyResult
pub fn workers(v: Vec<Address>) -> NodeReplyResult
Return RouterReply::Workers for the given addresses
sourcepub fn terminal_address(address: Option<AddressAndMetadata>) -> NodeReplyResult
pub fn terminal_address(address: Option<AddressAndMetadata>) -> NodeReplyResult
Returns RouterReply::TerminalAddress for the given address
sourcepub fn metadata(value: Option<AddressMetadata>) -> NodeReplyResult
pub fn metadata(value: Option<AddressMetadata>) -> NodeReplyResult
Returns RouterReply::Metadata for the given metadata
sourcepub fn sender(
addr: Address,
sender: MessageSender<RelayMessage>
) -> NodeReplyResult
pub fn sender( addr: Address, sender: MessageSender<RelayMessage> ) -> NodeReplyResult
Return RouterReply::Sender for the given information
sourcepub fn take_sender(self) -> Result<(Address, MessageSender<RelayMessage>)>
pub fn take_sender(self) -> Result<(Address, MessageSender<RelayMessage>)>
Consume the wrapper and return RouterReply::Sender
sourcepub fn take_workers(self) -> Result<Vec<Address>>
pub fn take_workers(self) -> Result<Vec<Address>>
Consume the wrapper and return RouterReply::Workers
sourcepub fn take_state(self) -> Result<bool>
pub fn take_state(self) -> Result<bool>
Consume the wrapper and return RouterReply::State
sourcepub fn take_terminal_address(self) -> Result<Option<AddressAndMetadata>>
pub fn take_terminal_address(self) -> Result<Option<AddressAndMetadata>>
Consumes the wrapper and returns RouterReply::TerminalAddress
sourcepub fn take_metadata(self) -> Result<Option<AddressMetadata>>
pub fn take_metadata(self) -> Result<Option<AddressMetadata>>
Consumes the wrapper and returns RouterReply::Metadata
sourcepub fn is_ok(self) -> Result<()>
pub fn is_ok(self) -> Result<()>
Returns Ok if self is RouterReply::Ok
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RouterReply
impl !RefUnwindSafe for RouterReply
impl Send for RouterReply
impl Sync for RouterReply
impl Unpin for RouterReply
impl !UnwindSafe for RouterReply
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more