client-cpp  0.7.0
kaa::MemoryLogStorage Class Reference

The default ILogStorage implementation. More...

#include <MemoryLogStorage.hpp>

+ Inheritance diagram for kaa::MemoryLogStorage:
+ Collaboration diagram for kaa::MemoryLogStorage:

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 ILogStorageStatusgetStatus ()
 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< LogRecordPtrRecordBlock
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
[in]maxOccupiedSizeThe maximum size (in bytes) that collected logs can occupy.
[in]percentToDeleteThe percent of logs (in bytes) to be forcibly deleted.
Exceptions
KaaExceptionThe percentage is out of the range.

Member Function Documentation

virtual void kaa::MemoryLogStorage::addLogRecord ( LogRecordPtr  record)
virtual

Adds the log record to the storage.

Implements kaa::ILogStorage.

virtual std::size_t kaa::MemoryLogStorage::getConsumedVolume ( )
virtual

Returns amount of bytes collected logs are consumed.

Returns
Size (in bytes).

Implements kaa::ILogStorageStatus.

virtual RecordPack kaa::MemoryLogStorage::getRecordBlock ( std::size_t  blockSize)
virtual

Returns the block of log records which total size is less or equal to the specified block size.

Parameters
[in]blockSizeThe maximum size (in bytes) of the requested log record block.
Returns
The log record block marked by the unique RecordBlockId identifier.

Implements kaa::ILogStorage.

virtual std::size_t kaa::MemoryLogStorage::getRecordsCount ( )
virtual

Returns the number of collected logs.

Returns
The number of collected logs.

Implements kaa::ILogStorageStatus.

virtual ILogStorageStatus& kaa::MemoryLogStorage::getStatus ( )
inlinevirtual

Returns the current log storage status.

Returns
The current log storage status.

Implements kaa::ILogStorage.

Definition at line 58 of file MemoryLogStorage.hpp.

virtual void kaa::MemoryLogStorage::notifyUploadFailed ( RecordBlockId  id)
virtual

Notifies of the delivery of the log block marked by the specified id has been failed.

Parameters
[in]idThe unique identifier of the log block.

Implements kaa::ILogStorage.

virtual void kaa::MemoryLogStorage::removeRecordBlock ( RecordBlockId  id)
virtual

Removes the log block marked by the specified id.

Parameters
[in]idThe unique identifier of the log block.

Implements kaa::ILogStorage.


The documentation for this class was generated from the following file: