public interface LogStorage
Interface for log storage.
Persists each new log record, forms on demand new log block for sending it to the Operation server, removes already sent records, cleans up elder records in case if there is some limitation on a size of log storage.
Reference implementation used by default (MemLogStorage
).
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)
|
LogBlock |
getRecordBlock(long blockSize,
int batchCount)
Retrieves new log block of specified size or null if there is no logs.
|
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 addLogRecord(LogRecord record)
record
- New record (LogRecord
)LogStorageStatus getStatus()
LogBlock getRecordBlock(long blockSize, int batchCount)
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.
blockSize
- Maximum size of sending log blockLogBlock
)void removeRecordBlock(int id)
Removes already sent log records by its block id.
Use in case of a successful upload.
id
- Unique id of sent log blockvoid notifyUploadFailed(int id)
id
- Unique id of log block.void close()
Copyright © 2015. All rights reserved.