Skip to main content

Session

Struct Session 

Source
pub struct Session { /* private fields */ }
Expand description

A client’s side of one conversation with one broker.

Implementations§

Source§

impl Session

Source

pub fn with(broker: Arc<Embedded>) -> Self

A session with this broker.

Source

pub fn packing(self, codec: Arc<dyn Codec>) -> Self

The same session, with somebody who knows how to write down what an opaque carries. Set before use, so every wire gets the same one.

Source

pub fn find(&self, host: &Host) -> Result<Path, TransportError>

Where this host is, asking the broker if nobody has yet.

Public because deciding what to pack needs it before the run starts: what goes to a host depends on which hosts are the same place.

Source

pub fn wire( &self, host: &Host, carries: Option<(Artifact, String)>, ) -> Result<Arc<Worker>, TransportError>

The wire to this host, opening it if this is the first work for it.

carries is what to provision the far side with, handed to the wire when it is born and only sent if the far side asks. If this wire was already open for another name of the same place, the artifact is the same one by construction, which the wire treats as nothing to do.

Source

pub fn wire_token(&self, host: &Host) -> Result<Vec<u8>, TransportError>

A token that is equal for two hosts that share a wire and different for two that do not.

It exists for whoever decides what to pack: a worker has one catalog, so what is packed is packed per wire and not per name, and the only thing that knows which names are one wire is this. Handing out a token rather than the path keeps the rule here.

The bytes of the path itself, so two tokens are equal exactly when the paths are — with the host appended when the path is not shared, so a command listed twice is two tokens and gets run twice.

Source

pub fn done(&self, host: &Host)

Lets a rendezvous go. Best effort, like the message it sends.

Auto Trait Implementations§

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 = 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.