Class DomainDBCursor
- java.lang.Object
-
- org.opends.server.replication.server.changelog.file.DomainDBCursor
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,DBCursor<UpdateMsg>
@NotThreadSafe public class DomainDBCursor extends Object
Cursor iterating over a replication domain's replica DBs.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opends.server.replication.server.changelog.api.DBCursor
DBCursor.CursorOptions, DBCursor.PositionStrategy
-
-
Constructor Summary
Constructors Constructor Description DomainDBCursor(Dn baseDN, ReplicationDomainDB domainDB, DBCursor.CursorOptions options)
Builds a DomainDBCursor instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addCursor(DBCursor<UpdateMsg> cursor, T data)
Adds a cursor to this composite cursor.void
addReplicaDB(DomainReplicaId replicaId, CSN startCSN)
Adds a replicaDB for this cursor to iterate over.void
close()
Release the resources and locks used by this Iterator.Dn
getBaseDN()
Returns the replication domain baseDN of this cursor.T
getData()
Returns the data associated to the cursor that returned the current record.UpdateMsg
getRecord()
Getter for the current record.protected void
incorporateNewCursors()
Called when implementors should incorporate new cursors into the current composite DBCursor.boolean
next()
Skip to the next record of the database.String
toString()
-
-
-
Constructor Detail
-
DomainDBCursor
public DomainDBCursor(Dn baseDN, ReplicationDomainDB domainDB, DBCursor.CursorOptions options)
Builds a DomainDBCursor instance.- Parameters:
baseDN
- the replication domain baseDN of this cursordomainDB
- the DB for the provided replication domainoptions
- The cursor options
-
-
Method Detail
-
getBaseDN
public Dn getBaseDN()
Returns the replication domain baseDN of this cursor.- Returns:
- the replication domain baseDN of this cursor.
-
addReplicaDB
public void addReplicaDB(DomainReplicaId replicaId, CSN startCSN)
Adds a replicaDB for this cursor to iterate over. Added cursors will be created and iterated over on the next call toDBCursor.next()
.- Parameters:
replicaId
- the replica IDstartCSN
- the CSN to use as a starting point
-
incorporateNewCursors
protected void incorporateNewCursors() throws ChangelogException
Called when implementors should incorporate new cursors into the current composite DBCursor. Implementors should calladdCursor(DBCursor, Object)
to do so.- Throws:
ChangelogException
- if a database problem occurred
-
close
public void close()
Description copied from interface:DBCursor
Release the resources and locks used by this Iterator. This method must be called when the iterator is no longer used. Failure to do it could cause DB deadlock.
-
next
public boolean next() throws ChangelogException
Description copied from interface:DBCursor
Skip to the next record of the database.- Specified by:
next
in interfaceDBCursor<T>
- Returns:
- true if has next, false otherwise
- Throws:
ChangelogException
- When database exception raised.
-
addCursor
protected final void addCursor(DBCursor<UpdateMsg> cursor, T data) throws ChangelogException
Adds a cursor to this composite cursor. It first callsDBCursor.next()
to verify whether it is exhausted or not.- Parameters:
cursor
- the cursor to add to this compositedata
- the data associated to the provided cursor- Throws:
ChangelogException
- if a database problem occurred
-
getRecord
public UpdateMsg getRecord()
Description copied from interface:DBCursor
Getter for the current record.This method will always return
null
when- a call to
DBCursor.next()
returnsfalse
- it is called before the very first call to
DBCursor.next()
.
- a call to
-
getData
public T getData()
Returns the data associated to the cursor that returned the current record.- Returns:
- the data associated to the cursor that returned the current record.
-
-