Interface ChangeNumberIndexDB
public interface ChangeNumberIndexDB
This class stores an index of all the changes seen by this server in the form of
ChangeNumberIndexRecords.
The records are sorted by a global ordering as defined in the CSN class. The index links a changeNumber
to the corresponding CSN. The CSN then links to a corresponding change in one of the ReplicaDBs.-
Method Summary
Modifier and TypeMethodDescriptionlongaddRecord(ChangeNumberIndexRecord record) Add an update to the list of messages that must be saved to this DB managed by this DB and return the changeNumber associated to this record.getCursorFrom(long startChangeNumber) Generate a newDBCursorthat allows to browse the db managed by this object and starting at the position defined by a given changeNumber.longReturns the last generated change number.Get the newest record stored in this DB.Get the oldest record stored in this DB.voidresetChangeNumberTo(long newFirstCN, Dn baseDN, CSN newFirstCSN) Resets ChangeNumber index to the given number and CSN.
-
Method Details
-
getLastGeneratedChangeNumber
long getLastGeneratedChangeNumber()Returns the last generated change number.- Returns:
- the last generated change number
-
getOldestRecord
Get the oldest record stored in this DB.- Returns:
- Returns the oldest
ChangeNumberIndexRecordin this DB, null when the DB is empty or closed - Throws:
ChangelogException- if a database problem occurs.
-
getNewestRecord
Get the newest record stored in this DB.- Returns:
- Returns the newest
ChangeNumberIndexRecordin this DB, null when the DB is empty or closed - Throws:
ChangelogException- if a database problem occurs.
-
addRecord
Add an update to the list of messages that must be saved to this DB managed by this DB and return the changeNumber associated to this record.Note: this method disregards the changeNumber in the provided record.
- Parameters:
record- TheChangeNumberIndexRecordto add to this DB.- Returns:
- the change number associated to this record on adding to this DB
- Throws:
ChangelogException- if a database problem occurs.
-
getCursorFrom
Generate a newDBCursorthat allows to browse the db managed by this object and starting at the position defined by a given changeNumber.- Parameters:
startChangeNumber- The position where the iterator must start.- Returns:
- a new DBCursor that allows to browse this DB managed by this object and starting at the position defined by a given changeNumber.
- Throws:
ChangelogException- if a database problem occurs.
-
resetChangeNumberTo
Resets ChangeNumber index to the given number and CSN.- Parameters:
newFirstCN- the new change number to appear as first change in the external changelogbaseDN- the new record for the first changenewFirstCSN- the CSN of the new first change- Throws:
ChangelogException- if an error occurs during reset
-