Class SqliteRedoLogFileStorage<T extends IReplicationOrderedPacket>
java.lang.Object
com.gigaspaces.internal.server.space.redolog.storage.SqliteStorageLayer<T>
com.gigaspaces.internal.server.space.redolog.storage.SqliteRedoLogFileStorage<T>
- All Implemented Interfaces:
IRedoLogFileStorage<T>,IRedoLogFileStorageStatistics
public class SqliteRedoLogFileStorage<T extends IReplicationOrderedPacket>
extends SqliteStorageLayer<T>
implements IRedoLogFileStorage<T>
-
Nested Class Summary
Nested classes/interfaces inherited from class com.gigaspaces.internal.server.space.redolog.storage.SqliteStorageLayer
SqliteStorageLayer.RDBMSRedoLogIterator -
Field Summary
Fields inherited from class com.gigaspaces.internal.server.space.redolog.storage.SqliteStorageLayer
COLUMN_NAMES, connection, OPERATION_TYPE_COLUMN_INDEX, PACKET_COLUMN_INDEX, PACKET_COUNT_COLUMN_INDEX, PACKET_WEIGHT_COLUMN_INDEX, REDO_KEY_COLUMN_INDEX, TABLE_NAME, TYPE_NAME_COLUMN_INDEX, UID_COLUMN_INDEX -
Constructor Summary
Constructors -
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 listlonglonglonglonglonglonglonglonglongbooleanisEmpty()performCompaction(long from, long to) readOnlyIterator(long fromIndex) removeFirstBatch(int batchCapacity, long lastCompactionRangeEndKey) Removes a batch from the start of the listlongsize()This method should not assume a reader lock is obtained when accessing itvoidValidates the integrity of the storageMethods inherited from class com.gigaspaces.internal.server.space.redolog.storage.SqliteStorageLayer
deleteDataFile, deserializePacket, dropTable, executeCreateTable, executeDelete, executeInsert, executeQuery, getPacketCount, getPacketOperationTypeName, getPacketTypeName, getPacketUID, getPacketWeight, getStorageRedoLogSize, serializePacket
-
Constructor Details
-
SqliteRedoLogFileStorage
-
-
Method Details
-
appendBatch
Description copied from interface:IRedoLogFileStorageAdds a batch of packets that will be stored at the end of the list- Specified by:
appendBatchin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>- Parameters:
replicationPackets- packets to store- Throws:
StorageException
-
size
Description copied from interface:IRedoLogFileStorageThis method should not assume a reader lock is obtained when accessing it- Specified by:
sizein interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>- Returns:
- number of packets in the storage
- Throws:
StorageException
-
removeFirstBatch
public WeightedBatch<T> removeFirstBatch(int batchCapacity, long lastCompactionRangeEndKey) throws StorageException Description copied from interface:IRedoLogFileStorageRemoves a batch from the start of the list- Specified by:
removeFirstBatchin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>- Parameters:
batchCapacity- WeightToRemove to removelastCompactionRangeEndKey- packets with keys larger than this cannot be discarded- Returns:
- removed batch
- Throws:
StorageException
-
deleteOldestPackets
Description copied from interface:IRedoLogFileStorageDelete a batch from the start of the list- Specified by:
deleteOldestPacketsin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>- Parameters:
packetsCount- number of packets to delete- Throws:
StorageException
-
readOnlyIterator
- Specified by:
readOnlyIteratorin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>- Parameters:
fromIndex- index to start iterating from- Returns:
- read only iterator that starts from the specified index
- Throws:
StorageException
-
isEmpty
- Specified by:
isEmptyin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>- Returns:
- true if the storage has no packets
- Throws:
StorageException
-
validateIntegrity
Description copied from interface:IRedoLogFileStorageValidates the integrity of the storage- Specified by:
validateIntegrityin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>- Throws:
RedoLogFileCompromisedException
-
getOldest
- Specified by:
getOldestin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>- Throws:
StorageException
-
removeOldest
- Specified by:
removeOldestin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>- Throws:
StorageException
-
getOldestKey
public long getOldestKey()- Specified by:
getOldestKeyin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>
-
close
public void close()Description copied from interface:IRedoLogFileStorageClose the storage and clears its resources, the storage can no longer be used.- Specified by:
closein interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>
-
getWeight
public long getWeight()- Specified by:
getWeightin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>
-
getDiscardedPacketsCount
public long getDiscardedPacketsCount()- Specified by:
getDiscardedPacketsCountin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>
-
performCompaction
- Specified by:
performCompactionin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>
-
getCacheWeight
public long getCacheWeight()- Specified by:
getCacheWeightin interfaceIRedoLogFileStorage<T extends IReplicationOrderedPacket>
-
getSpaceUsed
public long getSpaceUsed()- Specified by:
getSpaceUsedin interfaceIRedoLogFileStorageStatistics- Returns:
- used space in bytes
-
getExternalPacketsCount
public long getExternalPacketsCount()- Specified by:
getExternalPacketsCountin interfaceIRedoLogFileStorageStatistics- Returns:
- number of packets held outside of jvm memory
-
getMemoryPacketsCount
public long getMemoryPacketsCount()- Specified by:
getMemoryPacketsCountin interfaceIRedoLogFileStorageStatistics- Returns:
- number of packets held in jvm memory
-
getMemoryPacketsWeight
public long getMemoryPacketsWeight()- Specified by:
getMemoryPacketsWeightin interfaceIRedoLogFileStorageStatistics- Returns:
- total weight of packets held in memory
-
getExternalStoragePacketsWeight
public long getExternalStoragePacketsWeight()- Specified by:
getExternalStoragePacketsWeightin interfaceIRedoLogFileStorageStatistics- Returns:
- total weight of packets held in external storage
-