xrpld
Loading...
Searching...
No Matches
JobTypeInfo.h
1#pragma once
2
3#include <xrpl/core/Job.h>
4
5#include <chrono>
6#include <string>
7#include <utility>
8
9namespace xrpl {
10
15{
16private:
19
26 int const limit_;
27
33
34public:
35 // Not default constructible
36 JobTypeInfo() = delete;
37
41 int limit,
43 std::chrono::milliseconds peakLatency)
44 : type_(type)
45 , name_(std::move(name))
46 , limit_(limit)
47 , avgLatency_(avgLatency)
48 , peakLatency_(peakLatency)
49 {
50 }
51
52 [[nodiscard]] JobType
53 type() const
54 {
55 return type_;
56 }
57
58 [[nodiscard]] std::string const&
59 name() const
60 {
61 return name_;
62 }
63
64 [[nodiscard]] int
65 limit() const
66 {
67 return limit_;
68 }
69
70 [[nodiscard]] bool
71 special() const
72 {
73 return limit_ == 0;
74 }
75
76 [[nodiscard]] std::chrono::milliseconds
78 {
79 return avgLatency_;
80 }
81
82 [[nodiscard]] std::chrono::milliseconds
84 {
85 return peakLatency_;
86 }
87};
88
89} // namespace xrpl
int limit() const
Definition JobTypeInfo.h:65
int const limit_
The limit on the number of running jobs for this job type.
Definition JobTypeInfo.h:26
std::chrono::milliseconds const peakLatency_
Definition JobTypeInfo.h:32
std::string const name_
Definition JobTypeInfo.h:18
std::string const & name() const
Definition JobTypeInfo.h:59
std::chrono::milliseconds getPeakLatency() const
Definition JobTypeInfo.h:83
std::chrono::milliseconds const avgLatency_
Average and peak latencies for this job type.
Definition JobTypeInfo.h:31
JobType const type_
Definition JobTypeInfo.h:17
bool special() const
Definition JobTypeInfo.h:71
JobType type() const
Definition JobTypeInfo.h:53
std::chrono::milliseconds getAverageLatency() const
Definition JobTypeInfo.h:77
JobTypeInfo()=delete
JobTypeInfo(JobType type, std::string name, int limit, std::chrono::milliseconds avgLatency, std::chrono::milliseconds peakLatency)
Definition JobTypeInfo.h:38
STL namespace.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
JobType
Definition Job.h:21