client-cpp
0.10.0
|
The default ILogUploadStrategy
implementation.
More...
#include <DefaultLogUploadStrategy.hpp>
Public Member Functions | |
DefaultLogUploadStrategy (IKaaClientContext &context) | |
virtual LogUploadStrategyDecision | isUploadNeeded (ILogStorageStatus &status) |
Decides whether the log upload is needed. More... | |
virtual void | onTimeout (ILogFailoverCommand &controller) |
Callback is used when the log delivery timeout detected. More... | |
virtual void | onFailure (ILogFailoverCommand &controller, LogDeliveryErrorCode code) |
Callback is used when the log delivery is failed. More... | |
virtual std::size_t | getTimeout () |
Maximum time to wait the log delivery response. More... | |
void | setUploadTimeout (std::size_t timeout) |
virtual std::size_t | getTimeoutCheckPeriod () |
void | setTimeoutCheckPeriod (std::size_t period) |
virtual std::size_t | getLogUploadCheckPeriod () |
void | setLogUploadCheckPeriod (std::size_t period) |
virtual std::size_t | getMaxParallelUploads () |
Max amount of log batches allowed to be uploaded parallel. More... | |
void | setMaxParallelUploads (std::size_t count) |
std::size_t | getRetryPeriod () |
void | setRetryPeriod (std::size_t period) |
std::size_t | getVolumeThreshold () const |
void | setVolumeThreshold (std::size_t maxVolume) |
std::size_t | getCountThreshold () const |
void | setCountThreshold (std::size_t maxCount) |
Public Member Functions inherited from kaa::ILogUploadStrategy | |
virtual | ~ILogUploadStrategy () |
Static Public Attributes | |
static const std::size_t | DEFAULT_UPLOAD_TIMEOUT = 2 * 60 |
static const std::size_t | DEFAULT_TIMEOUT_CHECK_PERIOD = 10 |
static const std::size_t | DEFAULT_LOG_UPLOAD_CHECK_PERIOD = 30 |
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 |
static const std::size_t | DEFAULT_MAX_PARALLEL_UPLOADS = INT32_MAX |
Protected Attributes | |
std::size_t | uploadTimeout_ = DEFAULT_UPLOAD_TIMEOUT |
std::size_t | retryReriod_ = DEFAULT_RETRY_PERIOD |
std::size_t | timeoutCheckPeriod_ = DEFAULT_TIMEOUT_CHECK_PERIOD |
std::size_t | logUploadCheckReriod_ = DEFAULT_LOG_UPLOAD_CHECK_PERIOD |
std::size_t | uploadVolumeThreshold_ = DEFAULT_UPLOAD_VOLUME_THRESHOLD |
std::size_t | uploadCountThreshold_ = DEFAULT_UPLOAD_COUNT_THRESHOLD |
std::size_t | maxParallelUploads_ = DEFAULT_MAX_PARALLEL_UPLOADS |
IKaaClientContext & | context_ |
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 53 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 55 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 80 of file DefaultLogUploadStrategy.hpp.
|
inlinevirtual |
Implements kaa::ILogUploadStrategy.
Definition at line 68 of file DefaultLogUploadStrategy.hpp.
|
inlinevirtual |
Max amount of log batches allowed to be uploaded parallel.
Implements kaa::ILogUploadStrategy.
Definition at line 71 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 74 of file DefaultLogUploadStrategy.hpp.
|
inlinevirtual |
Maximum time to wait the log delivery response.
[in] | controller |
Implements kaa::ILogUploadStrategy.
Definition at line 62 of file DefaultLogUploadStrategy.hpp.
|
inlinevirtual |
Implements kaa::ILogUploadStrategy.
Definition at line 65 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 77 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.
Reimplemented in kaa::RecordCountWithTimeLimitLogUploadStrategy, kaa::StorageSizeWithTimeLimitLogUploadStrategy, kaa::PeriodicLogUploadStrategy, kaa::RecordCountLogUploadStrategy, and kaa::StorageSizeLogUploadStrategy.
|
virtual |
Callback is used when the log delivery is failed.
[in] | controller | |
[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 81 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 69 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 72 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 75 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 66 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 63 of file DefaultLogUploadStrategy.hpp.
|
inline |
Definition at line 78 of file DefaultLogUploadStrategy.hpp.
|
protected |
Definition at line 116 of file DefaultLogUploadStrategy.hpp.
|
static |
Definition at line 89 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value for Max amount of log batches allowed to be uploaded parallel.
Definition at line 100 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value (in seconds) for time to postpone log upload.
Definition at line 91 of file DefaultLogUploadStrategy.hpp.
|
static |
Definition at line 87 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value for the log count to initiate the log upload.
Definition at line 97 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value (in seconds) for time to wait the log delivery response.
Definition at line 84 of file DefaultLogUploadStrategy.hpp.
|
static |
The default value (in bytes) for log volume to initiate the log upload.
Definition at line 94 of file DefaultLogUploadStrategy.hpp.
|
protected |
Definition at line 109 of file DefaultLogUploadStrategy.hpp.
|
protected |
Definition at line 114 of file DefaultLogUploadStrategy.hpp.
|
protected |
Definition at line 105 of file DefaultLogUploadStrategy.hpp.
|
protected |
Definition at line 107 of file DefaultLogUploadStrategy.hpp.
|
protected |
Definition at line 112 of file DefaultLogUploadStrategy.hpp.
|
protected |
Definition at line 104 of file DefaultLogUploadStrategy.hpp.
|
protected |
Definition at line 111 of file DefaultLogUploadStrategy.hpp.