public interface ReplicationDomainDB
In particular, the getCursorFom()
methods allow to obtain a cursor at any level:
MultiDomainServerState
ServerState
DBCursor.PositionStrategy
.Modifier and Type | Field and Description |
---|---|
static Option<CSN> |
DEFAULT_CSN
Option to specify the default CSN when reading changes, when there is no CSN for the start state of a replica.
|
static Option<Set<Dn>> |
EXCLUDED_BASE_DNS
Option to specify the set of base DNs to exclude when reading changes.
|
static Option<Set<DomainReplicaId>> |
EXCLUDED_REPLICAS
Option to specify the set of replicaIds to exclude when reading changes.
|
static Option<Set<Dn>> |
INCLUDED_BASE_DNS
Option to specify the set of base DNs to include when reading changes.
|
static Option<Set<DomainReplicaId>> |
INCLUDED_REPLICAS
Option to specify the set of replicaIds to include when reading changes.
|
static Option<DBCursor.PositionStrategy> |
POSITION_STRATEGY
Option to specify the position strategy to use when reading changes.
|
Modifier and Type | Method and Description |
---|---|
DBCursor<UpdateMsg> |
getCursorFrom(Dn baseDN,
ServerState startState,
DBCursor.CursorOptions options)
Generates a
DBCursor across all the replicaDBs for the specified replication domain starting before, at
or after the provided ServerState for each replicaDB, depending on the provided matching and positioning
strategies. |
DBCursor<UpdateMsg> |
getCursorFrom(DomainReplicaId replica,
CSN startCSN,
DBCursor.CursorOptions options)
|
MultiDomainDBCursor |
getCursorFrom(MultiDomainServerState startState,
DBCursor.CursorOptions options)
Generates a
DBCursor across all the domains starting before, at or after the provided
MultiDomainServerState for each domain, depending on the provided matching and positioning strategies. |
MultiDomainDBCursor |
getCursorFrom(MultiDomainServerState startState,
DBCursor.CursorOptions options,
Set<Dn> excludedDomainDns)
Generates a
DBCursor across all the domains starting before, at or after the provided
MultiDomainServerState for each domain, excluding a provided set of domain DNs. |
ServerState |
getDomainNewestCSNs(Dn baseDN)
Returns the newest
CSN s from the replicaDBs for each replica id in the specified replication domain. |
ServerState |
getDomainOldestCSNs(Dn baseDN)
Returns the oldest
CSN s from the replicaDBs for each replica id in the specified replication domain. |
UpdateMsg |
getNewestMessage(DomainReplicaId replica)
Returns the newest message from the replica DB for the provided replica.
|
Flowable<UpdateRecord> |
getPublisher(MultiDomainServerState startState,
Options options)
Returns a publisher on the databases for all domains starting before, at or after the provided
MultiDomainServerState for each domain, possibly including/excluding some base DNs
and/or some replicaIds. |
boolean |
publishUpdateMsg(Dn baseDN,
UpdateMsg updateMsg)
Publishes the provided change to the changelog DB for the specified replica id and replication domain.
|
void |
removeDomain(Dn baseDN)
Removes all the data relating to the specified replication domain and shutdown all its replica databases.
|
void |
replicaHeartbeat(Dn baseDN,
CSN heartbeatCSN)
Let the DB know this replica is alive.
|
void |
unregisterCursor(DBCursor<?> cursor)
Unregisters the provided cursor from this replication domain.
|
static final Option<Set<Dn>> INCLUDED_BASE_DNS
static final Option<Set<Dn>> EXCLUDED_BASE_DNS
static final Option<Set<DomainReplicaId>> INCLUDED_REPLICAS
static final Option<Set<DomainReplicaId>> EXCLUDED_REPLICAS
static final Option<CSN> DEFAULT_CSN
For example, providing a default CSN with DBCursor.PositionStrategy.GREATER_THAN_OR_EQUAL_TO_KEY
means the reader will first return the record immediately newer than the provided default CSN.
static final Option<DBCursor.PositionStrategy> POSITION_STRATEGY
ServerState getDomainOldestCSNs(Dn baseDN)
CSN
s from the replicaDBs for each replica id in the specified replication domain.baseDN
- the replication domain baseDNServerState getDomainNewestCSNs(Dn baseDN)
CSN
s from the replicaDBs for each replica id in the specified replication domain.baseDN
- the replication domain baseDNUpdateMsg getNewestMessage(DomainReplicaId replica)
replica
- the base dn and replica id of the replicavoid removeDomain(Dn baseDN) throws ChangelogException
baseDN
- the replication domain baseDNChangelogException
- If a database problem happenedMultiDomainDBCursor getCursorFrom(MultiDomainServerState startState, DBCursor.CursorOptions options) throws ChangelogException
DBCursor
across all the domains starting before, at or after the provided
MultiDomainServerState
for each domain, depending on the provided matching and positioning strategies.
When the cursor is not used anymore, client code MUST call the DBCursor.close()
method to free the
resources and locks used by the cursor.
If the positioning strategy defined in options
is GREATER_THAN_KEY
or
GREATER_THAN_OR_EQUAL_TO_KEY
, positioning may happen at a change from a replica added after the matching
point, otherwise it will position at a change from one of the known replicas.
startState
- Starting point for each domain cursor. If any ServerState
for a domain is null, then start
from the oldest CSN for each replicaDBsoptions
- The cursor optionsDBCursor
ChangelogException
- If a database problem happened#getCursorFrom(Dn, ServerState, CursorOptions)
MultiDomainDBCursor getCursorFrom(MultiDomainServerState startState, DBCursor.CursorOptions options, Set<Dn> excludedDomainDns) throws ChangelogException
DBCursor
across all the domains starting before, at or after the provided
MultiDomainServerState
for each domain, excluding a provided set of domain DNs.
When the cursor is not used anymore, client code MUST call the DBCursor.close()
method to free the
resources and locks used by the cursor.
If the positioning strategy defined in options
is GREATER_THAN_KEY
or
GREATER_THAN_OR_EQUAL_TO_KEY
, positioning may happen at a change from a replica added after the matching
point, otherwise it will position at a change from one of the known replicas.
startState
- Starting point for each domain cursor. If any ServerState
for a domain is null, then start
from the oldest CSN for each replicaDBsoptions
- The cursor optionsexcludedDomainDns
- Every domain appearing in this set is excluded from the cursorDBCursor
ChangelogException
- If a database problem happened#getCursorFrom(Dn, ServerState, CursorOptions)
Flowable<UpdateRecord> getPublisher(MultiDomainServerState startState, Options options)
MultiDomainServerState
for each domain, possibly including/excluding some base DNs
and/or some replicaIds.
To restrict the publisher to a single domain the INCLUDED_BASE_DNS
option must be provided
with a set containing only the base DN of the domain.
The publisher never completes, it must be cancelled when not needed anymore.
If the positioning strategy defined in options
is GREATER_THAN_KEY
or
GREATER_THAN_OR_EQUAL_TO_KEY
, positioning may happen to a change from a replica added after the matching
point, otherwise it will position to a change from one of the known replicas.
The publisher is automatically updated if some base DN or replica is either added or removed to/from the changelog database, after applying the include/exclude options.
Reading will start only when the returned Flowable
has been subscribed to.
startState
- Starting point for each domain. If any ServerState
for a domain is null, then uses
DEFAULT_CSN
provided in options if available, otherwise starts from the oldest CSN
for each replicaDB.options
- The options for reading, which can be any of POSITION_STRATEGY
, DEFAULT_CSN
,
INCLUDED_BASE_DNS
, EXCLUDED_BASE_DNS
, INCLUDED_REPLICAS
and
EXCLUDED_REPLICAS
.
By default, if no options are provided, POSITION_STRATEGY
is equal to
PositionStrategy.EQUAL_TO_KEY
and all base DNs and replicas are included.DBCursor<UpdateMsg> getCursorFrom(Dn baseDN, ServerState startState, DBCursor.CursorOptions options) throws ChangelogException
DBCursor
across all the replicaDBs for the specified replication domain starting before, at
or after the provided ServerState
for each replicaDB, depending on the provided matching and positioning
strategies.
When the cursor is not used anymore, client code MUST call the DBCursor.close()
method to free the
resources and locks used by the cursor.
If the positioning strategy defined in options
is GREATER_THAN_KEY
or
GREATER_THAN_OR_EQUAL_TO_KEY
, positioning may happen at a change from a replica added after the matching
point, otherwise it will position at a change from one of the known replicas.
baseDN
- the replication domain baseDNstartState
- Starting point for each ReplicaDB cursor. If any CSN for a replicaDB is null, then start from the
oldest CSN for this replicaDBoptions
- The cursor optionsDBCursor
ChangelogException
- If a database problem happened#getCursorFrom(DomainReplicaId, CSN, CursorOptions)
DBCursor<UpdateMsg> getCursorFrom(DomainReplicaId replica, CSN startCSN, DBCursor.CursorOptions options) throws ChangelogException
DBCursor
for one replicaDB for the specified replication domain and replica id starting
before, at or after the provided CSN
, depending on the provided matching and positioning strategies.
When the cursor is not used anymore, client code MUST call the DBCursor.close()
method to free the
resources and locks used by the cursor.
replica
- the domain replicaId of the replicaDBstartCSN
- Starting point for the ReplicaDB cursor. If the CSN is null, then start from the oldest CSN for this
replicaDBoptions
- The cursor optionsDBCursor
ChangelogException
- If a database problem happenedvoid unregisterCursor(DBCursor<?> cursor)
cursor
- the cursor to unregister.boolean publishUpdateMsg(Dn baseDN, UpdateMsg updateMsg) throws ChangelogException
baseDN
- the replication domain baseDNupdateMsg
- the update message to publish to the replicaDBChangelogException
- If a database problem happenedvoid replicaHeartbeat(Dn baseDN, CSN heartbeatCSN) throws ChangelogException
This method allows the medium consistency point to move forward in case this replica did not publish new changes.
baseDN
- the replication domain baseDNheartbeatCSN
- The CSN heartbeat sent by this replica (contains the replica id and timestamp of the heartbeat)ChangelogException
- If a database problem happenedCopyright 2010-2022 ForgeRock AS.