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 TypeMethodDescriptionlongGet number of bytes that have been free from the allocated data.longGet number of bytes used by the data.longGet number of bytes allocated for the data.static BlockAllocationStateinit()static BlockAllocationStateinit(long totalLockedSize, long lockedFreeSize, long payloadSize) Initializes the state objectvoidminus(BlockAllocation blockAllocation) Subtracts the sizes from the provided object to this objectvoidplus(BlockAllocation blockAllocation) Adds the sizes from the provided object to this objectstatic BlockAllocationStatestore(BlockAllocation blockAllocation) Creates a static copy of the providedBlockAllocationtoString()
-
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:
getPayloadSizein 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:
getTotalLockedSizein 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:
getLockedFreeSizein interfaceBlockAllocation- Returns:
- the size in bytes
-
toString
-