public class RaftAtomicRefService extends Object implements RaftManagedService, RaftRemoteService, RaftNodeLifecycleAwareService, SnapshotAwareService<RaftAtomicRefSnapshot>
Modifier and Type | Field and Description |
---|---|
static String |
SERVICE_NAME
Name of the service
|
Constructor and Description |
---|
RaftAtomicRefService(NodeEngine nodeEngine) |
Modifier and Type | Method and Description |
---|---|
IAtomicReference |
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.
|
RaftAtomicRef |
getAtomicRef(CPGroupId groupId,
String name) |
void |
init(NodeEngine nodeEngine,
Properties properties)
Initializes this service.
|
void |
onCPSubsystemRestart()
Called when the 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,
RaftAtomicRefSnapshot snapshot)
Restores the snapshot for specified
CPGroupId . |
void |
shutdown(boolean terminate)
Shuts down this service.
|
RaftAtomicRefSnapshot |
takeSnapshot(CPGroupId groupId,
long commitIndex)
Creates a snapshot for specified
CPGroupId . |
public static final String SERVICE_NAME
public RaftAtomicRefService(NodeEngine nodeEngine)
public void init(NodeEngine nodeEngine, Properties properties)
ManagedService
init
in interface ManagedService
nodeEngine
- the NodeEngine that this service belongs toproperties
- the Properties (can be used to pass settings to the service)public void reset()
ManagedService
TODO: what is the purpose of reset
reset
in interface ManagedService
public void shutdown(boolean terminate)
ManagedService
TODO: what is the purpose of the terminate variable
shutdown
in interface ManagedService
terminate
- true
to shut down this servicepublic void onCPSubsystemRestart()
RaftManagedService
onCPSubsystemRestart
in interface RaftManagedService
public RaftAtomicRefSnapshot takeSnapshot(CPGroupId groupId, long commitIndex)
SnapshotAwareService
CPGroupId
.
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<RaftAtomicRefSnapshot>
groupId
- CPGroupId
which is snapshot requested forcommitIndex
- commitIndex of the taken snapshotCPGroupId
.public void restoreSnapshot(CPGroupId groupId, long commitIndex, RaftAtomicRefSnapshot snapshot)
SnapshotAwareService
CPGroupId
.restoreSnapshot
in interface SnapshotAwareService<RaftAtomicRefSnapshot>
groupId
- CPGroupId
of the snapshot to be restoredcommitIndex
- commitIndex of the restored snapshotsnapshot
- snapshot for specified CPGroupId
public void onRaftGroupDestroyed(CPGroupId groupId)
RaftNodeLifecycleAwareService
onRaftGroupDestroyed
in interface RaftNodeLifecycleAwareService
public void onRaftNodeSteppedDown(CPGroupId groupId)
RaftNodeLifecycleAwareService
onRaftNodeSteppedDown
in interface RaftNodeLifecycleAwareService
public boolean destroyRaftObject(CPGroupId groupId, String name)
RaftRemoteService
destroyRaftObject
in interface RaftRemoteService
public RaftAtomicRef getAtomicRef(CPGroupId groupId, String name)
public IAtomicReference createProxy(String proxyName)
RaftRemoteService
createProxy
in interface RaftRemoteService
proxyName
- the name of the CP data structureCopyright © 2021 Hazelcast, Inc.. All Rights Reserved.