Skip to main content

Module transport

Module transport 

Source
Expand description

The socket a client speaks to, and what a connection needs to answer it.

One route, /socket, at the address the caller bound. Every connection gets its own subscription, so a second client changes nothing about the first. Every subscriber is delivered every update; the connection then filters to the subjects it asked for, which is what makes subject delivery correct and why the fan-out shares one update rather than copying it per reader.

Re-exports§

use std::sync::Arc; 🔒
use std::sync::Mutex; 🔒
use std::time::Duration; 🔒
use std::time::Instant; 🔒
use axum::Router; 🔒
use axum::routing::get; 🔒
use forge_primitives::Message; 🔒
use forge_primitives::SessionSlot; 🔒
use tokio::net::TcpListener; 🔒
use crate::live::Live; 🔒
use crate::surface::ViewSurface; 🔒
use crate::work::WorkCache; 🔒
use crate::SeatUpdate; 🔒
use crate::SessionUpdate; 🔒

Modules§

batch
When a connection’s stream goes out.
connection 🔒
One connection: the upgrade, what the server says first, and the loop that answers what a client asks for.
conversation
One seat’s conversation, held by the transport and kept up to date.
envelope
What a client and this server exchange.
frame
The binary frames on the socket.
origin 🔒
The socket’s Origin gate.
probe 🔒
The socket’s own bound on asking the core for a fresh context reading, the same two numbers a view bounds its ask with: a probe is answered inline over the CLI’s whole transcript, so it is worth asking for only when the reading it would replace is old enough and the transcript small enough to pay for it.
wire
A subject’s wire form, and the one place it is decided.

Structs§

Heartbeat
The socket’s keepalive: how often a connection is asked to prove it is still there, how long it may stay silent before it is reaped, and how long it may go without a completed write before a watchdog outside its future ends it.
TransportState
What a connection answers from: the surface it reads and dispatches through, the working-tree cache behind the git read, the conversations the stream has seeded, the live state a late subscriber cannot reconstruct for itself, and the [client] settings the greeting carries.
WriteStalled 🔒
A frame write that outlived WRITE_BOUND.

Enums§

Ask 🔒
Why the socket owes the core a fresh context reading, which is what an update says about a seat’s held one.

Constants§

PROTOCOL_VERSION
The protocol this server speaks.
WRITE_BOUND 🔒
The longest one frame may take to reach the socket before its peer is judged to have stopped reading.

Functions§

context_ask 🔒
What this update asks of the core about a seat’s context reading.
encode_settings 🔒
Encode one settings document once, so every connection writes the same bytes rather than building the frame for itself.
fold_the_stream 🔒
Fold the core’s stream into the live state and the conversations this transport holds.
publish_settings 🔒
Follow the workspace’s document and hand each new one to every connection through the watch, encoded once.
request_context_usage 🔒
Ask the core for a fresh context reading on a seat a page shows.
serve
Serve the socket on listener until the process ends.
settings_channel
A settings watch holding no document, for a transport built by hand (a test): a connection with no frame draws its page’s waiting state.
settles_a_compaction 🔒
Whether this update reports a compaction’s own outcome, which is the frame that ends one.
write_within 🔒
Wait on one socket write under bound, failing as WriteStalled when it does not complete in time.