nodedb 0.4.0

Local-first, real-time, edge-to-cloud hybrid database for multi-modal workloads
Documentation
// SPDX-License-Identifier: BUSL-1.1

//! Self-describing WAL payload for CRDT delta records.
//!
//! Both the writer (`control/server/wal_dispatch/core.rs`) and the reader
//! (`data/executor/wal_replay/crdt.rs`) live in this crate and use this single
//! struct, encoded/decoded with `zerompk`, so there is exactly one
//! unambiguous decode path — no arity guessing.

/// WAL payload for a `RecordType::CrdtDelta` record.
///
/// `collection` is `Some(_)` for every record written by the current binary —
/// both per-document delta applies (`CrdtOp::Apply`) and per-collection snapshot
/// imports (`CrdtOp::ImportSnapshot`) route to a single collection's LoroDoc.
/// `None` only appears in pre-per-collection records from an earlier dev binary
/// and is skipped on replay (no released data to preserve).
#[derive(
    serde::Serialize, serde::Deserialize, zerompk::ToMessagePack, zerompk::FromMessagePack,
)]
pub(crate) struct CrdtDeltaWalPayload {
    pub bytes: Vec<u8>,
    pub collection: Option<String>,
    pub provenance: Option<nodedb_types::sync::wire::SyncProvenance>,
}