pub enum Message {
Hello {
format: u32,
workspace_id: GrainId,
replica_id: ReplicaId,
vv: VersionVector,
max_file_size: u64,
acks: bool,
},
Updates(Vec<PathUpdate>),
Done,
Want(ContentHash),
Missing(ContentHash),
Aborted(ContentHash),
Settled,
Live(Vec<PathUpdate>),
Refused(String),
Ack(VersionVector),
}Expand description
One control message.
Variants§
Hello
The first message from each side.
Fields
vv: VersionVectorEverything the sender already has.
max_file_size: u64The largest file the sender writes, in bytes. The peer sends nothing larger unasked: content over it would be refused as a protocol error.
acks: boolWhether the sender answers a Message::Live push with Message::Ack, and
reads one. Absent from a peer older than acknowledgements: false, and no Ack
is ever sent to it.
Updates(Vec<PathUpdate>)
A page of path states the peer’s version vector does not cover.
Done
The sender has sent every Updates page it had.
Want(ContentHash)
The sender needs the content behind this hash.
Missing(ContentHash)
The sender does not have the content behind this hash either.
Aborted(ContentHash)
The sender started this content and could not finish it: the file changed under it.
Sent in place of the content’s BLOB_END. The receiver discards what it got and
treats the hash as Message::Missing.
Settled
The sender will ask for nothing further, and has answered every Want it will get.
Sent after the peer’s Done, once this side’s want list is empty — at which point it
cannot grow again. Without it a side that stopped reading at Done would drop the
Want the peer sends after applying a page, and every file over the inline limit
would silently never arrive.
Live(Vec<PathUpdate>)
A push of path states sent after the initial exchange, while the session stays open.
Refused(String)
The sender will not continue, and why.
Ack(VersionVector)
The sender has everything this version vector covers: the path states, and the
content behind them on disk (or answered Missing by whoever was asked).
Sent in the live phase, after the Live batches it answers have been applied, and
only to a peer whose Hello said acks. It is what lets the pushing side know a
local edit has left the device, rather than only that it was queued.