ViewUpdateGenerator (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.db.view

## Class ViewUpdateGenerator

- java.lang.Object
- - org.apache.cassandra.db.view.ViewUpdateGenerator

-     public class ViewUpdateGenerator
      extends java.lang.Object

  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

    Constructors
    Constructor and Description
    `ViewUpdateGenerator(View view, DecoratedKey basePartitionKey, int nowInSec)` Creates a new `ViewUpdateBuilder`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `void` | `clear()` 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 to `addBaseTableUpdate(org.apache.cassandra.db.rows.Row, org.apache.cassandra.db.rows.Row)`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ViewUpdateGenerator

          public ViewUpdateGenerator(View view,
                                     DecoratedKey basePartitionKey,
                                     int nowInSec)

      Creates a new `ViewUpdateBuilder`.
      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 to `addBaseTableUpdate(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.

Copyright © 2018 The Apache Software Foundation