CatapultServer  v0.5.0.1 (Elephant)
TasksConfiguration.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include <boost/filesystem/path.hpp>
24 #include <unordered_map>
25 
26 namespace catapult { namespace utils { class ConfigurationBag; } }
27 
28 namespace catapult { namespace sync {
29 
30  // region UniformTaskConfiguration
31 
34  public:
37 
40 
41  private:
42  UniformTaskConfiguration() = default;
43 
44  public:
47 
48  public:
51  };
52 
53  // endregion
54 
55  // region DeceleratingTaskConfiguration
56 
59  public:
62 
65 
68 
71 
74 
75  private:
77 
78  public:
81 
82  public:
85  };
86 
87  // endregion
88 
91  public:
93  enum class TaskType {
95  Uniform,
96 
99  };
100 
103  public:
106 
107  union {
110 
113  };
114 
115  public:
118  {}
119  };
120 
121  public:
123  std::unordered_map<std::string, TaskConfiguration> Tasks;
124 
125  private:
126  TasksConfiguration() = default;
127 
128  public:
131 
132  public:
135 
137  static TasksConfiguration LoadFromPath(const boost::filesystem::path& resourcesPath);
138  };
139 }}
catapult::sync::TasksConfiguration
Tasks configuration settings.
Definition: TasksConfiguration.h:90
catapult::sync::UniformTaskConfiguration::UniformTaskConfiguration
UniformTaskConfiguration()=default
catapult::sync::UniformTaskConfiguration::LoadFromBag
static UniformTaskConfiguration LoadFromBag(const utils::ConfigurationBag &bag)
Loads a task configuration from bag.
Definition: TasksConfiguration.cpp:36
catapult::utils::VerifyBagSizeLte
void VerifyBagSizeLte(const ConfigurationBag &bag, size_t expectedSize)
Verifies that the number of properties in bag is no greater than expectedSize.
Definition: utils/ConfigurationUtils.cpp:38
catapult::sync::TasksConfiguration::TaskConfiguration::Uniform
UniformTaskConfiguration Uniform
Configuration when task type is uniform.
Definition: TasksConfiguration.h:109
catapult::sync::UniformTaskConfiguration::StartDelay
utils::TimeSpan StartDelay
Delay until the first execution of the task.
Definition: TasksConfiguration.h:36
catapult::utils::TimeSpan
Represents a time duration.
Definition: TimeSpan.h:30
catapult::utils::ExtractSectionAsBag
ConfigurationBag ExtractSectionAsBag(const ConfigurationBag &bag, const char *section)
Extracts all section properties from bag into a new bag with a single section with a default (empty s...
Definition: utils/ConfigurationUtils.cpp:43
catapult::utils::ConfigurationBag
A simple bag of properties.
Definition: ConfigurationBag.h:57
ConfigurationFileLoader.h
catapult::sync::DeceleratingTaskConfiguration::LoadFromBag
static DeceleratingTaskConfiguration LoadFromBag(const utils::ConfigurationBag &bag)
Loads a task configuration from bag.
Definition: TasksConfiguration.cpp:54
catapult::sync::DeceleratingTaskConfiguration::NumPhaseOneRounds
uint32_t NumPhaseOneRounds
Number of rounds before deceleration starts.
Definition: TasksConfiguration.h:70
catapult::sync::TasksConfiguration::TaskConfiguration
Task configuration that is a union of all supported task configurations.
Definition: TasksConfiguration.h:102
catapult::sync::DeceleratingTaskConfiguration::NumTransitionRounds
uint32_t NumTransitionRounds
Number of transition rounds from minimum to maximum delay.
Definition: TasksConfiguration.h:73
catapult::sync::TasksConfiguration::Tasks
std::unordered_map< std::string, TaskConfiguration > Tasks
A map of task names to task configurations.
Definition: TasksConfiguration.h:123
catapult::utils::ConfigurationBag::sections
std::unordered_set< std::string > sections() const
Gets the names of all sections in this bag.
Definition: ConfigurationBag.h:104
catapult::sync::DeceleratingTaskConfiguration::MaxDelay
utils::TimeSpan MaxDelay
Maximum delay between task executions.
Definition: TasksConfiguration.h:67
LOAD_PROPERTY
#define LOAD_PROPERTY(NAME)
Definition: TasksConfiguration.cpp:28
catapult::sync::DeceleratingTaskConfiguration::Uninitialized
static DeceleratingTaskConfiguration Uninitialized()
Creates an uninitialized task configuration.
Definition: TasksConfiguration.cpp:50
TasksConfiguration.h
catapult::sync::DeceleratingTaskConfiguration
Decelerating task configuration settings.
Definition: TasksConfiguration.h:58
catapult::sync::TasksConfiguration::TaskType
TaskType
Supported task types.
Definition: TasksConfiguration.h:93
catapult::sync::TasksConfiguration::LoadFromBag
static TasksConfiguration LoadFromBag(const utils::ConfigurationBag &bag)
Loads a tasks configuration from bag.
Definition: TasksConfiguration.cpp:75
ConfigurationUtils.h
catapult::sync::TasksConfiguration::LoadFromPath
static TasksConfiguration LoadFromPath(const boost::filesystem::path &resourcesPath)
Loads a tasks configuration from resourcesPath.
Definition: TasksConfiguration.cpp:95
catapult::sync::UniformTaskConfiguration::Uninitialized
static UniformTaskConfiguration Uninitialized()
Creates an uninitialized task configuration.
Definition: TasksConfiguration.cpp:32
catapult::sync::DeceleratingTaskConfiguration::MinDelay
utils::TimeSpan MinDelay
Minimum delay between task executions.
Definition: TasksConfiguration.h:64
TimeSpan.h
catapult::sync::TasksConfiguration::TaskConfiguration::Decelerating
DeceleratingTaskConfiguration Decelerating
Configuration when task type is decelerating.
Definition: TasksConfiguration.h:112
catapult::sync::TasksConfiguration::TasksConfiguration
TasksConfiguration()=default
ConfigurationBag.h
catapult::sync::DeceleratingTaskConfiguration::DeceleratingTaskConfiguration
DeceleratingTaskConfiguration()=default
catapult::sync::TasksConfiguration::TaskType::Uniform
A task that is scheduled with constant intervals.
catapult::sync::TasksConfiguration::TaskType::Decelerating
A task that is scheduled with increasing intervals.
catapult::sync::UniformTaskConfiguration::RepeatDelay
utils::TimeSpan RepeatDelay
Delay until subsequent executions of the task.
Definition: TasksConfiguration.h:39
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::sync::TasksConfiguration::TaskConfiguration::TaskType
TasksConfiguration::TaskType TaskType
Type of task.
Definition: TasksConfiguration.h:105
catapult::sync::UniformTaskConfiguration
Uniform task configuration settings.
Definition: TasksConfiguration.h:33
catapult::sync::TasksConfiguration::TaskConfiguration::TaskConfiguration
TaskConfiguration()
Creates an empty task configuration.
Definition: TasksConfiguration.h:117
catapult::sync::TasksConfiguration::Uninitialized
static TasksConfiguration Uninitialized()
Creates an uninitialized tasks configuration.
Definition: TasksConfiguration.cpp:71
catapult::sync::DeceleratingTaskConfiguration::StartDelay
utils::TimeSpan StartDelay
Delay until the first execution of the task.
Definition: TasksConfiguration.h:61