/Users/deen/code/yugabyte-db/src/yb/common/retryable_request.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) YugaByte, Inc. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
4 | | // in compliance with the License. You may obtain a copy of the License at |
5 | | // |
6 | | // http://www.apache.org/licenses/LICENSE-2.0 |
7 | | // |
8 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
9 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
10 | | // or implied. See the License for the specific language governing permissions and limitations |
11 | | // under the License. |
12 | | // |
13 | | |
14 | | #ifndef YB_COMMON_RETRYABLE_REQUEST_H |
15 | | #define YB_COMMON_RETRYABLE_REQUEST_H |
16 | | |
17 | | #include <float.h> |
18 | | #include <stdint.h> |
19 | | |
20 | | #include <chrono> |
21 | | #include <sstream> |
22 | | #include <string> |
23 | | #include <type_traits> |
24 | | |
25 | | #include <boost/functional/hash/hash.hpp> |
26 | | #include <boost/mpl/and.hpp> |
27 | | #include <boost/optional/optional.hpp> |
28 | | |
29 | | #include "yb/util/format.h" |
30 | | #include "yb/util/status_ec.h" |
31 | | #include "yb/util/strongly_typed_uuid.h" |
32 | | #include "yb/util/tostring.h" |
33 | | #include "yb/util/type_traits.h" |
34 | | |
35 | | namespace yb { |
36 | | |
37 | | YB_STRONGLY_TYPED_UUID(ClientId); |
38 | | typedef int64_t RetryableRequestId; |
39 | | |
40 | | // Special value which is used to initialize starting RetryableRequestId for the client and tablet |
41 | | // based on min running at server side. |
42 | | constexpr RetryableRequestId kInitializeFromMinRunning = -1; |
43 | | |
44 | | struct MinRunningRequestIdTag : IntegralErrorTag<int64_t> { |
45 | | // It is part of the wire protocol and should not be changed once released. |
46 | | static constexpr uint8_t kCategory = 13; |
47 | | |
48 | 0 | static std::string ToMessage(Value value) { |
49 | 0 | return Format("Min running request ID: $0", value); |
50 | 0 | } |
51 | | }; |
52 | | |
53 | | using MinRunningRequestIdStatusData = StatusErrorCodeImpl<MinRunningRequestIdTag>; |
54 | | |
55 | | } // namespace yb |
56 | | |
57 | | #endif // YB_COMMON_RETRYABLE_REQUEST_H |