17 #ifndef SQLITEDBLOGSTORAGE_HPP_
18 #define SQLITEDBLOGSTORAGE_HPP_
24 #include <unordered_map>
32 #define KAA_DEFAULT_LOG_DB_STORAGE "logs.db"
69 void openDBConnection();
70 void closeDBConnection();
73 void applyOptimization(
int mask);
77 void updateBucketIDForRecords(std::int32_t
id, std::list<int>& idList);
78 void removeRecordById(sqlite3_int64
id);
81 const std::string dbName_;
84 std::size_t unmarkedRecordCount_;
85 std::size_t totalRecordCount_;
87 std::size_t consumedMemory_;
88 std::unordered_map<std::int32_t, std::size_t > consumedMemoryStorage_;
90 KAA_MUTEX_DECLARE(sqliteLogStorageGuard_);
#define KAA_DEFAULT_LOG_DB_STORAGE
virtual void notifyUploadFailed(RecordBlockId id)
Notifies of the delivery of the log block marked by the specified id has been failed.
virtual RecordPack getRecordBlock(std::size_t blockSize, std::size_t recordsBlockCount)
Returns the block of log records which total size is less or equal to the specified block size...
std::pair< RecordBlockId, RecordBlock > RecordPack
The alias for the log block marked by the unique identifier.
virtual std::size_t getRecordsCount()
Returns the number of collected logs.
virtual void removeRecordBlock(RecordBlockId id)
Removes the log block marked by the specified id.
std::int32_t RecordBlockId
The alias for the unique identifier of the requested log block.
virtual std::size_t getConsumedVolume()
Returns amount of bytes collected logs are consumed.
virtual ILogStorageStatus & getStatus()
Returns the current log storage status.
std::shared_ptr< LogRecord > LogRecordPtr
SQLiteOptimizationOptions
The public interface to access to the log storage.
virtual void addLogRecord(LogRecordPtr record)
Adds the log record to the storage.
The public interface to represent the current log storage state.
SQLiteDBLogStorage(const std::string &dbName=KAA_DEFAULT_LOG_DB_STORAGE, int optimizationMask=(int) SQLiteOptimizationOptions::SQLITE_NO_OPTIMIZATIONS)