public static interface Row.Builder
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) and addRowDeletion(org.apache.cassandra.db.DeletionTime), if called, are called before
any addCell(org.apache.cassandra.db.rows.Cell)/addComplexDeletion(org.apache.cassandra.config.ColumnDefinition, 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 to addCell(org.apache.cassandra.db.rows.Cell)/addComplexDeletion(org.apache.cassandra.config.ColumnDefinition, org.apache.cassandra.db.DeletionTime) are done in strictly increasing column order.
In other words, all calls to these methods for a give column c are done after any call for
any column before c and before any call for any column after c.
5) Calls to addCell(org.apache.cassandra.db.rows.Cell) are further done in strictly increasing cell order (the one defined by
Cell.comparator. That is, for a give column, cells are passed in CellPath order.
An unsorted builder will not expect those last rules however: addCell(org.apache.cassandra.db.rows.Cell) and addComplexDeletion(org.apache.cassandra.config.ColumnDefinition, 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 with
Cells.reconcile(org.apache.cassandra.db.Clustering, org.apache.cassandra.db.rows.Cell, org.apache.cassandra.db.rows.Cell, org.apache.cassandra.db.DeletionTime, org.apache.cassandra.db.rows.Row.Builder, int, org.apache.cassandra.db.index.SecondaryIndexManager.Updater) and the "biggest" of multiple complex deletion for the same column wins).
| Modifier and Type | Method and Description |
|---|---|
void |
addCell(Cell cell)
Adds a cell to this builder.
|
void |
addComplexDeletion(ColumnDefinition column,
DeletionTime complexDeletion)
Adds a complex deletion.
|
void |
addPrimaryKeyLivenessInfo(LivenessInfo info)
Adds the liveness information for the partition key columns of this row.
|
void |
addRowDeletion(DeletionTime deletion)
Adds the deletion information for this row.
|
Row |
build()
Builds and return built row.
|
Clustering |
clustering()
The clustering for the row that is currently being built.
|
boolean |
isSorted()
Whether the builder is a sorted one or not.
|
void |
newRow(Clustering clustering)
Prepares the builder to build a new row of clustering
clustering. |
boolean isSorted()
void newRow(Clustering clustering)
clustering.
This should always be the first call for a given row.
clustering - the clustering for the new row.Clustering clustering()
null if newRow(org.apache.cassandra.db.Clustering) hasn't
yet been called.void addPrimaryKeyLivenessInfo(LivenessInfo info)
addPartitionKeyLivenessInfo(LivenessInfo.NONE)).info - the liveness information for the partition key columns of the built row.void addRowDeletion(DeletionTime deletion)
deletion - the row deletion time, or DeletionTime.LIVE if the row isn't deleted.void addCell(Cell cell)
cell - the cell to add.void addComplexDeletion(ColumnDefinition column, DeletionTime complexDeletion)
column - the column for which to add the complexDeletion.complexDeletion - the complex deletion time to add.Row build()
Copyright © 2015 The Apache Software Foundation