aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/reprocessing/i_reprocessing_task.h
blob: 1bafa7a94fbd2854b439d2eed298f9b2925218c7 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <memory>
#include <vector>

namespace proton {

/**
 * Interface class for reprocessing task, subclassed by specific
 * task.
 */
class IReprocessingTask
{
public:
    using SP = std::shared_ptr<IReprocessingTask>;
    using UP = std::unique_ptr<IReprocessingTask>;
    using List = std::vector<SP>;

    struct Progress
    {
        double _progress;
        double _weight;

        Progress()
            : _progress(0.0),
              _weight(0.0)
        {}

        Progress(double progress, double weight)
            : _progress(progress),
              _weight(weight)
        {}
    };

    virtual ~IReprocessingTask() {}

    /**
     * Run reprocessing task.
     */
    virtual void run() = 0;

    virtual Progress getProgress() const = 0;
};

} // namespace proton