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::Deletefor single column - Row tombstone:
CellOperation::DeleteRowfor entire row - Range tombstone:
range_tombstonesfield for clustering key ranges - Partition tombstone:
partition_tombstonefield for entire partition
Fields§
§table: TableIdTarget table
partition_key: PartitionKeyPartition 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: i64Timestamp 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
impl Mutation
Sourcepub fn new(
table: TableId,
partition_key: PartitionKey,
clustering_key: Option<ClusteringKey>,
operations: Vec<CellOperation>,
timestamp_micros: i64,
ttl_seconds: Option<u32>,
) -> Self
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
Sourcepub fn decorated_key(&self, schema: &TableSchema) -> Result<DecoratedKey>
pub fn decorated_key(&self, schema: &TableSchema) -> Result<DecoratedKey>
Get the decorated key for this mutation (token + raw bytes)