Class CatalogBlockEntry


public class CatalogBlockEntry extends FixSizeEntry
An entry used to store the elements of catalog.

The entries in the catalog are stored sorted.

Every entry contains two elements: start and stop block index.

Catalog stores a total number of blocks stored in the catalog in the header of first block. This is needed to be able to fast answer the request to know how many blocks are under control of catalog.

  • Constructor Details

  • Method Details

    • getAddedNumber

      public long getAddedNumber()
      Provides a total number of blocks added to the catalog, stored in the first block of the sequence.

      Should only be called on the root block.

      Returns:
      the total number of blocks in the catalog
    • incAddedNumber

      public void incAddedNumber(long added)
      Increments the total number of blocks added to the catalog, stored in the first block of the sequence.

      Should only be called on the root block.

      Parameters:
      added - number of blocks to add (if positive), or remove (if negative)
    • addNewEntryFor

      public void addNewEntryFor(long startIndex, long stopIndex)
    • getBlocksNumber

      public long getBlocksNumber()
      Get the number of blocks in the current entry
      Returns:
      number of blocks in the current entry
    • setEntryStart

      public void setEntryStart(long newStart)
      Sets the start block index in the current entry
      Parameters:
      newStart - the block index of the entry's start
    • setEntryStartStop

      public void setEntryStartStop(long newStart, long newStop)
      Sets both start and stop block indices in the current entry
      Parameters:
      newStart - the block index of the start block
      newStop - the block index of the stop block
    • getEntryStart

      public long getEntryStart()
      Provides the start block in the entry
      Returns:
      the start block index
    • setEntryStop

      public void setEntryStop(long newStop)
      Sets the stop block in the entry
      Parameters:
      newStop - the stop block index
    • getEntryStop

      public long getEntryStop()
      Provides the stop block in the entry
      Returns:
      the stop block index
    • getEntrySize

      public int getEntrySize()
      Provides an entry size in bytes
      Specified by:
      getEntrySize in class FixSizeEntry
      Returns:
      the entry size in bytes