public class BufferedRedoLogFileStorageDecorator<T> extends Object implements INonBatchRedoLogFileStorage<T>
IRedoLogFileStorage
with a buffer, allowing adding single packets in the storage
which will be flushed once a specific buffer size is reachedConstructor and Description |
---|
BufferedRedoLogFileStorageDecorator(int bufferSize,
IRedoLogFileStorage storage) |
Modifier and Type | Method and Description |
---|---|
void |
append(T replicationPacket)
Add a single packet to the end of the storage list
|
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 |
deleteFirstBatch(long batchSize)
Delete a batch from the start of the list
|
long |
getExternalPacketsCount() |
long |
getMemoryPacketsCount() |
long |
getSpaceUsed() |
IRedoLogFileStorageStatistics |
getUnderlyingStorage() |
boolean |
isEmpty() |
StorageReadOnlyIterator<T> |
readOnlyIterator() |
StorageReadOnlyIterator<T> |
readOnlyIterator(long fromIndex) |
List<T> |
removeFirstBatch(int batchSize)
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()
Validates the integrity of the storage
|
public BufferedRedoLogFileStorageDecorator(int bufferSize, IRedoLogFileStorage storage)
bufferSize
- buffer sizestorage
- wrapped external storagepublic void append(T replicationPacket) throws StorageException
INonBatchRedoLogFileStorage
append
in interface INonBatchRedoLogFileStorage<T>
StorageException
public void appendBatch(List<T> replicationPackets) throws StorageException
IRedoLogFileStorage
appendBatch
in interface IRedoLogFileStorage<T>
replicationPackets
- packets to storeStorageException
public void deleteFirstBatch(long batchSize) throws StorageException
IRedoLogFileStorage
deleteFirstBatch
in interface IRedoLogFileStorage<T>
batchSize
- batch size to deleteStorageException
public StorageReadOnlyIterator<T> readOnlyIterator() throws StorageException
readOnlyIterator
in interface IRedoLogFileStorage<T>
StorageException
public StorageReadOnlyIterator<T> readOnlyIterator(long fromIndex) throws StorageException
readOnlyIterator
in interface IRedoLogFileStorage<T>
fromIndex
- index to start iterating fromStorageException
public List<T> removeFirstBatch(int batchSize) throws StorageException
IRedoLogFileStorage
removeFirstBatch
in interface IRedoLogFileStorage<T>
batchSize
- batch size to removeStorageException
public long size() throws StorageException
IRedoLogFileStorage
size
in interface IRedoLogFileStorage<T>
StorageException
public long getSpaceUsed()
getSpaceUsed
in interface IRedoLogFileStorageStatistics
public long getExternalPacketsCount()
getExternalPacketsCount
in interface IRedoLogFileStorageStatistics
public long getMemoryPacketsCount()
getMemoryPacketsCount
in interface IRedoLogFileStorageStatistics
public boolean isEmpty() throws StorageException
isEmpty
in interface IRedoLogFileStorage<T>
StorageException
public void validateIntegrity() throws RedoLogFileCompromisedException
IRedoLogFileStorage
validateIntegrity
in interface IRedoLogFileStorage<T>
RedoLogFileCompromisedException
public void close()
IRedoLogFileStorage
close
in interface IRedoLogFileStorage<T>
public IRedoLogFileStorageStatistics getUnderlyingStorage()
Copyright © GigaSpaces.