pub struct SyncEnvelope {
pub schema_version: Option<u32>,
pub extras: Option<Value>,
}Expand description
Wire-level envelope that every sync record carries.
Embedded in each SyncEndpoint::Record via #[serde(flatten)]
so the two fields end up at the top of the JSON object alongside
the resource-specific columns. Lets the version-skew story live
in one place — not duplicated on every resource type.
schema_version: which wire shape the daemon wrote this row
with. None on the wire means “I’m not declaring one; treat as
1.” Client::sync fills this in from
SyncEndpoint::CURRENT_SCHEMA_VERSION when a consumer leaves
it None.
extras: free-form JSON map for fields the consumer’s
schema version recognises but the platform’s doesn’t yet. The
platform persists extras verbatim so a future deploy can
promote a field out of it into a typed column without data loss.
The platform deliberately does not echo extras back on GET —
it’s an internal-storage construct, not a public field.
Both fields are optional in serialization so a row that ships neither stays on the small/fast path.
Fields§
§schema_version: Option<u32>§extras: Option<Value>Implementations§
Source§impl SyncEnvelope
impl SyncEnvelope
Sourcepub fn for_endpoint<E: SyncEndpoint + ?Sized>() -> Self
pub fn for_endpoint<E: SyncEndpoint + ?Sized>() -> Self
Build an envelope stamped with the endpoint’s
CURRENT_SCHEMA_VERSION. Useful for daemon-side code that
wants to construct a record with the version already filled
in — Client::sync will also fill it in lazily, but doing it
at construction time keeps tests and logs honest.
Trait Implementations§
Source§impl Clone for SyncEnvelope
impl Clone for SyncEnvelope
Source§fn clone(&self) -> SyncEnvelope
fn clone(&self) -> SyncEnvelope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more