Interface ChangeStreamRecordAdapter.ChangeStreamRecordBuilder<ChangeStreamRecordT>
- Enclosing interface:
- ChangeStreamRecordAdapter<ChangeStreamRecordT>
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
- Exactly 1
onHeartbeat
.
-
Case 2: CloseStream
- 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:
- DeleteFamily -> Exactly 1
deleteFamily
- DeleteCell -> Exactly 1
deleteCell
- SetCell -> Exactly 1
startCell
, At least 1CellValue
, Exactly 1finishCell
.
The whole flow of constructing a ChangeStreamMutation is:
- Exactly 1
startUserMutation
orstartGcMutation
. - At least 1 DeleteFamily/DeleteCell/SetCell mods.
- Exactly 1
finishChangeStreamMutation
.
Note: For a non-chunked SetCell, only 1 CellValue
will be called. For a chunked
SetCell, more than 1 CellValue
s will be called.
Note: DeleteRow's won't appear in data changes since they'll be converted to multiple DeleteFamily's.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cellValue
(com.google.protobuf.ByteString value) Called once per non-chunked cell, or at least twice per chunked cell to concatenate the cell value.void
deleteCells
(String familyName, com.google.protobuf.ByteString qualifier, Range.TimestampRange timestampRange) Called to add a DeleteCell mod.void
deleteFamily
(String familyName) Called to add a DeleteFamily mod.void
Called once per cell to signal the end of the value (unless reset).finishChangeStreamMutation
(String token, org.threeten.bp.Instant estimatedLowWatermark) Called once per stream record to signal that all mods have been processed (unless reset).onCloseStream
(ReadChangeStreamResponse.CloseStream closeStream) Called to create a close stream message.onHeartbeat
(ReadChangeStreamResponse.Heartbeat heartbeat) Called to create a heartbeat.void
reset()
Called when the current in progress change stream record should be droppedvoid
Called to start a SetCell.void
startGcMutation
(com.google.protobuf.ByteString rowKey, org.threeten.bp.Instant commitTimestamp, int tieBreaker) Called to start a new Garbage Collection ChangeStreamMutation.void
startUserMutation
(com.google.protobuf.ByteString rowKey, String sourceClusterId, org.threeten.bp.Instant commitTimestamp, int tieBreaker) Called to start a new user initiated ChangeStreamMutation.
-
Method Details
-
onHeartbeat
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. -
onCloseStream
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. -
startUserMutation
void startUserMutation(@Nonnull com.google.protobuf.ByteString rowKey, @Nonnull String sourceClusterId, org.threeten.bp.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. -
startGcMutation
void startGcMutation(@Nonnull com.google.protobuf.ByteString rowKey, org.threeten.bp.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. -
deleteFamily
Called to add a DeleteFamily mod. -
deleteCells
void deleteCells(@Nonnull String familyName, @Nonnull com.google.protobuf.ByteString qualifier, @Nonnull Range.TimestampRange timestampRange) Called to add a DeleteCell mod. -
startCell
Called to start a SetCell.-
In case of a non-chunked cell, the following order is guaranteed:
- Exactly 1
startCell
. - Exactly 1
cellValue
. - Exactly 1
finishCell
.
-
In case of a chunked cell, the following order is guaranteed:
- Exactly 1
startCell
. - At least 2
cellValue
. - Exactly 1
finishCell
.
- Exactly 1
-
cellValue
void cellValue(com.google.protobuf.ByteString value) Called once per non-chunked cell, or at least twice per chunked cell to concatenate the cell value. -
finishCell
void finishCell()Called once per cell to signal the end of the value (unless reset). -
finishChangeStreamMutation
ChangeStreamRecordT finishChangeStreamMutation(@Nonnull String token, org.threeten.bp.Instant estimatedLowWatermark) Called once per stream record to signal that all mods have been processed (unless reset). -
reset
void reset()Called when the current in progress change stream record should be dropped
-