Interface ChangeStreamRecordAdapter.ChangeStreamRecordBuilder<ChangeStreamRecordT> (2.40.0)

public static interface ChangeStreamRecordAdapter.ChangeStreamRecordBuilder<ChangeStreamRecordT>

A SAX style change stream record factory. It is responsible for creating one of the three types of change stream record: heartbeat, close stream, and a change stream mutation.

State management is handled external to the implementation of this class:

    Case 1: Heartbeat
  1. Exactly 1 onHeartbeat.
    Case 2: CloseStream
  1. Exactly 1 onCloseStream.
    Case 3: ChangeStreamMutation. A change stream mutation consists of one or more mods, where the SetCells might be chunked. There are 3 different types of mods that a ReadChangeStream response can have:
  1. DeleteFamily -> Exactly 1 deleteFamily
  2. DeleteCell -> Exactly 1 deleteCell
  3. SetCell -> Exactly 1 startCell, At least 1 CellValue, Exactly 1 finishCell.

The whole flow of constructing a ChangeStreamMutation is:

  1. Exactly 1 startUserMutation or startGcMutation.
  2. At least 1 DeleteFamily/DeleteCell/SetCell mods.
  3. Exactly 1 finishChangeStreamMutation.

Note: For a non-chunked SetCell, only 1 CellValue will be called. For a chunked SetCell, more than 1 CellValues will be called.

Note: DeleteRow's won't appear in data changes since they'll be converted to multiple DeleteFamily's.

Type Parameter

Name Description
ChangeStreamRecordT

Methods

addToCell(String familyName, Value qualifier, Value timestamp, Value value)

public abstract void addToCell(String familyName, Value qualifier, Value timestamp, Value value)
Parameters
Name Description
familyName String
qualifier Value
timestamp Value
value Value

cellValue(ByteString value)

public abstract void cellValue(ByteString value)

Called once per non-chunked cell, or at least twice per chunked cell to concatenate the cell value.

Parameter
Name Description
value ByteString

deleteCells(String familyName, ByteString qualifier, Range.TimestampRange timestampRange)

public abstract void deleteCells(String familyName, ByteString qualifier, Range.TimestampRange timestampRange)

Called to add a DeleteCell mod.

Parameters
Name Description
familyName String
qualifier ByteString
timestampRange Range.TimestampRange

deleteFamily(String familyName)

public abstract void deleteFamily(String familyName)

Called to add a DeleteFamily mod.

Parameter
Name Description
familyName String

finishCell()

public abstract void finishCell()

Called once per cell to signal the end of the value (unless reset).

finishChangeStreamMutation(String token, Instant estimatedLowWatermark)

public abstract ChangeStreamRecordT finishChangeStreamMutation(String token, Instant estimatedLowWatermark)

Called once per stream record to signal that all mods have been processed (unless reset).

Parameters
Name Description
token String
estimatedLowWatermark org.threeten.bp.Instant
Returns
Type Description
ChangeStreamRecordT

onCloseStream(ReadChangeStreamResponse.CloseStream closeStream)

public abstract ChangeStreamRecordT onCloseStream(ReadChangeStreamResponse.CloseStream closeStream)

Called to create a close stream message. This will be called at most once. If called, the current change stream record must not include any data changes or heartbeats.

Parameter
Name Description
closeStream com.google.bigtable.v2.ReadChangeStreamResponse.CloseStream
Returns
Type Description
ChangeStreamRecordT

onHeartbeat(ReadChangeStreamResponse.Heartbeat heartbeat)

public abstract ChangeStreamRecordT onHeartbeat(ReadChangeStreamResponse.Heartbeat heartbeat)

Called to create a heartbeat. This will be called at most once. If called, the current change stream record must not include any data changes or close stream messages.

Parameter
Name Description
heartbeat com.google.bigtable.v2.ReadChangeStreamResponse.Heartbeat
Returns
Type Description
ChangeStreamRecordT

reset()

public abstract void reset()

Called when the current in progress change stream record should be dropped

startCell(String family, ByteString qualifier, long timestampMicros)

public abstract void startCell(String family, ByteString qualifier, long timestampMicros)

Called to start a SetCell.

    In case of a non-chunked cell, the following order is guaranteed:
  1. Exactly 1 startCell.
  2. Exactly 1 cellValue.
  3. Exactly 1 finishCell.
    In case of a chunked cell, the following order is guaranteed:
  1. Exactly 1 startCell.
  2. At least 2 cellValue.
  3. Exactly 1 finishCell.
Parameters
Name Description
family String
qualifier ByteString
timestampMicros long

startGcMutation(ByteString rowKey, Instant commitTimestamp, int tieBreaker)

public abstract void startGcMutation(ByteString rowKey, Instant commitTimestamp, int tieBreaker)

Called to start a new Garbage Collection ChangeStreamMutation. This will be called at most once. If called, the current change stream record must not include any close stream message or heartbeat.

Parameters
Name Description
rowKey ByteString
commitTimestamp org.threeten.bp.Instant
tieBreaker int

startUserMutation(ByteString rowKey, String sourceClusterId, Instant commitTimestamp, int tieBreaker)

public abstract void startUserMutation(ByteString rowKey, String sourceClusterId, Instant commitTimestamp, int tieBreaker)

Called to start a new user initiated ChangeStreamMutation. This will be called at most once. If called, the current change stream record must not include any close stream message or heartbeat.

Parameters
Name Description
rowKey ByteString
sourceClusterId String
commitTimestamp org.threeten.bp.Instant
tieBreaker int