Skip to main content

Mutation

Struct Mutation 

Source
pub struct Mutation {
    pub table: TableId,
    pub partition_key: PartitionKey,
    pub clustering_key: Option<ClusteringKey>,
    pub operations: Vec<CellOperation>,
    pub timestamp_micros: i64,
    pub ttl_seconds: Option<u32>,
    pub partition_tombstone: Option<PartitionTombstone>,
    pub range_tombstones: Vec<RangeTombstone>,
}
Expand description

A mutation represents a write operation (INSERT, UPDATE, DELETE)

This is the fundamental unit of write operations in CQLite, corresponding to a single CQL INSERT/UPDATE/DELETE statement. Each mutation targets a specific row (identified by partition key + optional clustering key) and contains one or more cell operations.

§Tombstone Support (M5.2)

Mutations can represent various deletion types:

  • Cell tombstone: CellOperation::Delete for single column
  • Row tombstone: CellOperation::DeleteRow for entire row
  • Range tombstone: range_tombstones field for clustering key ranges
  • Partition tombstone: partition_tombstone field for entire partition

Fields§

§table: TableId

Target table

§partition_key: PartitionKey

Partition key values

§clustering_key: Option<ClusteringKey>

Clustering key values (None for tables without clustering keys)

§operations: Vec<CellOperation>

Cell-level operations (writes or deletes)

§timestamp_micros: i64

Timestamp in microseconds since Unix epoch

§ttl_seconds: Option<u32>

Time-to-live in seconds applied to all cells in this mutation (None = no expiration).

This is set by USING TTL in CQL statements and applies uniformly to all Write operations. For per-column TTL, use CellOperation::WriteWithTtl in the operations list instead.

§partition_tombstone: Option<PartitionTombstone>

Partition tombstone (deletes entire partition)

§range_tombstones: Vec<RangeTombstone>

Range tombstones (delete clustering key ranges within partition)

Implementations§

Source§

impl Mutation

Source

pub fn new( table: TableId, partition_key: PartitionKey, clustering_key: Option<ClusteringKey>, operations: Vec<CellOperation>, timestamp_micros: i64, ttl_seconds: Option<u32>, ) -> Self

Create a new mutation

Source

pub fn decorated_key(&self, schema: &TableSchema) -> Result<DecoratedKey>

Get the decorated key for this mutation (token + raw bytes)

Trait Implementations§

Source§

impl Clone for Mutation

Source§

fn clone(&self) -> Mutation

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 Mutation

Source§

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

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

impl<'de> Deserialize<'de> for Mutation

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 Mutation

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, 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.