Expand description
weida: a QUIC-native messaging framework.
This crate hosts the runtime, the native QUIC transport, the raw stream core
and the brokerless messaging patterns: Req/Rep, Push/Pull, Pub/Sub, PAIR,
SURVEY and BUS — the whole nanomsg set, none of which adds wire
vocabulary. A completion is a cursor: a level plus an absolute byte
offset, reported on a unidirectional stream of its own
(Cursors, Reporter).
docs/ARCHITECTURE.md describes the layer model,
docs/PROTOCOL.md is the normative wire specification, and
docs/FAILURE_MODEL.md defines what each outcome means.
use weida::{Runtime, RuntimeConfig, TransferMeta, Trust};
let runtime = Runtime::new(RuntimeConfig::default())?;
// Trust belongs to the dialling endpoint, not to the runtime. Here the
// address itself names the peer's public key, so nothing else is needed.
let requester = runtime.requester(Trust::by_address());
requester
.connect("weida://sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08@127.0.0.1:7443/transform")
.await?;
// One bidirectional stream: the request half and the reply half. The
// stream is the correlation, so nothing on the wire names the exchange.
let (mut transfer, reply) = requester.open(TransferMeta::default()).await?;
transfer.write_all(b"hello weida").await?;
transfer.finish()?;
let body = reply.recv().await?.collect(64 * 1024).await?;
println!("{}", String::from_utf8_lossy(&body));The example above runs on the caller’s ambient Tokio reactor. A caller
that has none — or whose executor is not Tokio at all — uses
Runtime::owned instead: the runtime then owns the reactor quinn
needs, and every task, timer and name lookup weida performs runs there,
while the futures it hands back may be driven by any executor. Transfer
payloads implement both the tokio::io and the futures-io traits for
the same reason.
Modules§
- codes
- QUIC application error codes used in
CONNECTION_CLOSE,RESET_STREAMandSTOP_SENDING(docs/PROTOCOL.md§7). - filter
- The topic filter grammar of
docs/PROTOCOL.md§6.4.
Structs§
- Acceptor
- The bound side of the stream core.
- Binding
- One concrete transport binding of a
Listener. - Client
Tls - TLS configuration of a dialling endpoint: what it trusts and, optionally, who it is.
- Connection
Id - Identifies one connection of this process.
- Connection
Stats - One live connection of a dialling handle, labelled by the address the application dialled (0036 §4.1).
- Consumer
- One subscribed consumer, and the way to deliver to it.
- Consumer
Id - Identifies one consuming connection on one path.
- Credit
Grant - A consumer’s absolute delivery limit for one subscription.
- Cursor
Set - The latest offset reported per level, for one transfer.
- Cursors
- The reader’s end of one transfer’s report.
- Delivery
- The transport receipt for a finished transfer.
- Dish
Drops - What a radio dropped toward one joined dish connection, summed over topics (decisions/0037 §4.6).
- Drained
- What a drain achieved, counted locally.
- Endpoint
- A typed messaging endpoint.
- Endpoint
Addr - A parsed
weida://[fingerprint@]host[:port]/pathaddress. - FanOut
- A publish in progress: a payload written once and fanned out to one stream per subscriber, without ever being held whole.
- Files
Options - How a file source watches its directory.
- Fingerprint
- SHA-256 digest of a peer’s public key.
- Flow
- The sending half of one datagram flow.
- Flow
Info - What the receiver learns about a flow when it arrives.
- Flow
Meta - What a sender attaches to a flow, once, when it registers it.
- Flow
Stats - Counters of one flow, on the side that holds it.
- Gap
- What a receiver observed about one transfer’s place in its producer’s sequence.
- Guarantee
Set - One level per guarantee dimension, as declared in HELLO keys
5and6(docs/PROTOCOL.md§6.5). - Handoff
- What
Binding::hand_overleaves for the successor: the bound socket and the close packets held for its clients (decisions/0039). - Identity
- Who this endpoint is: a certificate chain and the private key behind it.
- Identity
Events - The event stream of one
IdentitySourceorTrustSource. - Identity
Source - Where an identity comes from, and the identity of the moment.
- Incoming
Flow - The receiving half of one datagram flow.
- Incoming
Meta - Metadata of an inbound transfer.
- Incoming
Request - A request accepted by a
crate::Replieror a rawcrate::Acceptor. - Incoming
Transfer - An inbound transfer: one receive stream plus the metadata that described it.
- Inproc
Addr - A parsed
weida+inproc://<bus>/<path>address. - Join
- A dish’s request to join a filter, as a radio’s admission sees it
(
Radio::with_admission, decisions/0035 §4.3). - Join
Terms - What a dish asks for when it joins a filter (decisions/0037 §4.3).
- Limits
- Resource limits applied to one connection.
- Listener
- One externally reachable messaging namespace.
- Local
Binding - One in-process binding: a bus name and nothing else.
- Local
Principal - A principal the kernel proved, on a local transport.
- Network
- Where a runtime’s QUIC sockets live: the operating system’s UDP (the default) or, with the
cargo feature
test-util, aSimNetshared by the runtimes of one test. Local transports (weida+inproc,+unix,+pipe) are not affected. - Outgoing
Transfer - An outgoing transfer: one QUIC send stream, owned outright.
- Path
Stats - What the path under a connection looks like now — what a jitter buffer or a bitrate controller sizes itself by.
- Peer
- The dialling side of the stream core.
- Peer
Chain - The certificate chain a peer presented in the TLS handshake: DER, leaf first, as it arrived. weida parsed only the leaf’s public key, whose fingerprint is the peer; what the rest certifies is the application’s to read (decisions/0035 §4.2).
- Peer
Events - The event stream of one dialling endpoint.
- Pipe
Addr - A parsed
weida+pipe://<pipe-name>/<path>address. - Reconnect
Policy - How a dialling endpoint redials an address it has lost.
- Remote
Stats - The peer’s view of the path under a connection, from its latest REPORT record (decisions/0036 §4.5).
- Reply
Stream - The reply half of an exchange the requester is waiting on.
- Reporter
- The writer’s end: what a receiver uses to report on a transfer it got.
- Runtime
- A process-level execution and resource container.
- Runtime
Config - Configuration for one
crate::Runtime. - Segment
- One segment, open on every receiver it was opened toward.
- Segment
Terms - How a segment is sent: what the sender decides for every copy of it (decisions/0037 §4.2).
- Server
Tls - TLS configuration of a binding: who it is and, optionally, whom it lets in.
- Shared
Resolver - The resolver a configuration holds.
- Survey
Run - One survey in progress: the answers, and what the deadline cost.
- System
Resolver - The system resolver: an IP literal in place, everything else through
getaddrinfo. - Topic
Drops - What a publisher dropped on one topic, by cause.
- Trace
Context - A W3C Trace Context
traceparent. - Transfer
Meta - Per-transfer metadata supplied by the application.
- Transport
Stats - The transport’s view of one QUIC connection: its path and its traffic in both directions.
- Trust
- Whom a peer is accepted as.
- Trust
Source - Whom a peer is accepted as, as a source: the anchors and pins of the moment, changeable under a live binding.
- UdpCounts
- UDP datagrams and the bytes inside them, in one direction of one connection. Every QUIC packet travels in one, so this counts all of a connection’s traffic, not one flow’s payload.
- Unix
Addr - A parsed
weida+unix://<percent-encoded-socket-path>/<path>address. - Unix
Binding - One
AF_UNIXbinding: the socket file, removed when this drops. - Weak
Identity Source - A handle to an
IdentitySourcethat does not keep it alive. - Weak
Trust Source - A handle to a
TrustSourcethat does not keep it alive. - Windows
Principal - A principal the kernel proved, on a Windows named pipe.
Enums§
- Acknowledgement
- Acknowledgement/completion dimension. A ladder; the durability axes of
Durabilityandreplicasare not part of it. - Address
- An address of any transport.
- Alpn
- The TLS ALPN token a binding offers or a dial asks for.
- Backpressure
- Backpressure dimension. Not ordered: these are behaviours, not strengths, so two peers state the same one or fail to negotiate.
- Bus
- A member of a BUS.
- Cast
- The sending side of RADIO/DISH: lossy fan-out of segments (decisions/0034 §4.6).
- Client
Trust - Whom a binding lets in when it requires clients to present a key.
- Congestion
- A QUIC congestion controller, as
quinnimplements them. - Cursor
Level - A level a cursor can name: one weida defines, or one the application does.
- Deduplication
- Deduplication dimension. A ladder: later is stronger.
- Delivery
Level - Delivery dimension (
GUARANTEES.md§3). A ladder: later is stronger. - Discovery
- Whether a dialled authority may name a set of nodes.
- Durability
- Persistence axis of
Stored/Replicated(decisions/0004 §4.1). - Error
- Everything that can go wrong in a weida operation.
- Error
Code - Wire codes carried in an ERROR frame (
docs/PROTOCOL.md§6.4). - GiveUp
- Why a slot stopped redialling.
- Identity
Event - One transition of an
IdentitySource. - Incoming
- One inbound thing on a raw acceptor’s path, whichever kind the peer sent.
- Loss
Cause - Why a connection is gone.
- Ordering
Mode - Ordering dimension. A ladder: later is stronger.
- Outbox
Full - What a
senddoes when the outbox is at its bound (crate::RuntimeConfig::outbox_messages). - Pair
- Either side of PAIR: one connection, one peer, both directions.
- Peer
Event - One transition of one dialled address, reported on
PeerEvents. - Peer
Identity - Who the peer is, once it has been proved.
- Pem
- Where PEM material comes from.
- Producer
Naming - How a producer is named for the sequence field of decisions/0001 §7.3. Not ordered: two peers state the same one or fail.
- Pub
- The publishing side of Pub/Sub.
- Pull
- The receiving side of Push/Pull.
- Push
- The sending side of Push/Pull.
- Received
- What a dish receives.
- Rep
- The replying side of Req/Rep.
- Report
Mode - How often a reporter emits a record (
docs/PROTOCOL.md§6.2, key11). - Reported
- What a bounded wait for a cursor found.
- Req
- The requesting side of Req/Rep.
- Respond
- The answering side of SURVEY.
- Stop
Reason - Why a peer refused to receive more payload, as carried by
STOP_SENDING’s QUIC application error code. - Sub
- The subscribing side of Pub/Sub.
- Survey
- The asking side of SURVEY.
- Tune
- The receiving side of RADIO/DISH.
Constants§
- ALPN
- TLS ALPN token identifying the weida native QUIC protocol.
- DEFAULT_
DATAGRAM_ RECEIVE_ BYTES - The documented
Limits::datagram_receive_bytesfor a profile that enables datagram flows: 64 KiB, about fifty full datagrams. - DEFAULT_
PORT - The port a
weida://URL means when it writes none. - MAX_
SEGMENT_ LAYERS - How many layers a stream segment can carry:
0..=15, the cap of DATA key14(decisions/0037 §4.3). - RAFT_
ALPN - TLS ALPN token of a consensus connection (weida-raft); same protocol, separate connections.
- VERSION
- Wire protocol version implemented by this crate (experimental).
Traits§
Functions§
- new_
trace - Generates a fresh root trace context.
Type Aliases§
- BusMember
- One member of a BUS.
- Dish
- The receiving half of RADIO/DISH: connects, joins topics, and receives the newest segment of each.
- Paired
- Either half of PAIR — the pattern is symmetric, so there is one role.
- Publisher
- The publishing half of Pub/Sub.
- Puller
- The receiving half of Push/Pull.
- Pusher
- The sending half of Push/Pull.
- Radio
- The sending half of RADIO/DISH: binds, and fans segments out to every dish whose filter matches, dropping rather than waiting.
- Replier
- The replying half of Req/Rep.
- Requester
- The requesting half of Req/Rep.
- Resolved
- The future a
Resolverreturns. - Respondent
- The answering half of SURVEY.
- Result
- Convenience alias used throughout the framework.
- Subscriber
- The subscribing half of Pub/Sub.
- Surveyor
- The asking half of SURVEY.