public interface EngineReplication extends Replication
| Modifier and Type | Interface and Description |
|---|---|
static interface |
EngineReplication.EntryCallback
Implemented typically by a replicator, This interface provides the event, which will get
called whenever a put() or remove() has occurred to the map
|
static interface |
EngineReplication.ModificationIterator
Holds a record of which entries have modification.
|
static interface |
EngineReplication.ModificationNotifier
notifies when there is a changed to the modification iterator
|
static interface |
EngineReplication.ReplicationEntry |
| Modifier and Type | Method and Description |
|---|---|
EngineReplication.ModificationIterator |
acquireModificationIterator(byte remoteIdentifier)
Gets (if it does not exist, creates) an instance of ModificationIterator associated with a
remote node, this weak associated is bound using the
identifier. |
default void |
forEach(byte remoteIdentifier,
java.util.function.Consumer<EngineReplication.ReplicationEntry> consumer) |
byte |
identifier()
Provides the unique Identifier associated with this instance.
|
long |
lastModificationTime(byte remoteIdentifier)
Returns the timestamp of the last change from the specified remote node, already replicated
to this host.
|
void |
setLastModificationTime(byte identifier,
long timestamp) |
applyReplicationbyte identifier()
An identifier is used to determine which replicating node made the change.
If two nodes update their map at the same time with different values, we have to deterministically resolve which update wins, because of eventual consistency both nodes should end up locally holding the same data. Although it is rare two remote nodes could receive an update to their maps at exactly the same time for the same key, we have to handle this edge case, its therefore important not to rely on timestamps alone to reconcile the updates. Typically the update with the newest timestamp should win, but in this example both timestamps are the same, and the decision made to one node should be identical to the decision made to the other. We resolve this simple dilemma by using a node identifier, each node will have a unique identifier, the update from the node with the smallest identifier wins.
default void forEach(byte remoteIdentifier,
@NotNull
java.util.function.Consumer<EngineReplication.ReplicationEntry> consumer)
throws InterruptedException
InterruptedExceptionEngineReplication.ModificationIterator acquireModificationIterator(byte remoteIdentifier)
identifier.acquireModificationIterator in interface ReplicationremoteIdentifier - the identifier of the remote nodeidentifier()long lastModificationTime(byte remoteIdentifier)
Used in conjunction with replication, to back fill data from a remote node. This node may have missed updates while it was not been running or connected via TCP.
lastModificationTime in interface ReplicationremoteIdentifier - the identifier of the remote node to check last replicated update
time fromidentifier()void setLastModificationTime(byte identifier,
long timestamp)
Copyright © 2015. All rights reserved.