Skip to main content

encode_v8

Function encode_v8 

Source
pub fn encode_v8<W: Write>(
    base_topo: Option<&ArchivedCsr>,
    base_cols: Option<&ArchivedColumns>,
    base_strings: Option<&ArchivedStringTable>,
    base_edge_props: Option<(&ArchivedEdgeProps, &[u8])>,
    base_provenance_raw: Option<&[u8]>,
    topo: &Topology,
    cols: &ColumnStore,
    ids: &IdMap,
    syms: &Interner,
    meta: &V8Meta,
    out: &mut W,
) -> Result<()>
Expand description

Encode an in-memory graph state as a V8 snapshot, writing to out.

base_topo is the archived CSR from an existing mmap’d V8 snapshot. When Some, the encoded topology section is the sorted-unique merge of the base CSR and the overlay topology (with tombstone subtraction applied). When None, the overlay topology is encoded standalone (initial snapshot, no prior base).

base_cols is the archived columns section from the same mmap’d V8 snapshot. When Some, the encoded columns section is the merge of the base columns (minus prop tombstones recorded in cols.prop_tombstones) with the overlay cols. When None, cols is encoded directly (initial snapshot or V5–V7 legacy path).

base_strings is the shared string table (section 12) of that same snapshot, or None when the base predates it (V8 and earlier) and every base string column therefore carries its own copy. It is only read when base_cols is Some; passing a table from a different snapshot would resolve the base’s string ids against the wrong vocabulary.

base_edge_props controls section 5 (EDGE_PROPS):

  • None: encode from meta.edge_props overlay alone (initial snapshot or V5-V7 path).
  • Some((archived, raw)) with meta.edge_props.is_clean(): passthrough raw bytes byte-identical (no decode + re-encode of the 500 MiB section).
  • Some((archived, _)) with dirty overlay: merge archived base + overlay.

base_provenance_raw controls section 7 (PROVENANCE):

  • Some(raw) and provenance unchanged: passthrough raw bytes.
  • Otherwise: encode from meta.provenance.