rippled
ripple
core
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 <ripple/core/Job.h>
24
25
namespace
ripple
{
26
28
class
JobTypeInfo
29
{
30
private
:
31
JobType
const
m_type
;
32
std::string
const
m_name
;
33
39
int
const
m_limit
;
40
42
std::chrono::milliseconds
const
m_avgLatency
;
43
std::chrono::milliseconds
const
m_peakLatency
;
44
45
public
:
46
// Not default constructible
47
JobTypeInfo
() =
delete
;
48
49
JobTypeInfo
(
50
JobType
type
,
51
std::string
name
,
52
int
limit
,
53
std::chrono::milliseconds
avgLatency,
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
63
JobType
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
87
std::chrono::milliseconds
88
getAverageLatency
()
const
89
{
90
return
m_avgLatency
;
91
}
92
93
std::chrono::milliseconds
94
getPeakLatency
()
const
95
{
96
return
m_peakLatency
;
97
}
98
};
99
100
}
// namespace ripple
101
102
#endif
std::string
STL class.
ripple::JobTypeInfo::m_type
const JobType m_type
Definition:
JobTypeInfo.h:31
std::chrono::milliseconds
ripple::JobTypeInfo::m_peakLatency
const std::chrono::milliseconds m_peakLatency
Definition:
JobTypeInfo.h:43
ripple::JobTypeInfo::JobTypeInfo
JobTypeInfo(JobType type, std::string name, int limit, std::chrono::milliseconds avgLatency, std::chrono::milliseconds peakLatency)
Definition:
JobTypeInfo.h:49
ripple::JobTypeInfo::limit
int limit() const
Definition:
JobTypeInfo.h:76
ripple::JobTypeInfo::m_limit
const int m_limit
The limit on the number of running jobs for this job type.
Definition:
JobTypeInfo.h:39
ripple::JobTypeInfo::getAverageLatency
std::chrono::milliseconds getAverageLatency() const
Definition:
JobTypeInfo.h:88
ripple::JobTypeInfo::m_name
const std::string m_name
Definition:
JobTypeInfo.h:32
ripple::JobTypeInfo::type
JobType type() const
Definition:
JobTypeInfo.h:64
ripple::JobTypeInfo
Holds all the 'static' information about a job, which does not change.
Definition:
JobTypeInfo.h:28
ripple::JobTypeInfo::name
std::string const & name() const
Definition:
JobTypeInfo.h:70
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition:
RCLCensorshipDetector.h:29
ripple::JobTypeInfo::JobTypeInfo
JobTypeInfo()=delete
std
STL namespace.
ripple::JobType
JobType
Definition:
Job.h:35
ripple::JobTypeInfo::special
bool special() const
Definition:
JobTypeInfo.h:82
ripple::JobTypeInfo::getPeakLatency
std::chrono::milliseconds getPeakLatency() const
Definition:
JobTypeInfo.h:94
ripple::JobTypeInfo::m_avgLatency
const std::chrono::milliseconds m_avgLatency
Average and peak latencies for this job type.
Definition:
JobTypeInfo.h:42
Generated by
1.8.17