Interface Row.Builder
-
- All Known Implementing Classes:
BTreeRow.Builder
- Enclosing interface:
- Row
public static interface Row.BuilderInterface for building rows.The builder of a row should always abid to the following rules: 1)
newRow(org.apache.cassandra.db.Clustering<?>)is always called as the first thing for the row. 2)addPrimaryKeyLivenessInfo(org.apache.cassandra.db.LivenessInfo)andaddRowDeletion(org.apache.cassandra.db.rows.Row.Deletion), if called, are called before anyaddCell(org.apache.cassandra.db.rows.Cell<?>)/addComplexDeletion(org.apache.cassandra.schema.ColumnMetadata, org.apache.cassandra.db.DeletionTime)call. 3)build()is called to construct the new row. The builder can then be reused. There is 2 variants of a builder: sorted and unsorted ones. A sorted builder expects user to abid to the following additional rules: 4) Calls toaddCell(org.apache.cassandra.db.rows.Cell<?>)/addComplexDeletion(org.apache.cassandra.schema.ColumnMetadata, org.apache.cassandra.db.DeletionTime)are done in strictly increasing column order. In other words, all calls to these methods for a give columncare done after any call for any column beforecand before any call for any column afterc. 5) Calls toaddCell(org.apache.cassandra.db.rows.Cell<?>)are further done in strictly increasing cell order (the one defined byCell.comparator. That is, for a give column, cells are passed inCellPathorder. 6) No shadowed data should be added. Concretely, this means that if a a row deletion is added, it doesn't deletes the row timestamp or any cell added later, and similarly no cell added is deleted by the complex deletion of the column this is a cell of. An unsorted builder will not expect those last rules however:addCell(org.apache.cassandra.db.rows.Cell<?>)andaddComplexDeletion(org.apache.cassandra.schema.ColumnMetadata, org.apache.cassandra.db.DeletionTime)can be done in any order. And in particular unsorted builder allows multiple calls for the same column/cell. In that latter case, the result will follow the usual reconciliation rules (so equal cells are reconciled withCells.reconcile(org.apache.cassandra.db.rows.Cell<?>, org.apache.cassandra.db.rows.Cell<?>)and the "biggest" of multiple complex deletion for the same column wins).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddCell(Cell<?> cell)Adds a cell to this builder.voidaddComplexDeletion(ColumnMetadata column, DeletionTime complexDeletion)Adds a complex deletion.voidaddPrimaryKeyLivenessInfo(LivenessInfo info)Adds the liveness information for the partition key columns of this row.voidaddRowDeletion(Row.Deletion deletion)Adds the deletion information for this row.Rowbuild()Builds and return built row.Clustering<?>clustering()The clustering for the row that is currently being built.Row.Buildercopy()Creates a copy of thisBuilder.booleanisSorted()Whether the builder is a sorted one or not.voidnewRow(Clustering<?> clustering)Prepares the builder to build a new row of clusteringclustering.
-
-
-
Method Detail
-
copy
Row.Builder copy()
Creates a copy of thisBuilder.- Returns:
- a copy of this
Builder
-
isSorted
boolean isSorted()
Whether the builder is a sorted one or not.- Returns:
- if the builder requires calls to be done in sorted order or not (see above).
-
newRow
void newRow(Clustering<?> clustering)
Prepares the builder to build a new row of clusteringclustering.This should always be the first call for a given row.
- Parameters:
clustering- the clustering for the new row.
-
clustering
Clustering<?> clustering()
The clustering for the row that is currently being built.- Returns:
- the clustering for the row that is currently being built, or
nullifnewRow(org.apache.cassandra.db.Clustering<?>)hasn't yet been called.
-
addPrimaryKeyLivenessInfo
void addPrimaryKeyLivenessInfo(LivenessInfo info)
Adds the liveness information for the partition key columns of this row. This call is optional (skipping it is equivalent to callingaddPartitionKeyLivenessInfo(LivenessInfo.NONE)).- Parameters:
info- the liveness information for the partition key columns of the built row.
-
addRowDeletion
void addRowDeletion(Row.Deletion deletion)
Adds the deletion information for this row. This call is optional and can be skipped if the row is not deleted.- Parameters:
deletion- the row deletion time, orDeletion.LIVEif the row isn't deleted.
-
addCell
void addCell(Cell<?> cell)
Adds a cell to this builder.- Parameters:
cell- the cell to add.
-
addComplexDeletion
void addComplexDeletion(ColumnMetadata column, DeletionTime complexDeletion)
Adds a complex deletion.- Parameters:
column- the column for which to add thecomplexDeletion.complexDeletion- the complex deletion time to add.
-
build
Row build()
Builds and return built row.- Returns:
- the last row built by this builder.
-
-