public interface RaftActorContext
Modifier and Type | Method and Description |
---|---|
akka.actor.ActorRef |
actorOf(akka.actor.Props props)
Creates a new local actor.
|
akka.actor.ActorSelection |
actorSelection(String path)
Creates an actor selection.
|
void |
addToPeers(String id,
String address,
VotingState votingState)
Adds a new peer.
|
boolean |
anyVotingPeers()
Determines if there are any voting peers.
|
akka.actor.ActorRef |
getActor()
Returns the reference to the RaftActor.
|
akka.actor.ActorSystem |
getActorSystem()
Returns the The ActorSystem associated with this context.
|
Consumer<ApplyState> |
getApplyStateConsumer()
Returns the consumer of ApplyState operations.
|
Optional<akka.cluster.Cluster> |
getCluster()
The akka Cluster singleton for the actor system if one is configured.
|
long |
getCommitIndex()
Returns the index of highest log entry known to be committed.
|
ConfigParams |
getConfigParams()
Returns the ConfigParams instance.
|
RaftActorBehavior |
getCurrentBehavior()
Returns the current behavior attached to the RaftActor.
|
@NonNull Executor |
getExecutor()
Return an Executor which is guaranteed to run tasks in the context of
getActor() . |
FileBackedOutputStreamFactory |
getFileBackedOutputStreamFactory()
Returns the
FileBackedOutputStreamFactory instance with a common configuration. |
String |
getId()
Returns the identifier for the RaftActor.
|
long |
getLastApplied()
Returns index of highest log entry applied to state machine.
|
org.slf4j.Logger |
getLogger()
Returns the logger to be used for logging messages.
|
short |
getPayloadVersion()
Returns the payload version to be used when replicating data.
|
akka.actor.ActorSelection |
getPeerActorSelection(String peerId)
Returns an ActorSelection for a peer.
|
String |
getPeerAddress(String peerId)
Gets the address of a peer as a String.
|
Collection<String> |
getPeerIds()
Returns the id's for each peer.
|
PeerInfo |
getPeerInfo(String peerId)
Returns the PeerInfo for the given peer.
|
Collection<PeerInfo> |
getPeers()
Returns the PeerInfo instances for each peer.
|
ServerConfigurationPayload |
getPeerServerInfo(boolean includeSelf)
Returns the peer information as a ServerConfigurationPayload if dynamic server configurations have been applied.
|
DataPersistenceProvider |
getPersistenceProvider()
Returns the DataPersistenceProvider instance.
|
RaftActorLeadershipTransferCohort |
getRaftActorLeadershipTransferCohort()
Returns the RaftActorLeadershipTransferCohort if leadership transfer is in progress.
|
RaftPolicy |
getRaftPolicy()
Returns the RaftPolicy used to determine certain Raft behaviors.
|
ReplicatedLog |
getReplicatedLog()
Returns the ReplicatedLog instance.
|
SnapshotManager |
getSnapshotManager()
Returns the SnapshotManager instance.
|
ElectionTerm |
getTermInformation()
Returns the current ElectionTerm information.
|
long |
getTotalMemory()
Returns the total available memory for use in calculations.
|
boolean |
hasFollowers()
Determines if there are any peer followers.
|
boolean |
isDynamicServerConfigurationInUse()
Determines if there have been any dynamic server configuration changes applied.
|
boolean |
isVotingMember()
Determines if this peer is a voting member of the cluster.
|
void |
removePeer(String id)
Removes a peer.
|
void |
setCommitIndex(long commitIndex)
Sets the index of highest log entry known to be committed.
|
void |
setDynamicServerConfigurationInUse()
Sets that dynamic server configuration changes have been applied.
|
void |
setLastApplied(long lastApplied)
Sets index of highest log entry applied to state machine.
|
void |
setPeerAddress(String peerId,
String peerAddress)
Sets the address of a peer.
|
void |
setRaftActorLeadershipTransferCohort(RaftActorLeadershipTransferCohort leadershipTransferCohort)
Sets the RaftActorLeadershipTransferCohort for transferring leadership.
|
void |
setReplicatedLog(ReplicatedLog replicatedLog)
Sets the ReplicatedLog instance.
|
void |
setTotalMemoryRetriever(LongSupplier retriever)
Sets the retriever of the total memory metric.
|
void |
updatePeerIds(ServerConfigurationPayload serverCfgPayload)
Updates the peers and information to match the given ServerConfigurationPayload.
|
akka.actor.ActorRef actorOf(akka.actor.Props props)
props
- the Props used to create the actor.akka.actor.ActorSelection actorSelection(String path)
path
- the path.String getId()
akka.actor.ActorRef getActor()
@NonNull Executor getExecutor()
getActor()
.Optional<akka.cluster.Cluster> getCluster()
@Nonnull ElectionTerm getTermInformation()
long getCommitIndex()
void setCommitIndex(long commitIndex)
commitIndex
- new commit indexlong getLastApplied()
void setLastApplied(long lastApplied)
lastApplied
- the new applied index.void setReplicatedLog(@Nonnull ReplicatedLog replicatedLog)
replicatedLog
- the ReplicatedLog instance.@Nonnull ReplicatedLog getReplicatedLog()
@Nonnull akka.actor.ActorSystem getActorSystem()
@Nonnull org.slf4j.Logger getLogger()
@Nullable String getPeerAddress(String peerId)
peerId
- the id of the peer.void updatePeerIds(ServerConfigurationPayload serverCfgPayload)
serverCfgPayload
- the ServerConfigurationPayload.@Nonnull Collection<PeerInfo> getPeers()
@Nonnull Collection<String> getPeerIds()
@Nullable PeerInfo getPeerInfo(String peerId)
peerId
- the id of the peervoid addToPeers(String id, String address, VotingState votingState)
id
- the id of the new peer.address
- the address of the new peer.votingState
- the VotingState of the new peer.void removePeer(String id)
id
- the id of the peer to remove.@Nullable akka.actor.ActorSelection getPeerActorSelection(String peerId)
peerId
- the id of the peer.void setPeerAddress(String peerId, String peerAddress)
peerId
- the id of the peer.peerAddress
- the address of the peer.@Nonnull ConfigParams getConfigParams()
@Nonnull SnapshotManager getSnapshotManager()
@Nonnull DataPersistenceProvider getPersistenceProvider()
boolean hasFollowers()
long getTotalMemory()
void setTotalMemoryRetriever(LongSupplier retriever)
retriever
- a supplier of the total memory metric.short getPayloadVersion()
@Nonnull RaftPolicy getRaftPolicy()
boolean isDynamicServerConfigurationInUse()
void setDynamicServerConfigurationInUse()
@Nullable ServerConfigurationPayload getPeerServerInfo(boolean includeSelf)
includeSelf
- include this peer's info.boolean isVotingMember()
boolean anyVotingPeers()
RaftActorBehavior getCurrentBehavior()
Consumer<ApplyState> getApplyStateConsumer()
@Nonnull FileBackedOutputStreamFactory getFileBackedOutputStreamFactory()
FileBackedOutputStreamFactory
instance with a common configuration.FileBackedOutputStreamFactory
;@Nullable RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort()
void setRaftActorLeadershipTransferCohort(@Nullable RaftActorLeadershipTransferCohort leadershipTransferCohort)
leadershipTransferCohort
- the RaftActorLeadershipTransferCohort or null to clear the existing oneCopyright © 2019 OpenDaylight. All rights reserved.