Package io.aeron.cluster
Class ClusterBackup.Context
java.lang.Object
io.aeron.cluster.ClusterBackup.Context
- All Implemented Interfaces:
Cloneable
- Enclosing class:
- ClusterBackup
Context for overriding default configuration for
ClusterBackup.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaeron()Aeronclient for communicating with the local Media Driver.Aeronclient for communicating with the local Media Driver.Get the top level Aeron directory used for communication between the Aeron client and Media Driver.aeronDirectoryName(String aeronDirectoryName) Set the top level Aeron directory used for communication between the Aeron client and Media Driver.Get theAeronArchive.Contextused for communicating with the local Archive.archiveContext(AeronArchive.Context archiveContext) Set theAeronArchive.Contextused for communicating with the local Archive.Get the catchup channel template to use for log and snapshot retrieval.catchupChannel(String catchupChannel) Set the catchup channel template to use for log and snapshot retrieval.Get the catchup endpoint to use for log retrieval.catchupEndpoint(String catchupEndpoint) Set the endpoint that will be subscribed to in order to receive logs and snapshots.clone()Perform a shallow copy of the object.voidclose()Close the context and free applicable resources.Get theAeronArchive.Contextused for communicating with the remote Archive in the cluster being backed up.clusterArchiveContext(AeronArchive.Context archiveContext) Set theAeronArchive.Contextused for communicating with the remote Archive in the cluster being backed up.longInterval at which the cluster backup is re-initialised after an exception has been thrown.clusterBackupCoolDownIntervalNs(long clusterBackupCoolDownIntervalNs) Interval at which the cluster backup is re-initialised after an exception has been thrown.longInterval at which a cluster backup will send backup queries.clusterBackupIntervalNs(long clusterBackupIntervalNs) Interval at which a cluster backup will send backup queries.longTimeout within which a cluster backup will expect progress.clusterBackupProgressTimeoutNs(long clusterBackupProgressTimeoutNs) Timeout within which a cluster backup will expect progress.longTimeout within which a cluster backup will expect a response from a backup query.clusterBackupResponseTimeoutNs(long clusterBackupResponseTimeoutNs) Timeout within which a cluster backup will expect a response from a backup query.The endpoints representing cluster members of the cluster to attempt to a backup from.clusterConsensusEndpoints(String endpoints) String representing the cluster members consensus endpoints.The directory used for the cluster directory.clusterDir(File clusterDir) Set the directory to use for the cluster directory.The directory name to use for the cluster directory.clusterDirectoryName(String clusterDirectoryName) Set the directory name to use for the cluster directory.intGet the id for this cluster instance.clusterId(int clusterId) Set the id for this cluster instance.TheClusterMarkFilein use.clusterMarkFile(ClusterMarkFile markFile) Set theClusterMarkFilein use.voidconclude()Conclude configuration by setting up defaults when specifics are not provided.Get the channel parameter for the consensus communication channel.consensusChannel(String channel) Set the channel parameter for the consensus communication channel.intGet the stream id for the consensus module snapshot replay channel.consensusModuleSnapshotStreamId(int streamId) Set the stream id for the consensus module snapshot replay.intGet the stream id for the consensus channel.consensusStreamId(int streamId) Set the stream id for the consensus channel.TheerrorHandler()that will incrementerrorCounter()by default.countedErrorHandler(CountedErrorHandler countedErrorHandler) Non-default for context.Get theCredentialsSupplierto be used for authentication with the cluster.credentialsSupplier(CredentialsSupplier credentialsSupplier) Set theCredentialsSupplierto be used for authentication with the cluster.voidDelete the cluster directory.booleanWill the consensus module attempt to immediately deleteclusterDir()on startup.deleteDirOnStart(boolean deleteDirOnStart) Should the consensus module attempt to immediately deleteclusterDir()on startup.Get theEpochClockto used for tracking wall clock time.epochClock(EpochClock clock) Set theEpochClockto be used for tracking wall clock time.intThe error buffer length in bytes.errorBufferLength(int errorBufferLength) Set the error buffer length in bytes to use.Get the error counter that will record the number of errors observed.errorCounter(AtomicCounter errorCounter) Set the error counter that will record the number of errors observed.Get theErrorHandlerto be used by the Consensus Module.errorHandler(ErrorHandler errorHandler) Set theErrorHandlerto be used by the Cluster Backup.errorLog()TheDistinctErrorLogin use.errorLog(DistinctErrorLog errorLog) Set theDistinctErrorLogin use.Get theClusterBackupEventsListenerin use for the backup agent.eventsListener(ClusterBackupEventsListener eventsListener) Set theClusterBackupEventsListenerto use for the backup agent.Get a newIdleStrategybased on configured supplier.idleStrategySupplier(Supplier<IdleStrategy> idleStrategySupplier) Provides anIdleStrategysupplier for the idle strategy for the agent duty cycle.Get the place for the cluster replay to start from when no local copy of the log exists.Where to start the replay from the cluster used for the backup.booleanHas the context had theconclude()method called.Get the counter for the current position of the live log.liveLogPositionCounter(Counter liveLogPositionCounter) Set the counter for the current position of the live log.intGet the stream id for the cluster log channel.logStreamId(int streamId) Set the stream id for the cluster log channel.Get the directory in which the ClusterBackup will store mark file (i.e.markFileDir(File markFileDir) Set the directory in which the ClusterBackup will store mark file (i.e.Get the counter for the next query deadline ms.nextQueryDeadlineMsCounter(Counter nextQueryDeadlineMsCounter) Set the counter for the next query deadline ms.booleanDoes this context own theaeron()client and this takes responsibility for closing it?ownsAeronClient(boolean ownsAeronClient) Does this context own theaeron()client and this takes responsibility for closing it?longInterval between checks for replication progress.replicationProgressIntervalNs(long intervalNs) Interval between checks for replication progress.longTimeout when no progress it detected when performing an archive replication (typically for snapshots).replicationProgressTimeoutNs(long timeoutNs) Timeout when no progress it detected when performing an archive replication (typically for snapshots).intGet the stream id for the clustered service snapshot replay channel.serviceSnapshotStreamId(int streamId) Set the stream id for the clustered service snapshot replay.Get the counter for the number of snapshots retrieved by the backup from the cluster.snapshotRetrieveCounter(Counter snapshotRetrieveCounter) Set the counter for the number of snapshots retrieved by the backup from the cluster.Get the currently configured source type.sourceType(ClusterBackup.SourceType sourceType) Set theClusterBackup.SourceTypeto be used for this backup instance.Get the counter for the current state of the cluster backup.stateCounter(Counter stateCounter) Set the counter for the current state of the cluster backup.Get theRunnablethat is called when theClusterBackupprocesses a termination action.terminationHook(Runnable terminationHook) Set theRunnablethat is called when theClusterBackupprocesses a termination action.Get the thread factory used for creating threads.threadFactory(ThreadFactory threadFactory) Set the thread factory used for creating threads.toString()booleanShould anAgentInvokerbe used for running theClusterBackuprather than run it on a thread with aAgentRunner.useAgentInvoker(boolean useAgentInvoker) Should anAgentInvokerbe used for running theClusterBackuprather than run it on a thread with aAgentRunner.
-
Constructor Details
-
Context
public Context()
-
-
Method Details
-
clone
Perform a shallow copy of the object. -
conclude
public void conclude()Conclude configuration by setting up defaults when specifics are not provided. -
isConcluded
public boolean isConcluded()Has the context had theconclude()method called.- Returns:
- true of the
conclude()method has been called.
-
aeron
Aeronclient for communicating with the local Media Driver.This client will be closed when the
ClusterBackup.close()orclose()methods are called ifownsAeronClient()is true.- Parameters:
aeron- client for communicating with the local Media Driver.- Returns:
- this for a fluent API.
- See Also:
-
aeron
Aeronclient for communicating with the local Media Driver.If not provided then a default will be established during
conclude()by callingAeron.connect().- Returns:
- client for communicating with the local Media Driver.
-
aeronDirectoryName
Set the top level Aeron directory used for communication between the Aeron client and Media Driver.- Parameters:
aeronDirectoryName- the top level Aeron directory.- Returns:
- this for a fluent API.
-
aeronDirectoryName
Get the top level Aeron directory used for communication between the Aeron client and Media Driver.- Returns:
- The top level Aeron directory.
-
ownsAeronClient
Does this context own theaeron()client and this takes responsibility for closing it?- Parameters:
ownsAeronClient- does this context own theaeron()client.- Returns:
- this for a fluent API.
-
ownsAeronClient
public boolean ownsAeronClient()Does this context own theaeron()client and this takes responsibility for closing it?- Returns:
- does this context own the
aeron()client and this takes responsibility for closing it?
-
deleteDirOnStart
Should the consensus module attempt to immediately deleteclusterDir()on startup.- Parameters:
deleteDirOnStart- Attempt deletion.- Returns:
- this for a fluent API.
-
deleteDirOnStart
public boolean deleteDirOnStart()Will the consensus module attempt to immediately deleteclusterDir()on startup.- Returns:
- true when directory will be deleted, otherwise false.
-
clusterId
Set the id for this cluster instance.- Parameters:
clusterId- for this clustered instance.- Returns:
- this for a fluent API
- See Also:
-
clusterId
public int clusterId()Get the id for this cluster instance.- Returns:
- the id for this cluster instance.
- See Also:
-
clusterDirectoryName
Set the directory name to use for the cluster directory.- Parameters:
clusterDirectoryName- to use.- Returns:
- this for a fluent API.
- See Also:
-
clusterDirectoryName
The directory name to use for the cluster directory.- Returns:
- directory name for the cluster directory.
- See Also:
-
clusterDir
Set the directory to use for the cluster directory.- Parameters:
clusterDir- to use.- Returns:
- this for a fluent API.
- See Also:
-
clusterDir
The directory used for the cluster directory.- Returns:
- directory for the cluster directory.
- See Also:
-
markFileDir
Get the directory in which the ClusterBackup will store mark file (i.e.cluster-mark.dat). It defaults toclusterDir()if it is not set explicitly via theClusteredServiceContainer.Configuration.MARK_FILE_DIR_PROP_NAME.- Returns:
- the directory in which the ClusterBackup will store mark file (i.e.
cluster-mark.dat). - See Also:
-
markFileDir
Set the directory in which the ClusterBackup will store mark file (i.e.cluster-mark.dat).- Parameters:
markFileDir- the directory in which the ClusterBackup will store mark file (i.e.cluster-mark.dat).- Returns:
- this for a fluent API.
-
archiveContext
Set theAeronArchive.Contextused for communicating with the local Archive.- Parameters:
archiveContext- used for communicating with the local Archive.- Returns:
- this for a fluent API.
-
archiveContext
Get theAeronArchive.Contextused for communicating with the local Archive.- Returns:
- the
AeronArchive.Contextused for communicating with the local Archive.
-
clusterArchiveContext
Set theAeronArchive.Contextused for communicating with the remote Archive in the cluster being backed up.- Parameters:
archiveContext- used for communicating with the remote Archive in the cluster being backed up.- Returns:
- this for a fluent API.
-
clusterArchiveContext
Get theAeronArchive.Contextused for communicating with the remote Archive in the cluster being backed up.- Returns:
- the
AeronArchive.Contextused for communicating the remote Archive in the cluster being backed up.
-
threadFactory
Get the thread factory used for creating threads.- Returns:
- thread factory used for creating threads.
-
threadFactory
Set the thread factory used for creating threads.- Parameters:
threadFactory- used for creating threads- Returns:
- this for a fluent API.
-
idleStrategySupplier
Provides anIdleStrategysupplier for the idle strategy for the agent duty cycle.- Parameters:
idleStrategySupplier- supplier for the idle strategy for the agent duty cycle.- Returns:
- this for a fluent API.
-
idleStrategy
Get a newIdleStrategybased on configured supplier.- Returns:
- a new
IdleStrategybased on configured supplier.
-
epochClock
Set theEpochClockto be used for tracking wall clock time.- Parameters:
clock-EpochClockto be used for tracking wall clock time.- Returns:
- this for a fluent API.
-
epochClock
Get theEpochClockto used for tracking wall clock time.- Returns:
- the
EpochClockto used for tracking wall clock time.
-
errorHandler
Get theErrorHandlerto be used by the Consensus Module.- Returns:
- the
ErrorHandlerto be used by the Consensus Module.
-
errorHandler
Set theErrorHandlerto be used by the Cluster Backup.- Parameters:
errorHandler- the error handler to be used by the Cluster Backup.- Returns:
- this for a fluent API
-
errorCounter
Get the error counter that will record the number of errors observed.- Returns:
- the error counter that will record the number of errors observed.
-
errorCounter
Set the error counter that will record the number of errors observed.- Parameters:
errorCounter- the error counter that will record the number of errors observed.- Returns:
- this for a fluent API.
-
countedErrorHandler
Non-default for context.- Parameters:
countedErrorHandler- to override the default.- Returns:
- this for a fluent API.
-
countedErrorHandler
TheerrorHandler()that will incrementerrorCounter()by default.- Returns:
errorHandler()that will incrementerrorCounter()by default.
-
consensusChannel
Set the channel parameter for the consensus communication channel.- Parameters:
channel- parameter for the consensus communication channel.- Returns:
- this for a fluent API.
- See Also:
-
consensusChannel
Get the channel parameter for the consensus communication channel.- Returns:
- the channel parameter for the consensus communication channel.
- See Also:
-
consensusStreamId
Set the stream id for the consensus channel.- Parameters:
streamId- for the consensus channel.- Returns:
- this for a fluent API
- See Also:
-
consensusStreamId
public int consensusStreamId()Get the stream id for the consensus channel.- Returns:
- the stream id for the consensus channel.
- See Also:
-
consensusModuleSnapshotStreamId
Set the stream id for the consensus module snapshot replay.- Parameters:
streamId- for the consensus module snapshot replay channel.- Returns:
- this for a fluent API
- See Also:
-
consensusModuleSnapshotStreamId
public int consensusModuleSnapshotStreamId()Get the stream id for the consensus module snapshot replay channel.- Returns:
- the stream id for the consensus module snapshot replay channel.
- See Also:
-
serviceSnapshotStreamId
Set the stream id for the clustered service snapshot replay.- Parameters:
streamId- for the clustered service snapshot replay channel.- Returns:
- this for a fluent API
- See Also:
-
serviceSnapshotStreamId
public int serviceSnapshotStreamId()Get the stream id for the clustered service snapshot replay channel.- Returns:
- the stream id for the clustered service snapshot replay channel.
- See Also:
-
logStreamId
Set the stream id for the cluster log channel.- Parameters:
streamId- for the cluster log channel.- Returns:
- this for a fluent API
- See Also:
-
logStreamId
public int logStreamId()Get the stream id for the cluster log channel.- Returns:
- the stream id for the cluster log channel.
- See Also:
-
catchupEndpoint
Set the endpoint that will be subscribed to in order to receive logs and snapshots.- Parameters:
catchupEndpoint- to use for the log retrieval.- Returns:
- catchup endpoint to use for the log retrieval.
- See Also:
-
catchupEndpoint
Get the catchup endpoint to use for log retrieval.- Returns:
- catchup endpoint to use for the log retrieval.
- See Also:
-
catchupChannel
Set the catchup channel template to use for log and snapshot retrieval.- Parameters:
catchupChannel- to use for the log and snapshot retrieval.- Returns:
- catchup endpoint to use for the log and snapshot retrieval.
- See Also:
-
catchupChannel
Get the catchup channel template to use for log and snapshot retrieval.- Returns:
- catchup endpoint to use for the log and snapshot retrieval.
- See Also:
-
clusterBackupIntervalNs
Interval at which a cluster backup will send backup queries.- Parameters:
clusterBackupIntervalNs- between add cluster members and snapshot recording queries.- Returns:
- this for a fluent API.
- See Also:
-
clusterBackupIntervalNs
public long clusterBackupIntervalNs()Interval at which a cluster backup will send backup queries.- Returns:
- the interval at which a cluster backup will send backup queries.
- See Also:
-
clusterBackupResponseTimeoutNs
Timeout within which a cluster backup will expect a response from a backup query.- Parameters:
clusterBackupResponseTimeoutNs- within which a cluster backup will expect a response.- Returns:
- this for a fluent API.
- See Also:
-
clusterBackupResponseTimeoutNs
public long clusterBackupResponseTimeoutNs()Timeout within which a cluster backup will expect a response from a backup query.- Returns:
- timeout within which a cluster backup will expect a response from a backup query.
- See Also:
-
clusterBackupProgressTimeoutNs
Timeout within which a cluster backup will expect progress.- Parameters:
clusterBackupProgressTimeoutNs- within which a cluster backup will expect a response.- Returns:
- this for a fluent API.
- See Also:
-
clusterBackupProgressTimeoutNs
public long clusterBackupProgressTimeoutNs()Timeout within which a cluster backup will expect progress.- Returns:
- timeout within which a cluster backup will expect progress.
- See Also:
-
clusterBackupCoolDownIntervalNs
Interval at which the cluster backup is re-initialised after an exception has been thrown.- Parameters:
clusterBackupCoolDownIntervalNs- time before the cluster backup is re-initialised.- Returns:
- this for a fluent API.
- See Also:
-
clusterBackupCoolDownIntervalNs
public long clusterBackupCoolDownIntervalNs()Interval at which the cluster backup is re-initialised after an exception has been thrown.- Returns:
- interval at which the cluster backup is re-initialised after an exception has been thrown.
- See Also:
-
clusterConsensusEndpoints
String representing the cluster members consensus endpoints."endpoint,endpoint,endpoint"- Parameters:
endpoints- which are to be contacted for joining the cluster.- Returns:
- this for a fluent API.
-
clusterConsensusEndpoints
The endpoints representing cluster members of the cluster to attempt to a backup from.- Returns:
- members of the cluster to attempt to request a backup from.
-
terminationHook
Set theRunnablethat is called when theClusterBackupprocesses a termination action.- Parameters:
terminationHook- that can be used to terminate.- Returns:
- this for a fluent API.
-
terminationHook
Get theRunnablethat is called when theClusterBackupprocesses a termination action.- Returns:
- the
Runnablethat can be used to terminate.
-
clusterMarkFile
Set theClusterMarkFilein use.- Parameters:
markFile- to use.- Returns:
- this for a fluent API.
-
clusterMarkFile
TheClusterMarkFilein use.- Returns:
ClusterMarkFilein use.
-
errorBufferLength
Set the error buffer length in bytes to use.- Parameters:
errorBufferLength- in bytes to use.- Returns:
- this for a fluent API.
-
errorBufferLength
public int errorBufferLength()The error buffer length in bytes.- Returns:
- error buffer length in bytes.
-
errorLog
Set theDistinctErrorLogin use.- Parameters:
errorLog- to use.- Returns:
- this for a fluent API.
-
errorLog
TheDistinctErrorLogin use.- Returns:
DistinctErrorLogin use.
-
stateCounter
Get the counter for the current state of the cluster backup.- Returns:
- the counter for the current state of the cluster backup.
- See Also:
-
stateCounter
Set the counter for the current state of the cluster backup.- Parameters:
stateCounter- the counter for the current state of the cluster backup.- Returns:
- this for a fluent API.
- See Also:
-
liveLogPositionCounter
Get the counter for the current position of the live log.- Returns:
- the counter for the current position of the live log.
-
liveLogPositionCounter
Set the counter for the current position of the live log.- Parameters:
liveLogPositionCounter- the counter for the current position of the live log.- Returns:
- this for a fluent API.
-
snapshotRetrieveCounter
Set the counter for the number of snapshots retrieved by the backup from the cluster.- Parameters:
snapshotRetrieveCounter- the counter to use for snapshots retrieved.- Returns:
- this for a fluent API.
-
snapshotRetrieveCounter
Get the counter for the number of snapshots retrieved by the backup from the cluster.- Returns:
- counter for the number of snapshots retrieved by the backup from the cluster.
-
nextQueryDeadlineMsCounter
Get the counter for the next query deadline ms.- Returns:
- the counter for the next query deadline ms.
-
nextQueryDeadlineMsCounter
Set the counter for the next query deadline ms.- Parameters:
nextQueryDeadlineMsCounter- the counter for the next query deadline ms.- Returns:
- this for a fluent API.
-
eventsListener
Get theClusterBackupEventsListenerin use for the backup agent.- Returns:
ClusterBackupEventsListenerin use for the backup agent.- See Also:
-
eventsListener
Set theClusterBackupEventsListenerto use for the backup agent.- Parameters:
eventsListener- to use for the backup agent.- Returns:
- this for a fluent API.
- See Also:
-
useAgentInvoker
Should anAgentInvokerbe used for running theClusterBackuprather than run it on a thread with aAgentRunner.- Parameters:
useAgentInvoker- useAgentInvokerbe used for running theClusterBackup?- Returns:
- this for a fluent API.
-
useAgentInvoker
public boolean useAgentInvoker()Should anAgentInvokerbe used for running theClusterBackuprather than run it on a thread with aAgentRunner.- Returns:
- true if the
ClusterBackupwill be run with anAgentInvokerotherwise false.
-
credentialsSupplier
Set theCredentialsSupplierto be used for authentication with the cluster.- Parameters:
credentialsSupplier- to be used for authentication with the cluster.- Returns:
- this for fluent API.
-
credentialsSupplier
Get theCredentialsSupplierto be used for authentication with the cluster.- Returns:
- the
CredentialsSupplierto be used for authentication with the cluster.
-
sourceType
Set theClusterBackup.SourceTypeto be used for this backup instance.- Parameters:
sourceType- type of sources to receive log traffic from.- Returns:
- this for a fluent API
-
sourceType
Get the currently configured source type.- Returns:
- source type for this backup instance.
- Throws:
IllegalArgumentException- if the configured source type is not one ofClusterBackup.SourceType
-
replicationProgressTimeoutNs
Timeout when no progress it detected when performing an archive replication (typically for snapshots).- Parameters:
timeoutNs- timeout in nanoseconds- Returns:
- this for a fluent API.
- See Also:
-
replicationProgressTimeoutNs
public long replicationProgressTimeoutNs()Timeout when no progress it detected when performing an archive replication (typically for snapshots).- Returns:
- timeout in nanoseconds.
- See Also:
-
replicationProgressIntervalNs
Interval between checks for replication progress. Defaults toreplicationProgressTimeoutNs()divided by10.- Parameters:
intervalNs- timeout in nanoseconds- Returns:
- this for a fluent API.
- See Also:
-
replicationProgressIntervalNs
public long replicationProgressIntervalNs()Interval between checks for replication progress.- Returns:
- timeout in nanoseconds.
- See Also:
-
initialReplayStart
public ClusterBackup.Context initialReplayStart(ClusterBackup.Configuration.ReplayStart replayStart) Where to start the replay from the cluster used for the backup. Doesn't set a specific position, but instead it will use an enum value to derive appropriate place to start. This only applies to the first replay used for this backup.- Parameters:
replayStart- determines the position to be used to start the backup replay from.- Returns:
- this for a fluent API.
- See Also:
-
initialReplayStart
Get the place for the cluster replay to start from when no local copy of the log exists.- Returns:
- the cluster replay start.
- See Also:
-
deleteDirectory
public void deleteDirectory()Delete the cluster directory. -
close
public void close()Close the context and free applicable resources.If
ownsAeronClient()is true then theaeron()client will be closed. -
toString
-