Package org.apache.cassandra.db.view
Class ViewUpdateGenerator
- java.lang.Object
-
- org.apache.cassandra.db.view.ViewUpdateGenerator
-
public class ViewUpdateGenerator extends java.lang.ObjectCreates 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 toaddBaseTableUpdate(org.apache.cassandra.db.rows.Row, org.apache.cassandra.db.rows.Row)and callinggenerateViewUpdates()once all updates have been handled to get the resulting view mutations.
-
-
Constructor Summary
Constructors Constructor Description ViewUpdateGenerator(View view, DecoratedKey basePartitionKey, int nowInSec)Creates a newViewUpdateBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBaseTableUpdate(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.java.util.Collection<PartitionUpdate>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).
-
-
-
Constructor Detail
-
ViewUpdateGenerator
public ViewUpdateGenerator(View view, DecoratedKey basePartitionKey, int nowInSec)
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 Detail
-
addBaseTableUpdate
public void addBaseTableUpdate(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.- 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
public java.util.Collection<PartitionUpdate> 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.
-
-