Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
TaskManagerProvider.hpp
1#pragma once
2
3#include "etl/ExtractorInterface.hpp"
4#include "etl/LoaderInterface.hpp"
5#include "etl/MonitorInterface.hpp"
7#include "etl/TaskManagerInterface.hpp"
8#include "etl/TaskManagerProviderInterface.hpp"
9#include "etl/impl/Scheduling.hpp"
10#include "etl/impl/TaskManager.hpp"
11#include "util/async/AnyExecutionContext.hpp"
12
13#include <cstdint>
14#include <functional>
15#include <memory>
16#include <optional>
17#include <utility>
18
19namespace etl::impl {
20
25 std::reference_wrapper<NetworkValidatedLedgersInterface> ledgers_;
26 std::shared_ptr<ExtractorInterface> extractor_;
27 std::shared_ptr<LoaderInterface> loader_;
28
29public:
38 std::reference_wrapper<NetworkValidatedLedgersInterface> ledgers,
39 std::shared_ptr<ExtractorInterface> extractor,
40 std::shared_ptr<LoaderInterface> loader
41 )
42 : ledgers_(ledgers), extractor_(std::move(extractor)), loader_(std::move(loader))
43 {
44 }
45
46 std::unique_ptr<TaskManagerInterface>
49 std::reference_wrapper<MonitorInterface> monitor,
50 uint32_t startSeq,
51 std::optional<uint32_t> finishSeq
52 ) override
53 {
54 auto scheduler = impl::makeScheduler(impl::ForwardScheduler{ledgers_, startSeq, finishSeq});
55 // TODO: add impl::BackfillScheduler{startSeq - 1, startSeq - ...},
56
57 return std::make_unique<TaskManager>(
58 std::move(ctx), std::move(scheduler), *extractor_, *loader_, monitor, startSeq
59 );
60 }
61};
62
63} // namespace etl::impl
Definition Scheduling.hpp:24
std::unique_ptr< TaskManagerInterface > make(util::async::AnyExecutionContext ctx, std::reference_wrapper< MonitorInterface > monitor, uint32_t startSeq, std::optional< uint32_t > finishSeq) override
Make a task manager.
Definition TaskManagerProvider.hpp:47
TaskManagerProvider(std::reference_wrapper< NetworkValidatedLedgersInterface > ledgers, std::shared_ptr< ExtractorInterface > extractor, std::shared_ptr< LoaderInterface > loader)
Constructor.
Definition TaskManagerProvider.hpp:37
A type-erased execution context.
Definition AnyExecutionContext.hpp:22
An interface for providing the Task Manager.
Definition TaskManagerProviderInterface.hpp:18