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.
See Also:
  • 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 ChangeNumberIndexRecord in 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 ChangeNumberIndexRecord in this DB, null when the DB is empty or closed
      Throws:
      ChangelogException - if a database problem occurs.
    • addRecord

      long addRecord(ChangeNumberIndexRecord record) throws ChangelogException
      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 - The ChangeNumberIndexRecord to 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

      DBCursor<ChangeNumberIndexRecord> getCursorFrom(long startChangeNumber) throws ChangelogException
      Generate a new DBCursor that 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

      void resetChangeNumberTo(long newFirstCN, Dn baseDN, CSN newFirstCSN) throws ChangelogException
      Resets ChangeNumber index to the given number and CSN.
      Parameters:
      newFirstCN - the new change number to appear as first change in the external changelog
      baseDN - the new record for the first change
      newFirstCSN - the CSN of the new first change
      Throws:
      ChangelogException - if an error occurs during reset