public abstract class AbstractReplicator extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AbstractReplicator.ActivityLevel
Activity level of a replicator.
|
static class |
AbstractReplicator.Progress
Progress of a replicator.
|
static class |
AbstractReplicator.Status
Combined activity level and progress of a replicator.
|
Constructor and Description |
---|
AbstractReplicator(ReplicatorConfiguration config)
Initializes a replicator with the given configuration.
|
Modifier and Type | Method and Description |
---|---|
ListenerToken |
addChangeListener(Executor executor,
ReplicatorChangeListener listener)
Adds a change listener for the changes in the replication status and progress with an executor on which
the changes will be posted to the listener.
|
ListenerToken |
addChangeListener(ReplicatorChangeListener listener)
Adds a change listener for the changes in the replication status and progress.
|
ListenerToken |
addDocumentReplicationListener(DocumentReplicationListener listener)
Adds a listener for receiving the replication status of the specified document.
|
ListenerToken |
addDocumentReplicationListener(Executor executor,
DocumentReplicationListener listener)
Adds a listener for receiving the replication status of the specified document with an executor on which
the status will be posted to the listener.
|
ReplicatorConfiguration |
getConfig()
The replicator's configuration.
|
AbstractReplicator.Status |
getStatus()
The replicator's current status: its activity level and progress.
|
void |
removeChangeListener(ListenerToken token)
Remove the given ReplicatorChangeListener or DocumentReplicationListener from the this replicator.
|
void |
resetCheckpoint()
Reset the replicator's local checkpoint: read all changes since the beginning of time
from the remote database.
|
void |
start()
Starts the replicator.
|
void |
stop()
Stops a running replicator.
|
String |
toString() |
public AbstractReplicator(@NonNull ReplicatorConfiguration config)
config
- replicator configurationpublic void start()
public void stop()
@NonNull public ReplicatorConfiguration getConfig()
@NonNull public AbstractReplicator.Status getStatus()
@NonNull public ListenerToken addChangeListener(@NonNull ReplicatorChangeListener listener)
listener
- callback@NonNull public ListenerToken addChangeListener(Executor executor, @NonNull ReplicatorChangeListener listener)
executor
- executor on which events will be deliveredlistener
- callbackpublic void removeChangeListener(@NonNull ListenerToken token)
token
- returned by a previous call to addChangeListener or addDocumentListener.@NonNull public ListenerToken addDocumentReplicationListener(@NonNull DocumentReplicationListener listener)
listener
- callback@NonNull public ListenerToken addDocumentReplicationListener(@Nullable Executor executor, @NonNull DocumentReplicationListener listener)
executor
- executor on which events will be deliveredlistener
- callbackpublic void resetCheckpoint()