rippled
Loading...
Searching...
No Matches
JobTypeInfo.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_CORE_JOBTYPEINFO_H_INCLUDED
21#define RIPPLE_CORE_JOBTYPEINFO_H_INCLUDED
22
23#include <xrpld/core/Job.h>
24
25namespace ripple {
26
29{
30private:
33
39 int const m_limit;
40
44
45public:
46 // Not default constructible
47 JobTypeInfo() = delete;
48
52 int limit,
54 std::chrono::milliseconds peakLatency)
55 : m_type(type)
56 , m_name(std::move(name))
57 , m_limit(limit)
58 , m_avgLatency(avgLatency)
59 , m_peakLatency(peakLatency)
60 {
61 }
62
64 type() const
65 {
66 return m_type;
67 }
68
69 std::string const&
70 name() const
71 {
72 return m_name;
73 }
74
75 int
76 limit() const
77 {
78 return m_limit;
79 }
80
81 bool
82 special() const
83 {
84 return m_limit == 0;
85 }
86
89 {
90 return m_avgLatency;
91 }
92
95 {
96 return m_peakLatency;
97 }
98};
99
100} // namespace ripple
101
102#endif
Holds all the 'static' information about a job, which does not change.
Definition: JobTypeInfo.h:29
std::chrono::milliseconds const m_avgLatency
Average and peak latencies for this job type.
Definition: JobTypeInfo.h:42
std::chrono::milliseconds getPeakLatency() const
Definition: JobTypeInfo.h:94
int const m_limit
The limit on the number of running jobs for this job type.
Definition: JobTypeInfo.h:39
JobType type() const
Definition: JobTypeInfo.h:64
bool special() const
Definition: JobTypeInfo.h:82
JobType const m_type
Definition: JobTypeInfo.h:31
int limit() const
Definition: JobTypeInfo.h:76
std::chrono::milliseconds getAverageLatency() const
Definition: JobTypeInfo.h:88
std::chrono::milliseconds const m_peakLatency
Definition: JobTypeInfo.h:43
std::string const & name() const
Definition: JobTypeInfo.h:70
JobTypeInfo(JobType type, std::string name, int limit, std::chrono::milliseconds avgLatency, std::chrono::milliseconds peakLatency)
Definition: JobTypeInfo.h:49
std::string const m_name
Definition: JobTypeInfo.h:32
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:25
JobType
Definition: Job.h:35
STL namespace.