client-cpp
0.10.0
|
The default ILogStorage
implementation.
More...
#include <MemoryLogStorage.hpp>
Public Member Functions | |
MemoryLogStorage (IKaaClientContext &context, std::size_t bucketSize=LogStorageConstants::DEFAULT_MAX_BUCKET_SIZE, std::size_t bucketRecordCount=LogStorageConstants::DEFAULT_MAX_BUCKET_RECORD_COUNT) | |
Creates the size-unlimited log storage. More... | |
MemoryLogStorage (IKaaClientContext &context, std::size_t maxOccupiedSize, float percentToDelete, std::size_t bucketSize=LogStorageConstants::DEFAULT_MAX_BUCKET_SIZE, std::size_t bucketRecordCount=LogStorageConstants::DEFAULT_MAX_BUCKET_RECORD_COUNT) | |
Creates the size-limited log storage. More... | |
virtual BucketInfo | addLogRecord (LogRecord &&record) |
Persists a log record. More... | |
virtual ILogStorageStatus & | getStatus () |
Returns a log storage status. More... | |
virtual LogBucket | getNextBucket () |
Returns a new log bucket. More... | |
virtual void | removeBucket (std::int32_t bucketId) |
Tells a log storage to remove a log bucket. More... | |
virtual void | rollbackBucket (std::int32_t bucketId) |
Tells a log storage to consider a log bucket as unused, i.e. a log bucket will be accessible again via getNextBucket(). 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 () |
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 38 of file MemoryLogStorage.hpp.
kaa::MemoryLogStorage::MemoryLogStorage | ( | IKaaClientContext & | context, |
std::size_t | bucketSize = LogStorageConstants::DEFAULT_MAX_BUCKET_SIZE , |
||
std::size_t | bucketRecordCount = LogStorageConstants::DEFAULT_MAX_BUCKET_RECORD_COUNT |
||
) |
Creates the size-unlimited log storage.
[in] | bucketSize | The bucket size in bytes. |
[in] | bucketRecordCount | The number of records in a bucket. |
kaa::MemoryLogStorage::MemoryLogStorage | ( | IKaaClientContext & | context, |
std::size_t | maxOccupiedSize, | ||
float | percentToDelete, | ||
std::size_t | bucketSize = LogStorageConstants::DEFAULT_MAX_BUCKET_SIZE , |
||
std::size_t | bucketRecordCount = LogStorageConstants::DEFAULT_MAX_BUCKET_RECORD_COUNT |
||
) |
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. |
[in] | bucketSize | The bucket size in bytes. |
[in] | bucketRecordCount | The number of records in a bucket. |
KaaException | The percentage is out of the range. |
|
virtual |
Persists a log record.
record | The LogRecord object. |
BucketInfo
object which contains information about a bucket the log record is added. Implements kaa::ILogStorage.
|
virtual |
Returns amount of bytes collected logs are consumed.
Implements kaa::ILogStorageStatus.
|
virtual |
Returns a new log bucket.
LogBucket
object. Implements kaa::ILogStorage.
|
virtual |
Returns the number of collected logs.
Implements kaa::ILogStorageStatus.
|
inlinevirtual |
Returns a log storage status.
LogStorageStatus
object. Implements kaa::ILogStorage.
Definition at line 71 of file MemoryLogStorage.hpp.
|
virtual |
Tells a log storage to remove a log bucket.
bucketId | The id of a log bucket. |
Implements kaa::ILogStorage.
|
virtual |
Tells a log storage to consider a log bucket as unused, i.e. a log bucket will be accessible again via getNextBucket().
bucketId | The id of a log bucket. |
Implements kaa::ILogStorage.