public class MemoryLogStorage extends Object implements LogStorage, LogStorageStatus
LogStorage
and LogStorageStatus
Constructor and Description |
---|
MemoryLogStorage(long bucketSize) |
Modifier and Type | Method and Description |
---|---|
void |
addLogRecord(LogRecord record)
Persists new log record.
|
long |
getConsumedVolume()
Retrieves current log storage size used by added records.
|
LogBlock |
getRecordBlock(long blockSize)
Retrieves new log block of specified size or null if there is no logs.
|
long |
getRecordCount()
Retrieves current number of added records.
|
LogStorageStatus |
getStatus()
Gets log storage status.
|
void |
notifyUploadFailed(int id)
Notifies if sending of a log block with a specified id was failed.
|
void |
removeRecordBlock(int id)
Removes already sent log records by its block id.
|
void |
setMaxStorageSize(long maxStorageSize) |
public void addLogRecord(LogRecord record)
LogStorage
addLogRecord
in interface LogStorage
record
- New record (LogRecord
)public long getConsumedVolume()
LogStorageStatus
getConsumedVolume
in interface LogStorageStatus
public long getRecordCount()
LogStorageStatus
getRecordCount
in interface LogStorageStatus
public LogBlock getRecordBlock(long blockSize)
LogStorage
Retrieves new log block of specified size or null if there is no logs.
The size of retrieved log records should NOT be greater than specified block size.
getRecordBlock
in interface LogStorage
blockSize
- Maximum size of sending log blockLogBlock
)public void removeRecordBlock(int id)
LogStorage
Removes already sent log records by its block id.
Use in case of a successful upload.
removeRecordBlock
in interface LogStorage
id
- Unique id of sent log blockpublic void notifyUploadFailed(int id)
LogStorage
notifyUploadFailed
in interface LogStorage
id
- Unique id of log block.public LogStorageStatus getStatus()
LogStorage
getStatus
in interface LogStorage
public void setMaxStorageSize(long maxStorageSize)
Copyright © 2015. All rights reserved.