Package org.rostore.v2.catalog
Class CatalogBlockEntry
java.lang.Object
org.rostore.v2.fixsize.ValidatingEntry
org.rostore.v2.fixsize.FixSizeEntry
org.rostore.v2.catalog.CatalogBlockEntry
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNewEntryFor(long startIndex, long stopIndex) longProvides a total number of blocks added to the catalog, stored in the first block of the sequence.longGet the number of blocks in the current entryintProvides an entry size in byteslongProvides the start block in the entrylongProvides the stop block in the entryvoidincAddedNumber(long added) Increments the total number of blocks added to the catalog, stored in the first block of the sequence.voidsetEntryStart(long newStart) Sets the start block index in the current entryvoidsetEntryStartStop(long newStart, long newStop) Sets both start and stop block indices in the current entryvoidsetEntryStop(long newStop) Sets the stop block in the entryMethods inherited from class org.rostore.v2.fixsize.FixSizeEntry
expand, getEntriesNumber, getEntryLocation, getFixSizeEntryBlock, getHash, insert, moveToHash, remove, toStringMethods inherited from class org.rostore.v2.fixsize.ValidatingEntry
first, getIndex, invalid, invalidate, isFirst, last, moveTo, next, previous, throwExceptionIfInvalid, valid, validate
-
Constructor Details
-
CatalogBlockEntry
-
-
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 blocknewStop- 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:
getEntrySizein classFixSizeEntry- Returns:
- the entry size in bytes
-