/Users/deen/code/yugabyte-db/src/yb/master/restoration_state.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_MASTER_RESTORATION_STATE_H |
15 | | #define YB_MASTER_RESTORATION_STATE_H |
16 | | |
17 | | #include "yb/common/hybrid_time.h" |
18 | | #include "yb/common/snapshot.h" |
19 | | |
20 | | #include "yb/master/state_with_tablets.h" |
21 | | |
22 | | namespace yb { |
23 | | namespace master { |
24 | | |
25 | | class RestorationState : public StateWithTablets { |
26 | | public: |
27 | | RestorationState( |
28 | | SnapshotCoordinatorContext* context, const TxnSnapshotRestorationId& restoration_id, |
29 | | SnapshotState* snapshot); |
30 | | |
31 | 64 | const TxnSnapshotRestorationId& restoration_id() const { |
32 | 64 | return restoration_id_; |
33 | 64 | } |
34 | | |
35 | 0 | const TxnSnapshotId& snapshot_id() const { |
36 | 0 | return snapshot_id_; |
37 | 0 | } |
38 | | |
39 | 43 | HybridTime complete_time() const { |
40 | 43 | return complete_time_; |
41 | 43 | } |
42 | | |
43 | 6 | const SnapshotScheduleId& schedule_id() const { |
44 | 6 | return schedule_id_; |
45 | 6 | } |
46 | | |
47 | 3 | void set_complete_time(HybridTime value) { |
48 | 3 | complete_time_ = value; |
49 | 3 | } |
50 | | |
51 | | CHECKED_STATUS ToPB(RestorationInfoPB* out); |
52 | | |
53 | | TabletInfos PrepareOperations(); |
54 | | |
55 | | private: |
56 | | bool IsTerminalFailure(const Status& status) override; |
57 | | |
58 | | const TxnSnapshotRestorationId restoration_id_; |
59 | | const TxnSnapshotId snapshot_id_; |
60 | | const SnapshotScheduleId schedule_id_; |
61 | | HybridTime complete_time_; |
62 | | }; |
63 | | |
64 | | } // namespace master |
65 | | } // namespace yb |
66 | | |
67 | | #endif // YB_MASTER_RESTORATION_STATE_H |