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: TranscribeSinkWhere 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: DropSinkA file dropped onto the composer, kept by the city.
acp: AcpSinkWhere 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: MonitorFeedThe performance monitor, for the sessions that ask to watch it.
queries: AnsweringAnswers 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: LocalDoorThis 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).