Skip to main content

Served

Enum Served 

Source
pub enum Served<'a> {
    Reply {
        opcode: u8,
        len: usize,
        more_chunks: bool,
    },
    Subscribe(SubscribeRequest<'a>),
    Silent,
    Unhandled {
        opcode: u8,
    },
}
Expand description

What the caller should do with the result of a dispatch.

Deliberately not #[non_exhaustive]. Every variant demands a different action from the caller, so a wildcard arm is a silent bug rather than forward compatibility: a node that matched _ => {} would answer a new action with silence. Adding a variant here is a breaking change, and should be.

Variants§

§

Reply

Send buf[..len] back on the same exchange, with this opcode.

Fields

§opcode: u8

The response opcode (§10.2.1).

§len: usize

How many octets of the output buffer the message occupies.

§more_chunks: bool

Whether the message set MoreChunkedMessages (§10.2.3).

When set, the read is not finished: §10.2.3 requires the client’s StatusResponse before the next message, so the caller sends this one, waits for it, and dispatches again with the same ReadCursor.

§

Subscribe(SubscribeRequest<'a>)

A SubscribeRequest, decoded and handed on.

Subscriptions are the one action whose state is not the dispatcher’s: it lives in SubscriptionTable, outlives the exchange, and is driven by a reporting engine rather than by a reply. So this is where the dispatcher stops.

§

Silent

Nothing to send: the action was suppressed or groupcast (§8.7.2.3).

§

Unhandled

Not an action this layer serves — a response opcode, or one from a newer revision.

The one that matters in practice is StatusResponse: §10.2.3 makes it the client’s acknowledgement of a chunk, so a caller holding a ReadCursor that is not ReadCursor::is_done answers it by dispatching the same read again rather than by treating it as a new action.

§8.2.5.1 makes an unexpected action INVALID_ACTION, but a response opcode on an exchange this node initiated is not unexpected at all, and the dispatcher cannot tell the two apart without knowing which role it holds. So it says what it saw and lets the caller, which does know, decide.

Fields

§opcode: u8

The opcode that was not served.

Trait Implementations§

Source§

impl<'a> Debug for Served<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for Served<'a>

§

impl<'a> Freeze for Served<'a>

§

impl<'a> Move for Served<'a>

§

impl<'a> RefUnwindSafe for Served<'a>

§

impl<'a> Send for Served<'a>

§

impl<'a> Sync for Served<'a>

§

impl<'a> Unpin for Served<'a>

§

impl<'a> UnsafeUnpin for Served<'a>

§

impl<'a> UnwindSafe for Served<'a>

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

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.