public class ByteBufferRedoLogFileStorage<T extends IReplicationOrderedPacket> extends Object implements IRedoLogFileStorage<T>, IStorageSegmentsMediator
| Modifier and Type | Class and Description |
|---|---|
class |
ByteBufferRedoLogFileStorage.ByteArrayResource
A resource for byte array, ensure capacity must be called each time this resource is taken
|
| Constructor and Description |
|---|
ByteBufferRedoLogFileStorage(IByteBufferStorageFactory byteBufferStorageProvider) |
ByteBufferRedoLogFileStorage(IByteBufferStorageFactory byteBufferStorageProvider,
ByteBufferRedoLogFileConfig<T> config,
BacklogWeightPolicy backlogWeightPolicy) |
| Modifier and Type | Method and Description |
|---|---|
void |
allocatedNewResource(StorageSegment.SegmentCursor resource) |
void |
appendBatch(List<T> replicationPackets)
Adds a batch of packets that will be stored at the end of the list
|
void |
close()
Close the storage and clears its resources, the storage can no longer be used.
|
void |
deleteOldestPackets(long packetsCount)
Delete a batch from the start of the list
|
long |
getCacheWeight() |
long |
getDiscardedPacketsCount() |
long |
getExternalPacketsCount() |
long |
getExternalStoragePacketsWeight() |
long |
getMemoryPacketsCount() |
long |
getMemoryPacketsWeight() |
long |
getSpaceUsed() |
long |
getWeight() |
boolean |
isEmpty() |
CompactionResult |
performCompaction(long from,
long to) |
StorageReadOnlyIterator<T> |
readOnlyIterator(long fromIndex) |
WeightedBatch<T> |
removeFirstBatch(int batchCapacity,
long lastCompactionRangeEndKey)
Removes a batch from the start of the list
|
long |
size()
This method should not assume a reader lock is obtained when accessing it
|
void |
validateIntegrity()
Performs an integrity check that verifies the storage state and data is not compromised
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOldest, getOldestKey, removeOldestpublic ByteBufferRedoLogFileStorage(IByteBufferStorageFactory byteBufferStorageProvider)
public ByteBufferRedoLogFileStorage(IByteBufferStorageFactory byteBufferStorageProvider, ByteBufferRedoLogFileConfig<T> config, BacklogWeightPolicy backlogWeightPolicy)
public void appendBatch(List<T> replicationPackets) throws StorageException, StorageFullException
IRedoLogFileStorageappendBatch in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>replicationPackets - packets to storeStorageExceptionStorageFullExceptionpublic void deleteOldestPackets(long packetsCount)
throws StorageException
IRedoLogFileStoragedeleteOldestPackets in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>packetsCount - number of packets to deleteStorageExceptionpublic WeightedBatch<T> removeFirstBatch(int batchCapacity, long lastCompactionRangeEndKey) throws StorageException
IRedoLogFileStorageremoveFirstBatch in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>batchCapacity - WeightToRemove to removelastCompactionRangeEndKey - packets with keys larger than this cannot be discardedStorageExceptionpublic StorageReadOnlyIterator<T> readOnlyIterator(long fromIndex) throws StorageException
readOnlyIterator in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>fromIndex - index to start iterating fromStorageExceptionpublic long size()
throws StorageException
IRedoLogFileStoragesize in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>StorageExceptionpublic boolean isEmpty()
throws StorageException
isEmpty in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>StorageExceptionpublic long getSpaceUsed()
getSpaceUsed in interface IRedoLogFileStorageStatisticspublic long getExternalPacketsCount()
getExternalPacketsCount in interface IRedoLogFileStorageStatisticspublic long getMemoryPacketsCount()
getMemoryPacketsCount in interface IRedoLogFileStorageStatisticspublic long getMemoryPacketsWeight()
getMemoryPacketsWeight in interface IRedoLogFileStorageStatisticspublic long getExternalStoragePacketsWeight()
getExternalStoragePacketsWeight in interface IRedoLogFileStorageStatisticspublic void close()
IRedoLogFileStorageclose in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>public long getWeight()
getWeight in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>public long getDiscardedPacketsCount()
getDiscardedPacketsCount in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>public CompactionResult performCompaction(long from, long to)
performCompaction in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>public long getCacheWeight()
getCacheWeight in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>public void allocatedNewResource(StorageSegment.SegmentCursor resource)
allocatedNewResource in interface IStorageSegmentsMediatorpublic void validateIntegrity()
throws ByteBufferStorageCompromisedException
validateIntegrity in interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>ByteBufferStorageCompromisedExceptionCopyright © GigaSpaces.