public abstract class RaftAtomicValueService<T,V extends RaftAtomicValue<T>,S extends RaftAtomicValueSnapshot<T>> extends AbstractCPMigrationAwareService implements RaftManagedService, RaftRemoteService, RaftNodeLifecycleAwareService, SnapshotAwareService<S>
nodeEngine| Constructor and Description |
|---|
RaftAtomicValueService(NodeEngine nodeEngine) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clearPartitionReplica(int partitionId) |
DistributedObject |
createProxy(String proxyName)
Creates a proxy for a CP data structure.
|
boolean |
destroyRaftObject(CPGroupId groupId,
String name)
Destroys the given CP data structure on the CP group.
|
V |
getAtomicValue(CPGroupId groupId,
String name) |
protected int |
getBackupCount() |
protected Map<CPGroupId,Object> |
getSnapshotMap(int partitionId) |
void |
init(NodeEngine nodeEngine,
Properties properties)
Initializes this service.
|
protected abstract V |
newAtomicValue(CPGroupId groupId,
String name,
T val) |
protected abstract DistributedObject |
newRaftAtomicProxy(NodeEngineImpl nodeEngine,
RaftGroupId groupId,
String proxyName,
String objectNameForProxy) |
protected abstract S |
newSnapshot(Map<String,T> values,
Set<String> destroyed) |
void |
onCPSubsystemRestart()
Called when CP Subsystem is restarted.
|
void |
onRaftGroupDestroyed(CPGroupId groupId)
Called on the thread of the Raft group when the given Raft node is
destroyed, either gracefully or forcefully.
|
void |
onRaftNodeSteppedDown(CPGroupId groupId)
Called on the thread of the Raft group when the given Raft node is
stepped down, either because it is shutting down, or it could not be
added to the Raft group
|
void |
reset()
Resets this service back to its initial state.
|
void |
restoreSnapshot(CPGroupId groupId,
long commitIndex,
S snapshot)
Restores the snapshot for specified
CPGroupId. |
void |
shutdown(boolean terminate)
Shuts down this service.
|
S |
takeSnapshot(CPGroupId groupId,
long commitIndex)
Creates a snapshot for specified
CPGroupId. |
beforeMigration, commitMigration, prepareReplicationOperation, rollbackMigrationpublic RaftAtomicValueService(NodeEngine nodeEngine)
public void init(NodeEngine nodeEngine, Properties properties)
ManagedServiceinit in interface ManagedServicenodeEngine - the NodeEngine that this service belongs toproperties - the Properties (can be used to pass settings to the service)public void reset()
ManagedServiceTODO: what is the purpose of reset
reset in interface ManagedServicepublic void shutdown(boolean terminate)
ManagedServiceTODO: what is the purpose of the terminate variable
shutdown in interface ManagedServiceterminate - true to shut down this servicepublic void onCPSubsystemRestart()
RaftManagedServiceonCPSubsystemRestart in interface RaftManagedServicepublic final S takeSnapshot(CPGroupId groupId, long commitIndex)
SnapshotAwareServiceCPGroupId.
The snapshot object returned from this method will be stored among
the Raft log and it can be sent to other Raft nodes anytime. Therefore,
this method must not return a snapshot object that can mutate after
the takeSnapshot() call.takeSnapshot in interface SnapshotAwareService<S extends RaftAtomicValueSnapshot<T>>groupId - CPGroupId which is snapshot requested forcommitIndex - commitIndex of the taken snapshotCPGroupId.public final void restoreSnapshot(CPGroupId groupId, long commitIndex, S snapshot)
SnapshotAwareServiceCPGroupId.restoreSnapshot in interface SnapshotAwareService<S extends RaftAtomicValueSnapshot<T>>groupId - CPGroupId of the snapshot to be restoredcommitIndex - commitIndex of the restored snapshotsnapshot - snapshot for specified CPGroupIdpublic final void onRaftGroupDestroyed(CPGroupId groupId)
RaftNodeLifecycleAwareServiceonRaftGroupDestroyed in interface RaftNodeLifecycleAwareServicepublic void onRaftNodeSteppedDown(CPGroupId groupId)
RaftNodeLifecycleAwareServiceonRaftNodeSteppedDown in interface RaftNodeLifecycleAwareServicepublic final boolean destroyRaftObject(CPGroupId groupId, String name)
RaftRemoteServicedestroyRaftObject in interface RaftRemoteServicepublic final DistributedObject createProxy(String proxyName)
RaftRemoteServicecreateProxy in interface RaftRemoteServiceproxyName - the name of the CP data structureprotected abstract DistributedObject newRaftAtomicProxy(NodeEngineImpl nodeEngine, RaftGroupId groupId, String proxyName, String objectNameForProxy)
protected int getBackupCount()
getBackupCount in class AbstractCPMigrationAwareServiceprotected final Map<CPGroupId,Object> getSnapshotMap(int partitionId)
getSnapshotMap in class AbstractCPMigrationAwareServiceprotected final void clearPartitionReplica(int partitionId)
clearPartitionReplica in class AbstractCPMigrationAwareServiceCopyright © 2019 Hazelcast, Inc.. All rights reserved.