pub struct Session { /* private fields */ }Expand description
A client’s side of one conversation with one broker.
Implementations§
Source§impl Session
impl Session
Sourcepub fn packing(self, codec: Arc<dyn Codec>) -> Self
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.
Sourcepub fn find(&self, host: &Host) -> Result<Path, TransportError>
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.
Sourcepub fn wire(
&self,
host: &Host,
carries: Option<(Artifact, String)>,
) -> Result<Arc<Worker>, TransportError>
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.
Sourcepub fn wire_token(&self, host: &Host) -> Result<Vec<u8>, TransportError>
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.