Skip to main content

CellOperation

Enum CellOperation 

Source
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

Fields

§column: String

Column name

§value: Value

Column value

§

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

§column: String

Column name

§value: Value

Column value

§ttl_seconds: u32

Time-to-live in seconds

§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

§column: String

Column name

§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

§column: String

Complex column name.

§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: i64

Per-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.

§ttl_seconds: Option<u32>

TTL in seconds when the element is expiring (None otherwise).

§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: bool

Authoritative 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).

Fields

§column: String

Complex column name.

§marked_for_delete_at: i64

markedForDeleteAt in microseconds.

§local_deletion_time: i32

localDeletionTime in seconds since the Unix epoch.

Trait Implementations§

Source§

impl Clone for CellOperation

Source§

fn clone(&self) -> CellOperation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CellOperation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CellOperation

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CellOperation

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more