Exemple #1
0
 virtual LogUploadStrategyDecision isUploadNeeded(ILogStorageStatus& status)
 {
     if (status.getRecordsCount() >= 1) {
         return LogUploadStrategyDecision::UPLOAD;
     }
     return LogUploadStrategyDecision::NOOP;
 }
    virtual LogUploadStrategyDecision isUploadNeeded(ILogStorageStatus& status) override
    {
        auto currentRecordCount = status.getRecordsCount();

        if (currentRecordCount >= uploadCountThreshold_) {
            KAA_LOG_INFO(boost::format("Need to upload logs - current count: %llu, threshold: %llu")
                                                    % currentRecordCount % uploadCountThreshold_);
            return LogUploadStrategyDecision::UPLOAD;
        }

        return LogUploadStrategyDecision::NOOP;
    }
    virtual LogUploadStrategyDecision isUploadNeeded(ILogStorageStatus& status) override
    {
        auto now = Clock::now();
        auto currentRecordCount = status.getRecordsCount();

        if ((currentRecordCount >= uploadCountThreshold_) || (now >= (lastUploadTime_ + std::chrono::seconds(logUploadCheckReriod_)))) {
            KAA_LOG_INFO(boost::format("Need to upload logs - current count: %llu, threshold: %llu, lastUploadedTime: %llu, timeLimit: %llu sec")
                            % currentRecordCount % uploadCountThreshold_ % lastUploadTime_.time_since_epoch().count() % logUploadCheckReriod_);
            lastUploadTime_ = now;
            return LogUploadStrategyDecision::UPLOAD;
        }

        return LogUploadStrategyDecision::NOOP;
    }