Class DBMemoryRedoLogFile<T extends IReplicationOrderedPacket>
java.lang.Object
com.gigaspaces.internal.server.space.redolog.DBMemoryRedoLogFile<T>
- All Implemented Interfaces:
IRedoLogFileStatistics,IRedoLogFile<T>
public class DBMemoryRedoLogFile<T extends IReplicationOrderedPacket>
extends Object
implements IRedoLogFile<T>
-
Constructor Summary
ConstructorsConstructorDescriptionDBMemoryRedoLogFile(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 sizelongGets 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()iterator(long fromKey) 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 fileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.gigaspaces.internal.server.space.redolog.IRedoLogFile
flushToStorage, getSwapStorageType
-
Constructor Details
-
DBMemoryRedoLogFile
public DBMemoryRedoLogFile(DBSwapRedoLogFileConfig<T> config, AbstractSingleFileGroupBacklog<?, ?> groupBacklog)
-
-
Method Details
-
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
-
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>
-
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
-
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
-
iterator
-