Expand description
The typed transfer event stream: what an upload, a push or a fetch is doing, as it does it, for a caller that renders progress (the TUI’s transfer view, a mobile progress bar).
Progress used to exist only as tracing lines, which a UI cannot consume. A
TransferEvents handle is attached to the clients that move bytes —
UploadClient::with_events (which
push_bundle drives),
verify_custody_with_events and
RangedFetcher::with_events — and every
subscriber receives each TransferEvent in the order the client took the step.
§Contract
-
Zero cost when nobody listens. A client built without a handle, or one whose handle has no live subscriber, never constructs an event:
TransferEvents::emittakes a closure and calls it only when a receiver exists. The disabled path is one branch. -
A transfer never waits on its observer. The channel is a bounded [
tokio::sync::broadcast]: a subscriber that falls more thancapacityevents behind readsRecvError::Laggedwith the count it missed, and the transfer carries on. Progress is advisory; the transfer’s result is the value its call returns. -
Deterministic order. One transfer’s events arrive in the order its state machine took the steps, so a scripted fault schedule produces the same sequence every run. Events carry the blob’s content address, so a subscriber watching several concurrent transfers through one handle can tell them apart.
-
Replayable. An event serializes to one JSON object and parses back to the same value, so a recorded stream replays into a progress UI exactly as it was published.
Events describe the transfer, never its contents: offsets, sizes, content addresses and session ids, no plaintext and no key material.
Structs§
- Transfer
Events - The handle a transfer publishes its
TransferEvents through.
Enums§
- Retry
Reason - Why a chunk is being sent again, or from a different offset than the last acknowledgement.
- Transfer
Event - One step of a transfer.
Constants§
- DEFAULT_
CAPACITY - The capacity
TransferEvents::default_channeluses: room for a few seconds of chunk traffic on a fast link before a stalled subscriber starts lagging.