Class ReplicatedDomain
The replicated domain is identified by its base DN. It maintains a data state that provides details about the current state of the data in this domain, and also a status that indicates its capacity to reach consistency with the topology.
The status is computed based on whether the local changelog or the topology combined changelog, as known by the
consistent core, contain the changes required to cover the data state. If they do not, the status is set to
Topology.RegisteredStatus.TOO_OLD
.
When start()
is called, it starts periodically registering to the consistent core to update this domain
status, and so that the consistent core can compute the SCP and PP by taking into account the state of this domain.
It also starts fetching and applying changes for this domain from the changelog based on the data state, specifically
all changes that are newer than the current state.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Dn
The domain base DN.protected ReplicaState
The domain data state.protected final Domain
The domain.protected ExecutorService
The executor service used to fetch changes from the changelog.protected Topology.Location
The location of the replica, used for registration to the consistent core.protected final ReplicaId
The replica ID.protected final ServerContext
The server context.protected Topology.RegisteredStatus
The status of the domain, indicating its capacity to reach consistency with the topology. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ReplicatedDomain
(Dn baseDn, ServerContext serverContext) Creates a new replicated domain. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Fetches and applies changes for this domain from the changelog based on the data state, specifically all changes that are newer than the current state.Returns the domain.Returns the data state of this replica for this domain.Returns the status of this domain.Returns the CSN generator of this domain.protected abstract boolean
Returns true if the local changelog does not contain the changes required to cover the data state.protected void
Persist the data state.protected void
purgeDataState
(CSN purgeCsn) Purge the data state by deleting streams (excepting the newest for each replica) which have an older CSN than the provided CSN.abstract void
Registers to the consistent core to update this domain status, and so that the consistent core can advance the SCP and PP by taking into account the state of this replica.void
shutdown()
Shutdown the replicated domain.void
start()
Start the replicated domain.void
stop()
Stop the replicated domain.void
updateReplicaState
(CSN csn) Update the data state with the given CSN.
-
Field Details
-
baseDn
The domain base DN. -
domain
The domain. -
dataState
The domain data state. -
replicaId
The replica ID. -
location
The location of the replica, used for registration to the consistent core. -
status
The status of the domain, indicating its capacity to reach consistency with the topology. -
serverContext
The server context. -
executor
The executor service used to fetch changes from the changelog.
-
-
Constructor Details
-
ReplicatedDomain
Creates a new replicated domain.- Parameters:
baseDn
- the base DN of the domainserverContext
- the server context
-
-
Method Details
-
getDomain
Returns the domain.- Returns:
- the domain
-
getStatus
Returns the status of this domain.- Returns:
- the status of this domain
-
getStreamSeqNumGen
Returns the CSN generator of this domain.- Returns:
- the CSN generator of this domain
-
getReplicaState
Returns the data state of this replica for this domain.- Returns:
- the data state of this replica for this domain
-
updateReplicaState
Update the data state with the given CSN.- Parameters:
csn
- the update CSN
-
purgeDataState
Purge the data state by deleting streams (excepting the newest for each replica) which have an older CSN than the provided CSN.- Parameters:
purgeCsn
- the CSN to purge from
-
fetchChangelogAndReplayChanges
public abstract void fetchChangelogAndReplayChanges()Fetches and applies changes for this domain from the changelog based on the data state, specifically all changes that are newer than the current state. -
registerToConsistentCore
public abstract void registerToConsistentCore()Registers to the consistent core to update this domain status, and so that the consistent core can advance the SCP and PP by taking into account the state of this replica. -
isTooOldForLocalChangelog
protected abstract boolean isTooOldForLocalChangelog()Returns true if the local changelog does not contain the changes required to cover the data state.- Returns:
- true if the local changelog does not contain the changes required to cover the data state
-
start
public void start()Start the replicated domain.This method starts registering to the consistent core, and fetching and applying this domain changes from the changelog based on the data state, specifically the changes that are newer than the current state.
-
stop
public void stop()Stop the replicated domain. This method stops fetching changes from the changelog. -
shutdown
public void shutdown()Shutdown the replicated domain. -
persistDataState
protected void persistDataState()Persist the data state.
-