Interface BlockAllocatorInternal

All Superinterfaces:
AutoCloseable, Closeable

public interface BlockAllocatorInternal extends 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 Details

    • getBlockAllocation

      BlockAllocation getBlockAllocation()
      Provides information about block allocation within this block allocator
      Returns:
      the block allocation
    • getFreeBlocks

      long getFreeBlocks()
    • allocate

      CatalogBlockIndices allocate(BlockType blockType, int blockNumber, boolean rebalance)
      provide a list of blocks to be used
      Parameters:
      blockNumber - the number of blocks
      rebalance - if rebalance should happen in this cycle
      Returns:
      the block ids
    • allocate

      long allocate(BlockType blockType, boolean rebalance)
      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 mark
      rebalance - if the rebalance should happend in this cycle
    • free

      void free(CatalogBlockIndices indices, boolean rebalance)
      Free a set of blocks
      Parameters:
      indices - the set of blocks to free
      rebalance - 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