Package org.rostore.v2.media.block
Interface BlockProvider
- All Known Implementing Classes:
InternalBlockProvider
public interface BlockProvider
A structure that combines both
BlockAllocator
and BlockContainer
.
In many classes it allows to split the low-level transaction blocks collection (BlockContainer
)
and their intended allocation approach (BlockAllocator
from the high-level
operation.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Block
allocateBlock
(BlockType blockType) Allocates a block with the help ofBlockAllocator
and adds it to the associatedBlockContainer
.default void
freeBlock
(long blockIndex) Frees a block from the allocator and removes it from the container.Provides a block allocatorProvides a block container.getMedia()
Provides an associatedMedia
object
-
Method Details
-
getBlockContainer
BlockContainer getBlockContainer()Provides a block container.Used to account the set of blocks that participate in one specific transaction.
- Returns:
- the block container
-
getBlockAllocator
BlockAllocator getBlockAllocator()Provides a block allocatorUsed to allocate new blocks from the set of free blocks nad mark them as used.
- Returns:
- the block allocator
-
getMedia
Media getMedia()Provides an associatedMedia
object- Returns:
- the media object
-
allocateBlock
Allocates a block with the help ofBlockAllocator
and adds it to the associatedBlockContainer
.- Parameters:
blockType
- a block type- Returns:
- the block that has been allocated and added to the block container
-
freeBlock
default void freeBlock(long blockIndex) Frees a block from the allocator and removes it from the container.- Parameters:
blockIndex
- the index of the block
-