client-cpp
0.7.0
|
The default ILogStorage
implementation.
More...
#include <MemoryLogStorage.hpp>
Public Member Functions | |
MemoryLogStorage () | |
Creates the size-unlimited log storage. More... | |
MemoryLogStorage (size_t maxOccupiedSize, float percentToDelete) | |
Creates the size-limited log storage. More... | |
virtual void | addLogRecord (LogRecordPtr serializedRecord) |
Adds the log record to the storage. More... | |
virtual ILogStorageStatus & | getStatus () |
Returns the current log storage status. More... | |
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. More... | |
virtual void | removeRecordBlock (RecordBlockId blockId) |
Removes the log block marked by the specified id. More... | |
virtual void | notifyUploadFailed (RecordBlockId blockId) |
Notifies of the delivery of the log block marked by the specified id has been failed. More... | |
virtual std::size_t | getConsumedVolume () |
Returns amount of bytes collected logs are consumed. More... | |
virtual std::size_t | getRecordsCount () |
Returns the number of collected logs. More... | |
Public Member Functions inherited from kaa::ILogStorage | |
virtual | ~ILogStorage () |
Public Member Functions inherited from kaa::ILogStorageStatus | |
virtual | ~ILogStorageStatus () |
Additional Inherited Members | |
Public Types inherited from kaa::ILogStorage | |
typedef std::int32_t | RecordBlockId |
The alias for the unique identifier of the requested log block. More... | |
typedef std::list< LogRecordPtr > | RecordBlock |
The alias for the log block container. More... | |
typedef std::pair < RecordBlockId, RecordBlock > | RecordPack |
The alias for the log block marked by the unique identifier. More... | |
The default ILogStorage
implementation.
NOTE: Collected logs are stored in a memory. So logs will be lost if the SDK has been restarted earlier than they are delivered to the Operations server.
Definition at line 35 of file MemoryLogStorage.hpp.
kaa::MemoryLogStorage::MemoryLogStorage | ( | ) |
Creates the size-unlimited log storage.
kaa::MemoryLogStorage::MemoryLogStorage | ( | size_t | maxOccupiedSize, |
float | percentToDelete | ||
) |
Creates the size-limited log storage.
If the size of collected logs exceeds the specified maximum size of the log storage, elder logs will be forcibly deleted. The amount of logs (in bytes) to be deleted is computed by the formula:
SIZE = (MAX_SIZE * PERCENT_TO_DELETE) / 100, where PERCENT_TO_DELETE is in the (0.0, 100.0] range.
[in] | maxOccupiedSize | The maximum size (in bytes) that collected logs can occupy. |
[in] | percentToDelete | The percent of logs (in bytes) to be forcibly deleted. |
KaaException | The percentage is out of the range. |
|
virtual |
Adds the log record to the storage.
Implements kaa::ILogStorage.
|
virtual |
Returns amount of bytes collected logs are consumed.
Implements kaa::ILogStorageStatus.
|
virtual |
Returns the block of log records which total size is less or equal to the specified block size.
[in] | blockSize | The maximum size (in bytes) of the requested log record block. |
RecordBlockId
identifier. Implements kaa::ILogStorage.
|
virtual |
Returns the number of collected logs.
Implements kaa::ILogStorageStatus.
|
inlinevirtual |
Returns the current log storage status.
Implements kaa::ILogStorage.
Definition at line 58 of file MemoryLogStorage.hpp.
|
virtual |
Notifies of the delivery of the log block marked by the specified id has been failed.
[in] | id | The unique identifier of the log block. |
Implements kaa::ILogStorage.
|
virtual |
Removes the log block marked by the specified id.
[in] | id | The unique identifier of the log block. |
Implements kaa::ILogStorage.