Class DBSwapRedoLogFile<T extends IReplicationOrderedPacket>
java.lang.Object
com.gigaspaces.internal.server.space.redolog.DBSwapRedoLogFile<T>
- All Implemented Interfaces:
IRedoLogFileStatistics,IRedoLogFile<T>
public class DBSwapRedoLogFile<T extends IReplicationOrderedPacket>
extends Object
implements IRedoLogFile<T>
-
Constructor Summary
ConstructorsConstructorDescriptionDBSwapRedoLogFile(DBSwapRedoLogFileConfig<T> config, AbstractSingleFileGroupBacklog<?, ?> groupBacklog) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a replication packet to the file as the latest packetvoidclose()Closes the redo log filevoiddeleteOldestPackets(long packetsCount) Deletes the oldest packets, starting from the oldest up until the specified batch sizeintFlush redo-log packets from memory to underlying storage.longGets an approximation of the number of replication packets held in the file, implementation of this method should not assume a reader lock is held and hence can return a result which is not accurate if it cannot do so without a lock.longlonglonglonglonglonglongbooleanisEmpty()performCompaction(long from, long to) readOnlyIterator(long fromKey) Remove and returns the oldest replication packet in the filelongsize()voidValidates the integrity of the redo log file
-
Constructor Details
-
DBSwapRedoLogFile
public DBSwapRedoLogFile(DBSwapRedoLogFileConfig<T> config, AbstractSingleFileGroupBacklog<?, ?> groupBacklog)
-
-
Method Details
-
getSwapStorageType
- Specified by:
getSwapStorageTypein interfaceIRedoLogFile<T extends IReplicationOrderedPacket>
-
getExternalStorageSpaceUsed
public long getExternalStorageSpaceUsed()- Specified by:
getExternalStorageSpaceUsedin interfaceIRedoLogFileStatistics- Returns:
- used space in bytes which is external to the jvm
-
getMemoryPacketsCount
public long getMemoryPacketsCount()- Specified by:
getMemoryPacketsCountin interfaceIRedoLogFileStatistics- Returns:
- number of packets held in memory
-
getExternalStoragePacketsCount
public long getExternalStoragePacketsCount()- Specified by:
getExternalStoragePacketsCountin interfaceIRedoLogFileStatistics- Returns:
- number of packets held in storage
-
getMemoryPacketsWeight
public long getMemoryPacketsWeight()- Specified by:
getMemoryPacketsWeightin interfaceIRedoLogFileStatistics- Returns:
- total weight of packets held in memory
-
getExternalStoragePacketsWeight
public long getExternalStoragePacketsWeight()- Specified by:
getExternalStoragePacketsWeightin interfaceIRedoLogFileStatistics- Returns:
- total weight of packets held in external storage
-
add
Description copied from interface:IRedoLogFileAdd a replication packet to the file as the latest packet- Specified by:
addin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Parameters:
replicationPacket- packet to add
-
removeOldest
Description copied from interface:IRedoLogFileRemove and returns the oldest replication packet in the file- Specified by:
removeOldestin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Returns:
- returns the oldest replication packet in the file
-
getOldest
- Specified by:
getOldestin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Returns:
- Gets the oldest replication packet in the file
-
getOldestKey
public long getOldestKey()- Specified by:
getOldestKeyin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>
-
size
public long size()- Specified by:
sizein interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Specified by:
sizein interfaceIRedoLogFileStatistics- Returns:
- the number of replication packets held in the file
-
getApproximateSize
public long getApproximateSize()Description copied from interface:IRedoLogFileGets an approximation of the number of replication packets held in the file, implementation of this method should not assume a reader lock is held and hence can return a result which is not accurate if it cannot do so without a lock.- Specified by:
getApproximateSizein interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Returns:
- an approximation of the replication packets held in the file
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Returns:
- true if the file has no replication packets stored
-
deleteOldestPackets
public void deleteOldestPackets(long packetsCount) Description copied from interface:IRedoLogFileDeletes the oldest packets, starting from the oldest up until the specified batch size- Specified by:
deleteOldestPacketsin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Parameters:
packetsCount- number of oldest packets to delete
-
validateIntegrity
Description copied from interface:IRedoLogFileValidates the integrity of the redo log file- Specified by:
validateIntegrityin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Throws:
RedoLogFileCompromisedException
-
close
public void close()Description copied from interface:IRedoLogFileCloses the redo log file- Specified by:
closein interfaceIRedoLogFile<T extends IReplicationOrderedPacket>
-
getWeight
public long getWeight()- Specified by:
getWeightin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>
-
performCompaction
- Specified by:
performCompactionin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Parameters:
from- key to start searching transient packet fromto- key to end searching transient packet from- Returns:
- number of discarded packets
-
readOnlyIterator
- Specified by:
readOnlyIteratorin interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Parameters:
fromKey- index to start from- Returns:
- read only iterator over the packets in the file that will start from the given index, where 0 specified the oldest packet
-
flushToStorage
public int flushToStorage()Description copied from interface:IRedoLogFileFlush redo-log packets from memory to underlying storage. Not thread safe, should be called under lock and only when the space is in quiesce mode.- Specified by:
flushToStoragein interfaceIRedoLogFile<T extends IReplicationOrderedPacket>- Returns:
- number of flushed packets
-