Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c10a8f03 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove DurationTracker cloning functions"

parents 3b4792a4 01fe46cb
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -82,8 +82,6 @@ public:

    virtual ~DurationTracker(){};

    virtual unique_ptr<DurationTracker> clone(const int64_t eventTime) = 0;

    virtual void noteStart(const HashableDimensionKey& key, bool condition,
                           const int64_t eventTime, const ConditionKey& conditionKey) = 0;
    virtual void noteStop(const HashableDimensionKey& key, const int64_t eventTime,
+0 −18
Original line number Diff line number Diff line
@@ -37,24 +37,6 @@ MaxDurationTracker::MaxDurationTracker(const ConfigKey& key, const int64_t& id,
                      conditionSliced, fullLink, anomalyTrackers) {
}

unique_ptr<DurationTracker> MaxDurationTracker::clone(const int64_t eventTime) {
    auto clonedTracker = make_unique<MaxDurationTracker>(*this);
    for (auto it = clonedTracker->mInfos.begin(); it != clonedTracker->mInfos.end();) {
        if (it->second.state  != kStopped) {
            it->second.lastStartTime = eventTime;
            it->second.lastDuration = 0;
            it++;
        } else {
            it = clonedTracker->mInfos.erase(it);
        }
    }
    if (clonedTracker->mInfos.empty()) {
        return nullptr;
    } else {
        return clonedTracker;
    }
}

bool MaxDurationTracker::hitGuardRail(const HashableDimensionKey& newKey) {
    // ===========GuardRail==============
    if (mInfos.find(newKey) != mInfos.end()) {
+0 −2
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@ public:

    MaxDurationTracker(const MaxDurationTracker& tracker) = default;

    unique_ptr<DurationTracker> clone(const int64_t eventTime) override;

    void noteStart(const HashableDimensionKey& key, bool condition, const int64_t eventTime,
                   const ConditionKey& conditionKey) override;
    void noteStop(const HashableDimensionKey& key, const int64_t eventTime,
+0 −7
Original line number Diff line number Diff line
@@ -38,13 +38,6 @@ OringDurationTracker::OringDurationTracker(
    mLastStartTime = 0;
}

unique_ptr<DurationTracker> OringDurationTracker::clone(const int64_t eventTime) {
    auto clonedTracker = make_unique<OringDurationTracker>(*this);
    clonedTracker->mLastStartTime = eventTime;
    clonedTracker->mDuration = 0;
    return clonedTracker;
}

bool OringDurationTracker::hitGuardRail(const HashableDimensionKey& newKey) {
    // ===========GuardRail==============
    // 1. Report the tuple count if the tuple count > soft limit
+0 −2
Original line number Diff line number Diff line
@@ -37,8 +37,6 @@ public:

    OringDurationTracker(const OringDurationTracker& tracker) = default;

    unique_ptr<DurationTracker> clone(const int64_t eventTime) override;

    void noteStart(const HashableDimensionKey& key, bool condition, const int64_t eventTime,
                   const ConditionKey& conditionKey) override;
    void noteStop(const HashableDimensionKey& key, const int64_t eventTime,