pub enum CellOperation {
Write {
column: String,
value: Value,
},
WriteWithTtl {
column: String,
value: Value,
ttl_seconds: u32,
local_deletion_time: Option<i32>,
},
Delete {
column: String,
local_deletion_time: Option<i32>,
},
DeleteRow,
WriteComplexElement {
column: String,
cell_path: Vec<u8>,
value: Option<Value>,
timestamp_micros: i64,
ttl_seconds: Option<u32>,
local_deletion_time: Option<i32>,
is_deleted: bool,
},
ComplexDeletion {
column: String,
marked_for_delete_at: i64,
local_deletion_time: i32,
},
}Expand description
Operations that can be applied to individual cells within a row.
§Per-Cell TTL
Per-cell TTL is supported via the WriteWithTtl variant when using
the JSON mutation format directly. CQL syntax (USING TTL) applies
TTL uniformly to all cells in a statement. To set different TTLs
per column, submit separate mutations or use JSON mutations with
WriteWithTtl:
{"WriteWithTtl": {"column": "session_token", "value": {"Text": "abc"}, "ttl_seconds": 3600}}Variants§
Write
Write a value to a column
WriteWithTtl
Write a value to a column with TTL (expiring cell).
The cell will expire after ttl_seconds seconds. This is the only
way to set per-column TTL — CQL USING TTL applies to all cells
in a statement. Use JSON mutations to set different TTLs per column.
Fields
local_deletion_time: Option<i32>Authoritative per-cell localDeletionTime (seconds since the Unix
epoch, the on-disk GC clock) for this expiring cell — Cassandra’s
localExpirationTime, equal to writetime_seconds + ttl_seconds
(issue #1538).
When Some, the writer stamps the emitting expiring cell with this
LDT VERBATIM rather than deriving one from SystemTime::now() + ttl.
The compaction merge→rewrite path
(cells_to_cell_operations) sets it from the SOURCE cell’s own
authoritative on-disk LDT (CellData::local_deletion_time) so a
live expiring cell that survives a compaction is re-emitted
byte-identically (its localDeletionTime is preserved, not
recomputed from the compaction wall clock — mirror of #921’s
Delete-path precedent).
None preserves the historical behavior (the writer derives
now + ttl), so the fresh CQL/WAL USING TTL write paths that build
a WriteWithTtl without a surfaced source LDT are unchanged.
#[serde(default)] only helps SELF-DESCRIBING formats (e.g. the JSON
--mutation CLI input), where a missing field is defaulted by name.
It does NOT provide WAL back-compat: the WAL uses bincode, a
non-self-describing positional format that IGNORES #[serde(default)],
so upgrade-replay of pre-#1538 WriteWithTtl records is handled by the
pre-#1538 mirror layouts in wal.rs (PreCellLdtWriteTtlMutation /
PreCellLdtWriteTtlCellOperation), not by this attribute. Do not delete
those mirrors on the assumption this attribute covers the WAL.
Delete
Delete a specific column
Fields
local_deletion_time: Option<i32>Optional per-cell localDeletionTime (seconds since the Unix epoch,
the on-disk GC clock) for this cell tombstone (#921 finding 2).
When Some, the writer stamps the emitted cell tombstone with this
LDT VERBATIM rather than deriving one from the enclosing mutation’s
timestamp / Mutation::local_deletion_time. The compaction
merge→rewrite path sets it from the SOURCE cell tombstone’s own LDT
(TombstoneInfo::local_deletion_time) so a within-grace cell
tombstone that survives a compaction keeps its original GC clock and
is not purged too early / kept too long in a LATER compaction.
None preserves the historical behavior (the writer derives the LDT
from the mutation), so the WAL / CQL-DELETE paths that build a
Delete without a surfaced source LDT are unchanged.
#[serde(default)] keeps backward compatibility with Delete
values serialized before this field existed (e.g. older WAL records).
DeleteRow
Delete entire row (row tombstone)
WriteComplexElement
Write (or tombstone) a single element of a non-frozen complex column (a list/set member or a map entry), carrying its OWN write metadata and its preserved source cell path (epic #899, Phase B).
Unlike Write/WriteWithTtl — which
describe a whole-column value at one row timestamp — this op preserves the
per-element granularity of Cassandra’s multi-cell on-disk layout so the
compaction writer can emit two elements of the same column at DIFFERENT
timestamps (explicit deltas, not one promoted row timestamp), round-trip a
LIST element’s 16-byte TimeUUID cell path byte-for-byte, and emit an
element-level tombstone (value == None, IS_DELETED).
PHASE B SCOPE: this variant is plumbing + writer capability only. The real
compaction pipeline (merge_entry_to_mutation) does NOT yet emit it — that
flip (and differential byte-parity verification) is Phase C. In Phase B it
is exercised by unit tests that hand-construct mutations.
Fields
cell_path: Vec<u8>Raw cell-path bytes identifying this element (the serialized element for a SET, the serialized key for a MAP, the 16-byte TimeUUID for a LIST). Preserved byte-for-byte from the source SSTable — never regenerated.
value: Option<Value>Decoded element value. None means an element-level tombstone
(IS_DELETED) or an empty-value element (e.g. SET members store the
element in the path with an empty value). Use is_deleted — NOT the
shape of this field — to distinguish the two.
timestamp_micros: i64Per-element write timestamp in microseconds. When equal to the row
liveness timestamp the writer keeps USE_ROW_TIMESTAMP (0x08);
otherwise it clears the flag and writes an explicit unsigned delta.
local_deletion_time: Option<i32>localDeletionTime in seconds for an expiring / deleted element
(None when not applicable). Far-future values in [2^31, 2^32) are
carried as the wrapping as u32 as i32 representation.
is_deleted: boolAuthoritative per-element IS_DELETED (0x01) flag, carried verbatim
from the reader’s ComplexElement::is_deleted (the source of
truth). The writer emits CELL_IS_DELETED iff this is true.
This is NOT re-derived from value/ttl_seconds/local_deletion_time
(no-heuristics mandate, CLAUDE.md): an expiring SET member legitimately
has value == None, ttl_seconds == Some, local_deletion_time == Some while is_deleted == false — re-deriving would misclassify it as
a tombstone (roborev #885, Finding 2).
ComplexDeletion
A per-column complex deletion marker (the markedForDeleteAt +
localDeletionTime tombstone Cassandra writes ahead of a multi-cell
column’s elements) covering elements written at or before
marked_for_delete_at (epic #899, Phase B).
When present for a complex column, the writer emits a REAL complex
deletion marker (replacing the hardcoded DeletionTime.LIVE sentinel)
followed by the surviving per-element cells.
PHASE B SCOPE: plumbing + writer capability only; not yet emitted by
merge_entry_to_mutation (Phase C).
Trait Implementations§
Source§impl Clone for CellOperation
impl Clone for CellOperation
Source§fn clone(&self) -> CellOperation
fn clone(&self) -> CellOperation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more