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)
44 , blockSize_(blockSize)
50 ILogStorage::container_type logs_;
51 std::size_t actualSize_;
52 std::size_t blockSize_;
57 MemoryLogStorage(std::size_t blockSize) : blockSize_(blockSize), occupiedSize_(0) {
58 LogBlock initialBlock(blockSize);
59 initialBlock.actualSize_ = 0;
60 initialBlock.finalized_ =
false;
61 logBlocks_.push_back(initialBlock);
63 ~MemoryLogStorage() {}
68 void addLogRecord(
const LogRecord & record);
69 container_type getRecordBlock(std::size_t blockSize, std::int32_t blockId);
70 void removeRecordBlock(std::int32_t blockId);
71 void notifyUploadFailed(std::int32_t blockId);
72 void removeOldestRecords(std::size_t allowedVolume);
77 std::size_t getConsumedVolume()
const;
78 std::size_t getRecordsCount()
const;
81 void resize(std::size_t blockSize);
84 std::size_t blockSize_;
85 std::size_t occupiedSize_;
86 std::list<LogBlock> logBlocks_;