17 #ifndef MEMORYLOGSTORAGE_HPP_
18 #define MEMORYLOGSTORAGE_HPP_
68 void shrinkToSize(std::size_t allowedVolume);
71 struct LogRecordWrapper {
73 : record_(record), blockId_(id) {}
82 size_t totalOccupiedSize_ = 0;
83 size_t occupiedSizeOfUnmarkedRecords_ = 0;
85 size_t unmarkedRecordCount_ = 0;
87 size_t maxOccupiedSize_ = 0;
88 size_t shrinkedSize_ = 0;
90 std::list<LogRecordWrapper> logs_;
91 KAA_MUTEX_DECLARE(logsGuard_);
93 BlockId recordBlockId_;
94 static const BlockId NO_OWNER;
virtual ILogStorageStatus & getStatus()
Returns the current log storage status.
std::pair< RecordBlockId, RecordBlock > RecordPack
The alias for the log block marked by the unique identifier.
The default ILogStorage implementation.
virtual std::size_t getRecordsCount()
Returns the number of collected logs.
std::int32_t RecordBlockId
The alias for the unique identifier of the requested log block.
virtual void notifyUploadFailed(RecordBlockId blockId)
Notifies of the delivery of the log block marked by the specified id has been failed.
std::shared_ptr< LogRecord > LogRecordPtr
virtual void removeRecordBlock(RecordBlockId blockId)
Removes the log block marked by the specified id.
virtual RecordPack getRecordBlock(std::size_t blockSize)
Returns the block of log records which total size is less or equal to the specified block size...
The public interface to access to the log storage.
virtual void addLogRecord(LogRecordPtr serializedRecord)
Adds the log record to the storage.
virtual std::size_t getConsumedVolume()
Returns amount of bytes collected logs are consumed.
MemoryLogStorage()
Creates the size-unlimited log storage.
The public interface to represent the current log storage state.