public class RaftActorContextImpl extends Object implements RaftActorContext
| Constructor and Description |
|---|
RaftActorContextImpl(akka.actor.ActorRef actor,
akka.actor.ActorContext context,
String id,
@NonNull ElectionTerm termInformation,
long commitIndex,
long lastApplied,
@NonNull Map<String,String> peerAddresses,
@NonNull ConfigParams configParams,
@NonNull DataPersistenceProvider persistenceProvider,
@NonNull Consumer<ApplyState> applyStateConsumer,
@NonNull org.slf4j.Logger logger,
@NonNull Executor executor) |
| 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 peerId,
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.
|
Executor |
getExecutor()
Return an Executor which is guaranteed to run tasks in the context of
RaftActorContext.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 name)
Removes a peer.
|
void |
setCommitIndex(long commitIndex)
Sets the index of highest log entry known to be committed.
|
void |
setConfigParams(ConfigParams configParams) |
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 |
setPayloadVersion(short payloadVersion) |
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 serverConfig)
Updates the peers and information to match the given ServerConfigurationPayload.
|
public RaftActorContextImpl(akka.actor.ActorRef actor,
akka.actor.ActorContext context,
String id,
@NonNull ElectionTerm termInformation,
long commitIndex,
long lastApplied,
@NonNull Map<String,String> peerAddresses,
@NonNull ConfigParams configParams,
@NonNull DataPersistenceProvider persistenceProvider,
@NonNull Consumer<ApplyState> applyStateConsumer,
@NonNull org.slf4j.Logger logger,
@NonNull Executor executor)
public void setPayloadVersion(short payloadVersion)
public short getPayloadVersion()
RaftActorContextgetPayloadVersion in interface RaftActorContextpublic void setConfigParams(ConfigParams configParams)
public akka.actor.ActorRef actorOf(akka.actor.Props props)
RaftActorContextactorOf in interface RaftActorContextprops - the Props used to create the actor.public akka.actor.ActorSelection actorSelection(String path)
RaftActorContextactorSelection in interface RaftActorContextpath - the path.public String getId()
RaftActorContextgetId in interface RaftActorContextpublic akka.actor.ActorRef getActor()
RaftActorContextgetActor in interface RaftActorContextpublic final Executor getExecutor()
RaftActorContextRaftActorContext.getActor().getExecutor in interface RaftActorContextpublic Optional<akka.cluster.Cluster> getCluster()
RaftActorContextgetCluster in interface RaftActorContextpublic ElectionTerm getTermInformation()
RaftActorContextgetTermInformation in interface RaftActorContextpublic long getCommitIndex()
RaftActorContextgetCommitIndex in interface RaftActorContextpublic void setCommitIndex(long commitIndex)
RaftActorContextsetCommitIndex in interface RaftActorContextcommitIndex - new commit indexpublic long getLastApplied()
RaftActorContextgetLastApplied in interface RaftActorContextpublic void setLastApplied(long lastApplied)
RaftActorContextsetLastApplied in interface RaftActorContextlastApplied - the new applied index.public void setReplicatedLog(ReplicatedLog replicatedLog)
RaftActorContextsetReplicatedLog in interface RaftActorContextreplicatedLog - the ReplicatedLog instance.public ReplicatedLog getReplicatedLog()
RaftActorContextgetReplicatedLog in interface RaftActorContextpublic akka.actor.ActorSystem getActorSystem()
RaftActorContextgetActorSystem in interface RaftActorContextpublic org.slf4j.Logger getLogger()
RaftActorContextgetLogger in interface RaftActorContextpublic Collection<String> getPeerIds()
RaftActorContextgetPeerIds in interface RaftActorContextpublic Collection<PeerInfo> getPeers()
RaftActorContextgetPeers in interface RaftActorContextpublic PeerInfo getPeerInfo(String peerId)
RaftActorContextgetPeerInfo in interface RaftActorContextpeerId - the id of the peerpublic String getPeerAddress(String peerId)
RaftActorContextgetPeerAddress in interface RaftActorContextpeerId - the id of the peer.public void updatePeerIds(ServerConfigurationPayload serverConfig)
RaftActorContextupdatePeerIds in interface RaftActorContextserverConfig - the ServerConfigurationPayload.public ConfigParams getConfigParams()
RaftActorContextgetConfigParams in interface RaftActorContextpublic void addToPeers(String peerId, String address, VotingState votingState)
RaftActorContextaddToPeers in interface RaftActorContextpeerId - the id of the new peer.address - the address of the new peer.votingState - the VotingState of the new peer.public void removePeer(String name)
RaftActorContextremovePeer in interface RaftActorContextname - the id of the peer to remove.public akka.actor.ActorSelection getPeerActorSelection(String peerId)
RaftActorContextgetPeerActorSelection in interface RaftActorContextpeerId - the id of the peer.public void setPeerAddress(String peerId, String peerAddress)
RaftActorContextsetPeerAddress in interface RaftActorContextpeerId - the id of the peer.peerAddress - the address of the peer.public SnapshotManager getSnapshotManager()
RaftActorContextgetSnapshotManager in interface RaftActorContextpublic long getTotalMemory()
RaftActorContextgetTotalMemory in interface RaftActorContextpublic void setTotalMemoryRetriever(LongSupplier retriever)
RaftActorContextsetTotalMemoryRetriever in interface RaftActorContextretriever - a supplier of the total memory metric.public boolean hasFollowers()
RaftActorContexthasFollowers in interface RaftActorContextpublic DataPersistenceProvider getPersistenceProvider()
RaftActorContextgetPersistenceProvider in interface RaftActorContextpublic RaftPolicy getRaftPolicy()
RaftActorContextgetRaftPolicy in interface RaftActorContextpublic boolean isDynamicServerConfigurationInUse()
RaftActorContextisDynamicServerConfigurationInUse in interface RaftActorContextpublic void setDynamicServerConfigurationInUse()
RaftActorContextsetDynamicServerConfigurationInUse in interface RaftActorContextpublic ServerConfigurationPayload getPeerServerInfo(boolean includeSelf)
RaftActorContextgetPeerServerInfo in interface RaftActorContextincludeSelf - include this peer's info.public boolean isVotingMember()
RaftActorContextisVotingMember in interface RaftActorContextpublic boolean anyVotingPeers()
RaftActorContextanyVotingPeers in interface RaftActorContextpublic RaftActorBehavior getCurrentBehavior()
RaftActorContextgetCurrentBehavior in interface RaftActorContextpublic Consumer<ApplyState> getApplyStateConsumer()
RaftActorContextgetApplyStateConsumer in interface RaftActorContextpublic FileBackedOutputStreamFactory getFileBackedOutputStreamFactory()
RaftActorContextFileBackedOutputStreamFactory instance with a common configuration.getFileBackedOutputStreamFactory in interface RaftActorContextFileBackedOutputStreamFactory;public RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort()
RaftActorContextgetRaftActorLeadershipTransferCohort in interface RaftActorContextpublic void setRaftActorLeadershipTransferCohort(RaftActorLeadershipTransferCohort leadershipTransferCohort)
RaftActorContextsetRaftActorLeadershipTransferCohort in interface RaftActorContextleadershipTransferCohort - the RaftActorLeadershipTransferCohort or null to clear the existing oneCopyright © 2019 OpenDaylight. All rights reserved.