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
core registry, contain the changes required to cover the data state. If they do not, the status is set to
ReplicatedDomain.DomainStatus.TOO_OLD.
When start() is called, it starts periodically registering to the core registry so that this latter
can keep track of which servers are replicating a given domain, and their states for that domain for monitoring
purposes.
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DnThe domain base DN.protected ReplicaStateThe domain data state.protected final DomainThe domain.protected ExecutorThe executor service used to fetch changes from the changelog.protected Topology.LocationThe location of the replica, used for registration to the core registry.protected final ReplicaIdThe replica ID.protected final ServerContextThe server context.protected ReplicatedDomain.DomainStatusThe status of the domain, indicating its capacity to reach consistency with the topology. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedReplicatedDomain(Dn baseDn, ServerContext serverContext) Creates a new replicated domain. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidFetches 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 final booleanReturns true if this replicated domain is stopped..protected abstract booleanReturns true if the local changelog does not contain the changes required to cover the data state.protected voidPersist the data state.protected voidPurge the data state by deleting streams (excepting the newest for each replica) which have an older CSN than the provided CSN.abstract voidRegisters to the core registry to update this domain status.voidshutdown()Shutdown the replicated domain.voidstart()Start the replicated domain.voidstop()Stop the replicated domain.voidupdateReplicaState(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 core registry. -
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
-
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
-
purgeUpTo
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. -
registerToCoreRegistry
public abstract void registerToCoreRegistry()Registers to the core registry to update this domain status. -
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 core registry, 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. -
isStopped
protected final boolean isStopped()Returns true if this replicated domain is stopped..- Returns:
- true if this replicated domain is stopped.
-
shutdown
public void shutdown()Shutdown the replicated domain. -
persistDataState
protected void persistDataState()Persist the data state.
-