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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addNewEntryFor
(long startIndex, long stopIndex) long
Provides a total number of blocks added to the catalog, stored in the first block of the sequence.long
Get the number of blocks in the current entryint
Provides an entry size in byteslong
Provides the start block in the entrylong
Provides the stop block in the entryvoid
incAddedNumber
(long added) Increments the total number of blocks added to the catalog, stored in the first block of the sequence.void
setEntryStart
(long newStart) Sets the start block index in the current entryvoid
setEntryStartStop
(long newStart, long newStop) Sets both start and stop block indices in the current entryvoid
setEntryStop
(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, toString
Methods 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:
getEntrySize
in classFixSizeEntry
- Returns:
- the entry size in bytes
-