Package org.apache.cassandra.db.view
Class ViewUpdateGenerator
java.lang.Object
org.apache.cassandra.db.view.ViewUpdateGenerator
Creates the updates to apply to a view given the existing rows in the base
table and the updates that we're applying to them (this handles updates
on a single partition only).
This class is used by passing the updates made to the base table to
addBaseTableUpdate(org.apache.cassandra.db.rows.Row, org.apache.cassandra.db.rows.Row) and calling generateViewUpdates() once all updates have
been handled to get the resulting view mutations.-
Constructor Summary
ConstructorsConstructorDescriptionViewUpdateGenerator(View view, DecoratedKey basePartitionKey, long nowInSec) Creates a newViewUpdateBuilder. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBaseTableUpdate(Row existingBaseRow, Row mergedBaseRow) Adds to this generator the updates to be made to the view given a base table row before and after an update.voidclear()Clears the current state so that the generator may be reused.Returns the updates that needs to be done to the view given the base table updates passed toaddBaseTableUpdate(org.apache.cassandra.db.rows.Row, org.apache.cassandra.db.rows.Row).
-
Constructor Details
-
ViewUpdateGenerator
Creates a newViewUpdateBuilder.- Parameters:
view- the view for which this will be building updates for.basePartitionKey- the partition key for the base table partition for which we'll handle updates for.nowInSec- the current time in seconds. Used to decide if data are live or not and as base reference for new deletions.
-
-
Method Details
-
addBaseTableUpdate
Adds to this generator the updates to be made to the view given a base table row before and after an update.- Parameters:
existingBaseRow- the base table row as it is before an update.mergedBaseRow- the base table row after the update is applied (note that this is not just the new update, but rather the resulting row).
-
generateViewUpdates
Returns the updates that needs to be done to the view given the base table updates passed toaddBaseTableUpdate(org.apache.cassandra.db.rows.Row, org.apache.cassandra.db.rows.Row).- Returns:
- the updates to do to the view.
-
clear
public void clear()Clears the current state so that the generator may be reused.
-