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