Expand description
The replication session two sapphire-framework replicas run over a byte stream.
One Replica per side, one bidirectional stream, and a framed exchange of version
vectors, path updates and content. This crate is the only place that knows the wire
format; it neither knows nor cares what carries the bytes.
Two shapes of session are built on that exchange:
run_session— a one-shot catch-up. It returns once both sides are caught up.open_live_session— the same catch-up, then a stream that stays open: each side pushes what it commits and applies what arrives.
See docs/superpowers/specs/2026-09-15-p2p-sync-iroh-design.md §3.7 and §4.2.
Structs§
- Live
Session - A session that stays open after the initial exchange.
- Session
Outcome - What a session did.
Enums§
Constants§
- CHUNK
- Most content one
BLOB_CHUNKframe carries, in bytes. The sender reads, and the receiver holds, at most this much of a file at a time. - HELLO_
TIMEOUT - How long the exchange waits for the peer’s
Hello. - IDLE_
TIMEOUT - How long the initial exchange goes without progress before it gives up on the peer.
- INLINE_
LIMIT - Largest payload carried inline in an
Updatespage, in bytes. Anything larger is fetched by hash within the same session. - MAX_
FRAME_ LEN - Longest control frame payload accepted, in bytes. Bounds the memory one peer can make the other allocate for one message.
- SESSION_
FORMAT_ VERSION - The session format this build speaks. Sent in the first message and checked.
Functions§
- open_
live_ session - Run the initial exchange and then keep the session open.
- read_
frame - Read one frame.
Noneat a clean end of stream. - read_
framed - Read one tagged frame’s payload.
Noneat a clean end of stream. - run_
session - Run a session to completion.
- write_
blob_ chunk - Send the next piece of the content started last. More than
CHUNKbytes isError::FrameTooLarge, and nothing is written. - write_
blob_ end - Say the content started last is complete.
- write_
blob_ start - Start sending the content
hash,lenbytes long. - write_
control - Send a control message.
- write_
framed - Send one frame:
tag, then a four-byte big-endian length, thenpayload.
Type Aliases§
- Result
- Result alias for a session.