17 #ifndef MEMORYLOGSTORAGE_HPP_
18 #define MEMORYLOGSTORAGE_HPP_
22 #ifdef KAA_USE_LOGGING
38 class MemoryLogStorage :
public ILogStorage,
public ILogStorageStatus {
40 typedef struct __MemoryLogStorage__LogBlock__ {
41 __MemoryLogStorage__LogBlock__(
size_t blockSize)
43 , blockSize_(blockSize)
49 ILogStorage::container_type logs_;
50 std::size_t actualSize_;
51 std::size_t blockSize_;
56 MemoryLogStorage(std::size_t blockSize) : blockSize_(blockSize), occupiedSize_(0) {
57 LogBlock initialBlock(blockSize);
58 initialBlock.actualSize_ = 0;
59 initialBlock.finalized_ =
false;
60 logBlocks_.push_back(initialBlock);
62 ~MemoryLogStorage() {}
67 void addLogRecord(
const LogRecord & record);
68 container_type getRecordBlock(std::size_t blockSize,
const std::string& blockId);
69 void removeRecordBlock(
const std::string& blockId);
70 void notifyUploadFailed(
const std::string& blockId);
71 void removeOldestRecords(std::size_t allowedVolume);
76 std::size_t getConsumedVolume()
const;
77 std::size_t getRecordsCount()
const;
80 void resize(std::size_t blockSize);
83 std::size_t blockSize_;
84 std::size_t occupiedSize_;
85 std::list<LogBlock> logBlocks_;