aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/test/simple_job_tracker.h
blob: 4fd4a5bd64559fa065222c67197ff03a4c399030 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/searchcore/proton/metrics/i_job_tracker.h>
#include <vespa/vespalib/util/count_down_latch.h>

namespace proton::test {

struct SimpleJobTracker : public IJobTracker
{
    using SP = std::shared_ptr<SimpleJobTracker>;
    vespalib::CountDownLatch _started;
    vespalib::CountDownLatch _ended;
    SimpleJobTracker(uint32_t numJobTrackings) noexcept
        : _started(numJobTrackings),
          _ended(numJobTrackings)
    {}

    // Implements IJobTracker
    void start() override { _started.countDown(); }
    void end() override { _ended.countDown(); }
};

}