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§
- HELLO_
TIMEOUT - How long the exchange waits for the peer’s
Hello. - 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 frame payload accepted, in bytes. Matches the replication core’s
DEFAULT_MAX_FILE_SIZE, and bounds the memory one peer can make the other allocate. - 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’s tag and payload, dispatching on
tagwithread_tagged. - read_
framed - Read one tagged frame’s payload.
Noneat a clean end of stream. - run_
session - Run a session to completion.
- write_
blob - Send content.
- 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.