rippled
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 
29 {
30 private:
31  JobType const m_type;
33 
35  int const m_limit;
36 
38  bool const m_special;
39 
43 
44 public:
45  // Not default constructible
46  JobTypeInfo() = delete;
47 
49  JobType type,
51  int limit,
52  bool special,
53  std::chrono::milliseconds avgLatency,
54  std::chrono::milliseconds peakLatency)
55  : m_type(type)
56  , m_name(std::move(name))
57  , m_limit(limit)
59  , m_avgLatency(avgLatency)
60  , m_peakLatency(peakLatency)
61  {
62  }
63 
64  JobType
65  type() const
66  {
67  return m_type;
68  }
69 
70  std::string const&
71  name() const
72  {
73  return m_name;
74  }
75 
76  int
77  limit() const
78  {
79  return m_limit;
80  }
81 
82  bool
83  special() const
84  {
85  return m_special;
86  }
87 
90  {
91  return m_avgLatency;
92  }
93 
96  {
97  return m_peakLatency;
98  }
99 };
100 
101 } // namespace ripple
102 
103 #endif
std::string
STL class.
ripple::JobTypeInfo::JobTypeInfo
JobTypeInfo(JobType type, std::string name, int limit, bool special, std::chrono::milliseconds avgLatency, std::chrono::milliseconds peakLatency)
Definition: JobTypeInfo.h:48
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:42
ripple::JobTypeInfo::limit
int limit() const
Definition: JobTypeInfo.h:77
ripple::JobTypeInfo::m_special
const bool m_special
Special jobs are not dispatched via the job queue.
Definition: JobTypeInfo.h:38
ripple::JobTypeInfo::m_limit
const int m_limit
The limit on the number of running jobs for this job type.
Definition: JobTypeInfo.h:35
ripple::JobTypeInfo::getAverageLatency
std::chrono::milliseconds getAverageLatency() const
Definition: JobTypeInfo.h:89
ripple::JobTypeInfo::m_name
const std::string m_name
Definition: JobTypeInfo.h:32
ripple::JobTypeInfo::type
JobType type() const
Definition: JobTypeInfo.h:65
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:71
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:33
ripple::JobTypeInfo::special
bool special() const
Definition: JobTypeInfo.h:83
ripple::JobTypeInfo::getPeakLatency
std::chrono::milliseconds getPeakLatency() const
Definition: JobTypeInfo.h:95
ripple::JobTypeInfo::m_avgLatency
const std::chrono::milliseconds m_avgLatency
Average and peak latencies for this job type.
Definition: JobTypeInfo.h:41