Interface BlockAllocatorInternal
- All Superinterfaces:
AutoCloseable
,Closeable
This interface allows to allocate and free blocks
What rebalance is?
The allocation involves usage of blocks where the catalog is stored. The process allocates some blocks in advance
to not have a need to allocate them during the allocation / free operation itself. So this already allocated
blocks are used to maintain a chain on catalog blocks and can extend or shrink it.
After the operation is done it may have used one or several of that block, so that the "balance" of
the preserved blocks is changed. The balance=true would mean that the operation must execute the
rebalance at the end of operation. The
true
is all the time provided if allocation / freeing is executed
by the customer...
But during the rebalancing itself the rebalance should be suppressed to not fall into the recursion problem.
That's why the rebalance=false is all the time used from the internal processes.
To simplify: customer execute operation with rebalance = true, internal proceses requesting the blocks are using rebalance=false
-
Method Summary
Modifier and TypeMethodDescriptionlong
Allocate just one blockprovide a list of blocks to be usedvoid
dump()
void
free
(long blockIndex, boolean rebalance) Marks a provided block as freevoid
free
(CatalogBlockIndices indices, boolean rebalance) Free a set of blocksProvides information about block allocation within this block allocatorlong
getMedia()
The parent mediagetName()
The name of the allocatorlong
Return the first block of the allocatorvoid
remove()
Remove all blocks managed by this block allocatorMethods inherited from interface org.rostore.v2.media.Closeable
checkOpened, close, getStatus
-
Method Details
-
getBlockAllocation
BlockAllocation getBlockAllocation()Provides information about block allocation within this block allocator- Returns:
- the block allocation
-
getFreeBlocks
long getFreeBlocks() -
allocate
provide a list of blocks to be used- Parameters:
blockNumber
- the number of blocksrebalance
- if rebalance should happen in this cycle- Returns:
- the block ids
-
allocate
Allocate just one block- Parameters:
rebalance
- if the rebalance should happen in this cycle- Returns:
- the block index
-
free
void free(long blockIndex, boolean rebalance) Marks a provided block as free- Parameters:
blockIndex
- the block index to markrebalance
- if the rebalance should happend in this cycle
-
free
Free a set of blocks- Parameters:
indices
- the set of blocks to freerebalance
- a flag if rebalance should happen
-
dump
void dump() -
remove
void remove()Remove all blocks managed by this block allocator -
getStartIndex
long getStartIndex()Return the first block of the allocator- Returns:
- the block index
-
getMedia
Media getMedia()The parent media- Returns:
- the media object that this allocator belongs to
-
getName
String getName()The name of the allocator- Returns:
- the name of the allocator
-