| Apache Ignite C++

transaction_metrics.h
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
23 #ifndef _IGNITE_TRANSACTIONS_TRANSACTION_METRICS
24 #define _IGNITE_TRANSACTIONS_TRANSACTION_METRICS
25
26 #include <stdint.h>
27
28 #include <ignite/timestamp.h>
29
30 namespace ignite
31 {
32 namespace transactions
33 {
37 class IGNITE_IMPORT_EXPORT TransactionMetrics
38 {
39 public:
45 TransactionMetrics() :
46 valid(false),
47 commitTime(),
48 rollbackTime(),
49 commits(),
50 rollbacks()
51 {
52 // No-op.
53 }
54
63 TransactionMetrics(const Timestamp& commitTime,
64 const Timestamp& rollbackTime, int32_t commits, int32_t rollbacks) :
65 valid(true),
66 commitTime(commitTime),
67 rollbackTime(rollbackTime),
68 commits(commits),
69 rollbacks(rollbacks)
70 {
71 //No-op.
72 }
73
79 TransactionMetrics(const TransactionMetrics& other) :
80 valid(other.valid),
81 commitTime(other.commitTime),
82 rollbackTime(other.rollbackTime),
83 commits(other.commits),
84 rollbacks(other.rollbacks)
85 {
86 // No-op.
87 }
88
95 TransactionMetrics& operator=(const TransactionMetrics& other)
96 {
97 valid = other.valid;
98 commitTime = other.commitTime;
99 rollbackTime = other.rollbackTime;
100 commits = other.commits;
101 rollbacks = other.rollbacks;
102
103 return *this;
104 }
105
111 const Timestamp& GetCommitTime() const
112 {
113 return commitTime;
114 }
115
121 const Timestamp& GetRollbackTime() const
122 {
123 return rollbackTime;
124 }
125
131 int32_t GetCommits() const
132 {
133 return commits;
134 }
135
141 int32_t GetRollbacks() const
142 {
143 return rollbacks;
144 }
145
157 bool IsValid() const
158 {
159 return valid;
160 }
161
162 private:
164 bool valid;
165
167 Timestamp commitTime;
168
170 Timestamp rollbackTime;
171
173 int32_t commits;
174
176 int32_t rollbacks;
177 };
178 }
179 }
180
181 #endif //_IGNITE_TRANSACTIONS_TRANSACTION_METRICS
ignite::Timestamp
Timestamp type.
Definition: timestamp.h:37
ignite::transactions::TransactionMetrics::GetRollbackTime
const Timestamp & GetRollbackTime() const
Get rollback time.
Definition: transaction_metrics.h:121
ignite::transactions::TransactionMetrics::GetCommits
int32_t GetCommits() const
Get the total number of transaction commits.
Definition: transaction_metrics.h:131
timestamp.h
Declares ignite::Timestamp class.
ignite::transactions::TransactionMetrics::TransactionMetrics
TransactionMetrics(const Timestamp &commitTime, const Timestamp &rollbackTime, int32_t commits, int32_t rollbacks)
Constructor.
Definition: transaction_metrics.h:63
ignite::transactions::TransactionMetrics::TransactionMetrics
TransactionMetrics(const TransactionMetrics &other)
Copy constructor.
Definition: transaction_metrics.h:79
ignite::transactions::TransactionMetrics::GetRollbacks
int32_t GetRollbacks() const
Get the total number of transaction rollbacks.
Definition: transaction_metrics.h:141
ignite::transactions::TransactionMetrics::IsValid
bool IsValid() const
Check wheather the instance is valid.
Definition: transaction_metrics.h:157
ignite::transactions::TransactionMetrics
Transaction metrics, shared across all caches.
Definition: transaction_metrics.h:37
ignite::transactions::TransactionMetrics::TransactionMetrics
TransactionMetrics()
Default constructor.
Definition: transaction_metrics.h:45
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::transactions::TransactionMetrics::GetCommitTime
const Timestamp & GetCommitTime() const
Get commit time.
Definition: transaction_metrics.h:111
ignite::transactions::TransactionMetrics::operator=
TransactionMetrics & operator=(const TransactionMetrics &other)
Assignment operator.
Definition: transaction_metrics.h:95