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.
- 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.
- 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.
- 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). - 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
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. - 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.
- Outgoing
Transfer - An outgoing transfer: one QUIC send stream, owned outright.
- Peer
- The dialling side of the stream core.
- 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.
- 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. - 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.
- 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.
- Unix
Addr - A parsed
weida+unix://<percent-encoded-socket-path>/<path>address. - Unix
Binding - One
AF_UNIXbinding: the socket file, removed when this drops. - 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.
- 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.
- 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.
- 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.
Constants§
- ALPN
- TLS ALPN token identifying the weida native QUIC protocol.
- DEFAULT_
PORT - The port a
weida://URL means when it writes none. - 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.
- 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.
- 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.