pub struct Worker { /* private fields */ }Expand description
A process that executes the slices it is sent.
Implementations§
Source§impl Worker
impl Worker
Sourcepub fn spawn(command: Command) -> Result<Self>
pub fn spawn(command: Command) -> Result<Self>
Starts the process and keeps its pipes. The worker there has to bring
its own catalog; for an empty one, see Worker::carrying.
stderr is left inherited: its stdout is the wire.
Sourcepub fn connect(addr: impl ToSocketAddrs) -> Result<Self>
pub fn connect(addr: impl ToSocketAddrs) -> Result<Self>
Connects to a worker that was already running — the form that satisfies
the use case. On the other side there is Serving::listen.
Sourcepub fn carrying(self, artifact: Artifact, runtime: impl Into<String>) -> Self
pub fn carrying(self, artifact: Artifact, runtime: impl Into<String>) -> Self
The same worker, carrying what to provision it with if it started empty.
runtime — cpython-3.13/cloudpickle-3.1 — is what the far side’s
Provision can reject at greeting time.
Sourcepub fn offering(
&self,
artifact: Artifact,
runtime: impl Into<String>,
) -> Result<(), TransportError>
pub fn offering( &self, artifact: Artifact, runtime: impl Into<String>, ) -> Result<(), TransportError>
The same on an already-built worker, for whoever decides at run time which nodes go to this host. Setting the same artifact twice does nothing; changing an open session’s fails.
Sourcepub fn packing(self, codec: Arc<dyn Codec>) -> Self
pub fn packing(self, codec: Arc<dyn Codec>) -> Self
The same worker, with somebody who knows how to write down what an opaque carries.
Without one, a value that only exists in this process is refused at encoding time. With one, it crosses as bytes and the refusal is left for what nobody registered a codec for.