public static class HollowProducer.Incremental
extends java.lang.Object
A HollowProducer
populates with all the given data after which changes are determined. Generally in
other respects HollowProducer
and HollowProducer.Incremental
have the same behaviour when
publishing and announcing data states.
Modifier and Type | Class and Description |
---|---|
static interface |
HollowProducer.Incremental.IncrementalPopulator
Represents a task that incrementally populates a new data state within a
HollowProducer cycle (
more specifically within the population stage) |
static interface |
HollowProducer.Incremental.IncrementalWriteState
Representation of write state that can be incrementally changed.
|
Modifier | Constructor and Description |
---|---|
protected |
Incremental(HollowProducer.Builder<?> b) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(HollowProducerEventListener listener)
Adds a listener to this producer.
|
void |
addListener(HollowProducerListener listener)
Adds a listener to this producer.
|
boolean |
enablePrimaryProducer(boolean doEnable)
Invoke this method to alter runCycle behavior.
|
HollowProducerMetrics |
getMetrics() |
HollowObjectMapper |
getObjectMapper() |
HollowWriteStateEngine |
getWriteEngine() |
void |
initializeDataModel(java.lang.Class<?>... classes)
Initializes the data model for the given classes.
|
void |
initializeDataModel(HollowSchema... schemas)
Initializes the producer data model for the given schemas.
|
void |
removeListener(HollowProducerEventListener listener)
Removes a listener to this producer.
|
void |
removeListener(HollowProducerListener listener)
Removes a listener to this producer.
|
HollowProducer.ReadState |
restore(long versionDesired,
HollowConsumer.BlobRetriever blobRetriever)
Restores the data state to a desired version.
|
long |
runIncrementalCycle(HollowProducer.Incremental.IncrementalPopulator task)
Runs a cycle to incrementally populate, publish, and announce a new single data state.
|
protected Incremental(HollowProducer.Builder<?> b)
public HollowProducer.ReadState restore(long versionDesired, HollowConsumer.BlobRetriever blobRetriever)
Data model initialization
is required prior to
restoring the producer. This ensures that restoration can correctly compare the producer's
current data model with the data model of the restored data state and manage any differences
in those models (such as not restoring state for any types in the restoring data model not
present in the producer's current data model)
versionDesired
- the desired versionblobRetriever
- the blob retrieverjava.lang.IllegalStateException
- if the producer's data model has not been initializedinitializeDataModel(Class[])
public long runIncrementalCycle(HollowProducer.Incremental.IncrementalPopulator task)
task
- the incremental populating task to add changes (additions, modifications, or deletions)java.lang.RuntimeException
- if the cycle failedpublic HollowProducerMetrics getMetrics()
public void initializeDataModel(java.lang.Class<?>... classes)
Data model initialization is required prior to restoring
the producer.
This ensures that restoration can correctly compare the producer's current data model
with the data model of the restored data state and manage any differences in those models
(such as not restoring state for any types in the restoring data model not present in the
producer's current data model).
After initialization a data model initialization event will be emitted
to all registered data model initialization listeners
listeners
.
classes
- the data model classesjava.lang.IllegalArgumentException
- if classes
is emptyrestore(long, HollowConsumer.BlobRetriever)
public void initializeDataModel(HollowSchema... schemas)
Data model initialization is required prior to restoring
the producer.
This ensures that restoration can correctly compare the producer's current data model
with the data model of the restored data state and manage any differences in those models
(such as not restoring state for any types in the restoring data model not present in the
producer's current data model).
After initialization a data model initialization event will be emitted
to all registered data model initialization listeners
listeners
.
schemas
- the data model classesjava.lang.IllegalArgumentException
- if schemas
is emptyrestore(long, HollowConsumer.BlobRetriever)
public HollowWriteStateEngine getWriteEngine()
public HollowObjectMapper getObjectMapper()
public boolean enablePrimaryProducer(boolean doEnable)
doEnable
- true if enable primary producer, if falsepublic void addListener(HollowProducerListener listener)
If the listener was previously added to this consumer, as determined by reference equality or Object
equality, then this method does nothing.
If a listener is added, concurrently, during the occurrence of a cycle or restore then the listener will not receive events until the next cycle or restore. The listener may also be removed concurrently.
listener
- the listener to addpublic void addListener(HollowProducerEventListener listener)
If the listener was previously added to this consumer, as determined by reference equality or Object
equality, then this method does nothing.
If a listener is added, concurrently, during the occurrence of a cycle or restore then the listener will not receive events until the next cycle or restore. The listener may also be removed concurrently.
listener
- the listener to addpublic void removeListener(HollowProducerListener listener)
If the listener was not previously added to this producer, as determined by reference equality or Object
equality, then this method does nothing.
If a listener is removed, concurrently, during the occurrence of a cycle or restore then the listener will receive all events for that cycle or restore but not receive events for a subsequent cycle or restore.
listener
- the listener to removepublic void removeListener(HollowProducerEventListener listener)
If the listener was not previously added to this producer, as determined by reference equality or Object
equality, then this method does nothing.
If a listener is removed, concurrently, during the occurrence of a cycle or restore then the listener will receive all events for that cycle or restore but not receive events for a subsequent cycle or restore.
listener
- the listener to remove