client-cpp
0.7.0
|
The default ILogUploadStrategy
implementation.
More...
#include <DefaultLogUploadStrategy.hpp>
Public Member Functions | |
DefaultLogUploadStrategy (IKaaChannelManagerPtr manager) | |
virtual LogUploadStrategyDecision | isUploadNeeded (ILogStorageStatus &status) |
Decides whether the log upload is needed. More... | |
virtual void | onTimeout () |
Callback is used when the log delivery timeout detected. More... | |
virtual void | onFailure (LogDeliveryErrorCode code) |
Callback is used when the log delivery is failed. More... | |
virtual std::size_t | getBatchSize () |
Retrieves the maximum size of the report pack that will be delivered in the single request to the Operations server. More... | |
virtual std::size_t | getTimeout () |
Maximum time to wait the log delivery response. More... | |
void | setBatchSize (std::size_t size) |
void | setUploadTimeout (std::size_t timeout) |
void | setRetryPeriod (std::size_t period) |
void | setVolumeThreshold (std::size_t maxVolume) |
void | setCountThreshold (std::size_t maxCount) |
Public Member Functions inherited from kaa::ILogUploadStrategy | |
virtual | ~ILogUploadStrategy () |
Static Public Attributes | |
static const std::size_t | DEFAULT_BATCH_SIZE = 8 * 1024 |
static const std::size_t | DEFAULT_UPLOAD_TIMEOUT = 2 * 60 |
static const std::size_t | DEFAULT_RETRY_PERIOD = 5 * 60 |
static const std::size_t | DEFAULT_UPLOAD_VOLUME_THRESHOLD = 8 * 1024 |
static const std::size_t | DEFAULT_UPLOAD_COUNT_THRESHOLD = 64 |
The default ILogUploadStrategy
implementation.
The decision algorithm depends on the log delivery status:
The LogUploadStrategyDecision::UPLOAD
decision applies in two cases: 1) the consumed volume of the log storage is equal or greater than the corresponding value, specified in the strategy via setVolumeThreshold() (DEFAULT_UPLOAD_VOLUME_THRESHOLD is used by default); 2) the number of collected logs is equal or greater than the corresponding value, specified in the strategy via setCountThreshold() (DEFAULT_UPLOAD_COUNT_THRESHOLD is used by default);
If one of LogDeliveryErrorCode
errors has occurred, the LogUploadStrategyDecision::NOOP
will apply until the retry period, specified via setRetryPeriod (DEFAULT_RETRY_PERIOD is used by default) will have elapsed.
In this case the strategy tries to switch to the next transport channel supported the logging feature.
Definition at line 52 of file DefaultLogUploadStrategy.hpp.
kaa::DefaultLogUploadStrategy::DefaultLogUploadStrategy | ( | IKaaChannelManagerPtr | manager | ) |
|
inlinevirtual |
Retrieves the maximum size of the report pack that will be delivered in the single request to the Operations server.
Implements kaa::ILogUploadStrategy.
Definition at line 61 of file DefaultLogUploadStrategy.hpp.
|
inlinevirtual |
Maximum time to wait the log delivery response.
Implements kaa::ILogUploadStrategy.
Definition at line 62 of file DefaultLogUploadStrategy.hpp.
|
virtual |
Decides whether the log upload is needed.
The decision is made based on the current log storage status and, depending on the strategy implementation, on some additional information.
[in] | status | The log storage status. |
Implements kaa::ILogUploadStrategy.
|
virtual |
Callback is used when the log delivery is failed.
[in] | code | The reason code of the log delivery failure. |
Implements kaa::ILogUploadStrategy.
|
virtual |
Callback is used when the log delivery timeout detected.
More information about the detection of the log delivery timeout read in the documentation for ILogCollector
.
Implements kaa::ILogUploadStrategy.
|
inline |
Definition at line 64 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 68 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 66 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 65 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 67 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value (in bytes) for the maximum size of the report pack that will be delivered in a single request to the Operaions server.
Definition at line 71 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value (in seconds) for time to postpone log upload.
Definition at line 78 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value for the log count to initiate the log upload.
Definition at line 84 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value (in seconds) for time to wait the log delivery response.
Definition at line 75 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value (in bytes) for log volume to initiate the log upload.
Definition at line 81 of file DefaultLogUploadStrategy.hpp.