Skip to main content

Serving

Struct Serving 

Source
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>

Source

pub fn own(catalog: &'a Catalog) -> Self

A worker that brings its own catalog.

Source

pub fn provisioned(provision: &'a dyn Provision) -> Self

A worker that starts empty and is sent what to execute, with this to interpret it.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for Serving<'a>

§

impl<'a> !RefUnwindSafe for Serving<'a>

§

impl<'a> Send for Serving<'a>

§

impl<'a> Sync for Serving<'a>

§

impl<'a> Unpin for Serving<'a>

§

impl<'a> UnsafeUnpin for Serving<'a>

§

impl<'a> !UnwindSafe for Serving<'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 = 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.