Class PartitionUpdate.Builder
- java.lang.Object
-
- org.apache.cassandra.db.partitions.PartitionUpdate.Builder
-
- Enclosing class:
- PartitionUpdate
public static class PartitionUpdate.Builder extends java.lang.Object
Builder for PartitionUpdates This class is not thread safe, but the PartitionUpdate it produces is (since it is immutable).
-
-
Constructor Summary
Constructors Constructor Description Builder(PartitionUpdate base, int initialRowCapacity)
Builder(TableMetadata metadata, java.nio.ByteBuffer key, RegularAndStaticColumns columns, int initialRowCapacity)
Builder(TableMetadata metadata, DecoratedKey key, RegularAndStaticColumns columnDefinitions, int size)
Builder(TableMetadata metadata, DecoratedKey key, RegularAndStaticColumns columns, int initialRowCapacity, boolean canHaveShadowedData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(RangeTombstone range)
void
add(Row row)
Adds a row to this update.void
addPartitionDeletion(DeletionTime deletionTime)
PartitionUpdate
build()
RegularAndStaticColumns
columns()
TableMetadata
metadata()
DecoratedKey
partitionKey()
DeletionTime
partitionLevelDeletion()
java.lang.String
toString()
PartitionUpdate.Builder
updateAllTimestamp(long newTimestamp)
Modify this update to set every timestamp for live data tonewTimestamp
and every deletion timestamp tonewTimestamp - 1
.
-
-
-
Constructor Detail
-
Builder
public Builder(TableMetadata metadata, DecoratedKey key, RegularAndStaticColumns columns, int initialRowCapacity, boolean canHaveShadowedData)
-
Builder
public Builder(TableMetadata metadata, DecoratedKey key, RegularAndStaticColumns columnDefinitions, int size)
-
Builder
public Builder(PartitionUpdate base, int initialRowCapacity)
-
Builder
public Builder(TableMetadata metadata, java.nio.ByteBuffer key, RegularAndStaticColumns columns, int initialRowCapacity)
-
-
Method Detail
-
add
public void add(Row row)
Adds a row to this update. There is no particular assumption made on the order of row added to a partition update. It is further allowed to add the same row (more precisely, multiple row objects for the same clustering). Note however that the columns contained in the added row must be a subset of the columns used when creating this update.- Parameters:
row
- the row to add.
-
addPartitionDeletion
public void addPartitionDeletion(DeletionTime deletionTime)
-
add
public void add(RangeTombstone range)
-
partitionKey
public DecoratedKey partitionKey()
-
metadata
public TableMetadata metadata()
-
build
public PartitionUpdate build()
-
columns
public RegularAndStaticColumns columns()
-
partitionLevelDeletion
public DeletionTime partitionLevelDeletion()
-
updateAllTimestamp
public PartitionUpdate.Builder updateAllTimestamp(long newTimestamp)
Modify this update to set every timestamp for live data tonewTimestamp
and every deletion timestamp tonewTimestamp - 1
. There is no reason to use that expect on the Paxos code path, where we need ensure that anything inserted use the ballot timestamp (to respect the order of update decided by the Paxos algorithm). We usenewTimestamp - 1
for deletions because tombstones always win on timestamp equality and we don't want to delete our own insertions (typically, when we overwrite a collection, we first set a complex deletion to delete the previous collection before adding new elements. If we were to set that complex deletion to the same timestamp that the new elements, it would delete those elements). And since tombstones always wins on timestamp equality, using -1 guarantees our deletion will still delete anything from a previous update.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-