public class MemLogStorage extends Object implements LogStorage, LogStorageStatus
Constructor and Description |
---|
MemLogStorage() |
MemLogStorage(long bucketSize,
int bucketRecordCount) |
MemLogStorage(long maxStorageSize,
long bucketSize,
int bucketRecordCount) |
Modifier and Type | Method and Description |
---|---|
void |
addLogRecord(LogRecord record)
Persists new log record.
|
void |
close()
Closes log storage and releases all used resources (if any)
|
long |
getConsumedVolume()
Retrieves current log storage size used by added records.
|
LogBlock |
getRecordBlock(long blockSize,
int batchCount)
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.
|
public MemLogStorage()
public MemLogStorage(long bucketSize, int bucketRecordCount)
public MemLogStorage(long maxStorageSize, long bucketSize, int bucketRecordCount)
public long getConsumedVolume()
LogStorageStatus
getConsumedVolume
in interface LogStorageStatus
public long getRecordCount()
LogStorageStatus
getRecordCount
in interface LogStorageStatus
public void addLogRecord(LogRecord record)
LogStorage
addLogRecord
in interface LogStorage
record
- New record (LogRecord
)public LogBlock getRecordBlock(long blockSize, int batchCount)
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 void close()
LogStorage
close
in interface LogStorage
public LogStorageStatus getStatus()
LogStorage
getStatus
in interface LogStorage
Copyright © 2015. All rights reserved.