Interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>
- All Superinterfaces:
IRedoLogFileStorageStatistics
- All Known Subinterfaces:
INonBatchRedoLogFileStorage<T>
- All Known Implementing Classes:
BufferedRedoLogFileStorageDecorator,ByteBufferRedoLogFileStorage,CacheLastRedoLogFileStorageDecorator,SqliteRedoLogFileStorage
public interface IRedoLogFileStorage<T extends IReplicationOrderedPacket>
extends IRedoLogFileStorageStatistics
Provide an external storage for a redo log file, Packets are stored as a single list, adding
packets are always appended at the end of the list, and removal of packets are always from the
start of the list
Implementor should support concurrent readers or a single writer, in other words, the implementor
can assume access to this structure are guarded with a reader writer lock according to the
operation type
An exception is
size() method which should not assume a reader lock is held.- Since:
- 7.1
- Author:
- eitany
-
Method Summary
Modifier and TypeMethodDescriptionvoidappendBatch(List<T> replicationPackets) Adds a batch of packets that will be stored at the end of the listvoidclose()Close the storage and clears its resources, the storage can no longer be used.voiddeleteOldestPackets(long packetsCount) Delete a batch from the start of the listlonglongdefault Tdefault longlongbooleanisEmpty()performCompaction(long from, long to) readOnlyIterator(long fromIndex) removeFirstBatch(int batchCapacity, long lastCompactionRangeEndKey) Removes a batch from the start of the listdefault Tlongsize()This method should not assume a reader lock is obtained when accessing itvoidValidates the integrity of the storageMethods inherited from interface com.gigaspaces.internal.server.space.redolog.storage.IRedoLogFileStorageStatistics
getExternalPacketsCount, getExternalStoragePacketsWeight, getMemoryPacketsCount, getMemoryPacketsWeight, getSpaceUsed
-
Method Details
-
appendBatch
Adds a batch of packets that will be stored at the end of the list- Parameters:
replicationPackets- packets to store- Throws:
StorageExceptionStorageFullException
-
size
This method should not assume a reader lock is obtained when accessing it- Returns:
- number of packets in the storage
- Throws:
StorageException
-
removeFirstBatch
WeightedBatch<T> removeFirstBatch(int batchCapacity, long lastCompactionRangeEndKey) throws StorageException Removes a batch from the start of the list- Parameters:
batchCapacity- WeightToRemove to removelastCompactionRangeEndKey- packets with keys larger than this cannot be discarded- Returns:
- removed batch
- Throws:
StorageException
-
deleteOldestPackets
Delete a batch from the start of the list- Parameters:
packetsCount- number of packets to delete- Throws:
StorageException
-
readOnlyIterator
- Parameters:
fromIndex- index to start iterating from- Returns:
- read only iterator that starts from the specified index
- Throws:
StorageException
-
isEmpty
- Returns:
- true if the storage has no packets
- Throws:
StorageException
-
validateIntegrity
Validates the integrity of the storage- Throws:
RedoLogFileCompromisedException
-
close
void close()Close the storage and clears its resources, the storage can no longer be used. -
getWeight
long getWeight() -
getDiscardedPacketsCount
long getDiscardedPacketsCount() -
performCompaction
-
getCacheWeight
long getCacheWeight() -
getOldest
- Throws:
StorageException
-
removeOldest
- Throws:
StorageException
-
getOldestKey
- Throws:
StorageException
-