pub struct Serving<'a> { /* private fields */ }Expand description
A worker about to serve: what it executes with, and where it listens.
Implementations§
Source§impl<'a> Serving<'a>
impl<'a> Serving<'a>
Sourcepub fn provisioned(provision: &'a dyn Provision) -> Self
pub fn provisioned(provision: &'a dyn Provision) -> Self
A worker that starts empty and is sent what to execute, with this to interpret it.
Sourcepub fn store(self, store: &'a dyn Store) -> Self
pub fn store(self, store: &'a dyn Store) -> Self
The same worker, with somewhere to keep the artifacts it is sent.
The have/want finally having a have: offered an artifact it already
has in the store, it says Ready and not a byte crosses. A shared
folder means the second worker stood up is provisioned without the
client noticing.
Sourcepub fn reporting(self, every: Duration) -> Self
pub fn reporting(self, every: Duration) -> Self
Writes a reading of this machine to the store this often, whether or not anybody is asking it to do anything.
The idle half, and the pipe is CU20’s rule: where a connection is open, facts come back down it; where there is none, they go to the store. An idle worker’s connection is one nobody is reading, so beating down it would fill a buffer nobody drains and hand over the oldest beats whenever somebody finally looked.
Off unless asked for, and it does nothing without a
store to write to.
Sourcepub fn keeping(self, keeper: &'a dyn Keeper) -> Self
pub fn keeping(self, keeper: &'a dyn Keeper) -> Self
The same worker, able to keep what the slices it runs produce.
Separate from Serving::store and not derived from it: that one keeps
artifacts, so a worker is not sent a catalog it already has; this one
keeps values, so a node whose answer is already known is not run at
all. Both can be the same directory underneath.
What is remembered about each node does not come from here: it arrives with the work, because it belongs to the graph.
Sourcepub fn packing(self, codec: &'a dyn Codec) -> Self
pub fn packing(self, codec: &'a dyn Codec) -> Self
The same worker, able to read and write down what only exists in a process.
The same codecs as the client’s, or the two ends do not understand each other — which is what the error says when it happens. Whoever stands this worker up installs it; it does not travel.
Sourcepub fn over_stdin(self) -> Result<()>
pub fn over_stdin(self) -> Result<()>
Serves over standard input, until the client closes.
Returns Ok(()) when the input ends between messages, which is how
it normally finishes. A failure of what gets executed is not an error
here: it travels back as an answer.
Sourcepub fn listen(self, addr: impl ToSocketAddrs) -> Result<()>
pub fn listen(self, addr: impl ToSocketAddrs) -> Result<()>
Stands on addr and serves whoever connects. It does not return: it
stops by being shut down, and a client that cuts out does not stop it.
Sourcepub fn listen_at(
self,
addr: impl ToSocketAddrs,
opened: impl FnOnce(SocketAddr),
) -> Result<()>
pub fn listen_at( self, addr: impl ToSocketAddrs, opened: impl FnOnce(SocketAddr), ) -> Result<()>
The same, reporting which address it ended up open on, so port 0 can
be asked for.