Expand description
Publishing shared state as snapshots or patches.
The client keeps a copy of the agent’s state. Sending the whole thing on
every change is wasteful for a large document that gained one field, and
sending a patch is wasteful for a small document that changed completely.
StateManager keeps the last published snapshot and picks per publish:
- the first publish is always a
STATE_SNAPSHOT— the client’s copy may have drifted, and a patch against an unknown base is inapplicable; - afterwards it diffs against the last snapshot with RFC 6902 and emits
STATE_DELTA; - unless the serialized patch is no smaller than the serialized snapshot, in which case it snapshots instead.
Structs§
- State
Manager - Tracks the last published state so changes can go out as patches.
Enums§
- State
Publish - What a publish decided to send.