Skip to main content

ServeConfig

Struct ServeConfig 

Source
pub struct ServeConfig {
Show 17 fields pub client: Arc<ClientAssets>, pub transcribe_sink: TranscribeSink, pub drop_sink: DropSink, pub acp: AcpSink, pub commands: Arc<dyn Fn(WireCommand, Reply) -> Result<(), AxError> + Send + Sync>, pub events: Sender<Committed>, pub deltas: Sender<Delta>, pub logs: Sender<LogLine>, pub outputs: Sender<LiveOutput>, pub outputs_so_far: Arc<dyn Fn() -> Vec<LiveOutput> + Send + Sync>, pub monitor: MonitorFeed, pub queries: Answering, pub secrets: Arc<dyn Fn(Command<Sealed<String>>, Reply) -> Result<(), AxError> + Send + Sync>, pub city: Option<Address>, pub head: Arc<LedgerHead>, pub epoch: Option<B3Hash>, pub door: LocalDoor,
}
Expand description

Everything the shell needs that it must not decide for itself.

Each sink is injected as a closure rather than as a trait: wire declares no pub trait (it is not on the seam list, ARCHITECTURE section 3), and one implementation is not a seam.

Fields§

§client: Arc<ClientAssets>

The client bundle, handed in by the assembly layer so this crate never learns where build artifacts live.

§transcribe_sink: TranscribeSink

Where a recording goes, and the line of text that comes back.

A route of its own rather than a Command, for the reason enrolment has one: a Command is accepted and answered later through the event stream, and the text of what somebody just said has to come back to the tab that recorded it. A Query is the other shape that answers, and a query that spent seconds on a provider would be a command pretending to be a read.

The media type travels beside the bytes because a container the city cannot name has no media type to send, and the judgement of which containers exist belongs to whoever speaks the audio wire.

§drop_sink: DropSink

A file dropped onto the composer, kept by the city.

§acp: AcpSink

Where a request from an outside editor goes. Separate from commands because it arrives over its own route, carries its own authentication, and gets an answer rather than an event stream.

§commands: Arc<dyn Fn(WireCommand, Reply) -> Result<(), AxError> + Send + Sync>

Where an accepted Command goes. Accepting is not running it: a dispatch may take hours, and awaiting it inside the socket task would tie the work to the lifetime of one browser tab. The sink takes the command, returns, and the progress comes back as events.

The Reply travels with the command because the answer arrives long after this call returned, and a refusal belongs to the peer that caused it.

§events: Sender<Committed>

The event fan-out. This crate only subscribes; the writer is whoever owns the Ledger, because the ledger line is the event.

§deltas: Sender<Delta>

What a model is saying, while it is still saying it.

A second channel rather than a second variant on the first, because the two carry different kinds of thing and lag differently: an increment a slow client missed is nothing, and an event it missed is history it must recover. Sharing one channel would let a burst of increments push records out of a reader’s window.

§logs: Sender<LogLine>

The process log, on its way to whoever has the log lens open.

A third channel for the reason there is a second: what it carries is discardable, and a slow reader that lost a line has lost nothing. Sharing the event channel would let a city running at the wire floor push history out of that reader’s window.

§outputs: Sender<LiveOutput>

What running commands write, while they still write it. A fourth channel, so a command flooding its stdout cannot push increments or log lines out of a slow reader’s window.

§outputs_so_far: Arc<dyn Fn() -> Vec<LiveOutput> + Send + Sync>

What running commands already wrote, in the order they wrote it. A session sends it after Welcome, having subscribed to outputs first, so a piece may arrive twice and never not at all.

§monitor: MonitorFeed

The performance monitor, for the sessions that ask to watch it.

§queries: Answering

Answers a query from the city’s derived views.

§secrets: Arc<dyn Fn(Command<Sealed<String>>, Reply) -> Result<(), AxError> + Send + Sync>

Where an enrolled credential goes. Takes the full Command and not WireCommand: this is the one sink whose input has no byte form, which is what keeps enrolment a local act.

§city: Option<Address>

Which city this server is. Told at the handshake, because a client that only hears what happens next cannot know the name of a city that was initialised last month.

§head: Arc<LedgerHead>

The seq of the last record broadcast on events, which every welcome names so a reconnecting client fetches only what it missed. The writer is whoever broadcasts, and it advances the head before each broadcast.

§epoch: Option<B3Hash>

The chain hash of the Ledger’s first line, read once at startup: a ledger keeps its epoch for its whole life.

§door: LocalDoor

This machine’s door for a browser: its pairing code, open codes, paired device keys and live session tokens (crates/wire/spec/Server.lean §8-93).

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more