Package org.rostore.entity
Class BlockAllocationState
java.lang.Object
org.rostore.entity.BlockAllocationState
- All Implemented Interfaces:
BlockAllocation
Materialized object that implements
BlockAllocation
-
Method Summary
Modifier and TypeMethodDescriptionlong
Get number of bytes that have been free from the allocated data.long
Get number of bytes used by the data.long
Get number of bytes allocated for the data.static BlockAllocationState
init()
static BlockAllocationState
init
(long totalLockedSize, long lockedFreeSize, long payloadSize) Initializes the state objectvoid
minus
(BlockAllocation blockAllocation) Subtracts the sizes from the provided object to this objectvoid
plus
(BlockAllocation blockAllocation) Adds the sizes from the provided object to this objectstatic BlockAllocationState
store
(BlockAllocation blockAllocation) Creates a static copy of the providedBlockAllocation
toString()
-
Method Details
-
init
-
init
public static BlockAllocationState init(long totalLockedSize, long lockedFreeSize, long payloadSize) Initializes the state object- Parameters:
totalLockedSize
- the total size of the locked spacelockedFreeSize
- number of bytes free in the total locked sizepayloadSize
- the used bytes number of total locked- Returns:
- the persistent object
-
store
Creates a static copy of the providedBlockAllocation
- Parameters:
blockAllocation
- the object to get data from- Returns:
- the persistent block allocation
-
minus
Subtracts the sizes from the provided object to this object- Parameters:
blockAllocation
- the provided object
-
plus
Adds the sizes from the provided object to this object- Parameters:
blockAllocation
- the provided object
-
getPayloadSize
public long getPayloadSize()Get number of bytes used by the data. This data is actively used by some payload.- Specified by:
getPayloadSize
in interfaceBlockAllocation
- Returns:
- the size in bytes
-
getTotalLockedSize
public long getTotalLockedSize()Get number of bytes allocated for the data. This data is locked and can't be transferred somewhere. Allocated size = Free size + used size or 0.- Specified by:
getTotalLockedSize
in interfaceBlockAllocation
- Returns:
- the size in bytes
-
getLockedFreeSize
public long getLockedFreeSize()Get number of bytes that have been free from the allocated data. This data can be used by the payload, but stays effectively locked unused.- Specified by:
getLockedFreeSize
in interfaceBlockAllocation
- Returns:
- the size in bytes
-
toString
-