/Users/deen/code/yugabyte-db/src/yb/tablet/tablet_splitter.h
Line | Count | Source |
1 | | // |
2 | | // Copyright (c) YugaByte, Inc. |
3 | | // |
4 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
5 | | // in compliance with the License. You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
10 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
11 | | // or implied. See the License for the specific language governing permissions and limitations |
12 | | // under the License. |
13 | | // |
14 | | |
15 | | #ifndef YB_TABLET_TABLET_SPLITTER_H |
16 | | #define YB_TABLET_TABLET_SPLITTER_H |
17 | | |
18 | | #include <type_traits> |
19 | | |
20 | | #include "yb/consensus/consensus_fwd.h" |
21 | | #include "yb/consensus/log_fwd.h" |
22 | | |
23 | | #include "yb/tablet/tablet_fwd.h" |
24 | | |
25 | | #include "yb/util/status_fwd.h" |
26 | | |
27 | | namespace yb { |
28 | | namespace tablet { |
29 | | |
30 | | // Interface which provides functionality for applying Raft tablet split operation. |
31 | | // Used by TabletPeer to avoid introducing backward dependency on tserver component. |
32 | | class TabletSplitter { |
33 | | public: |
34 | 6.10k | TabletSplitter() = default; |
35 | | |
36 | | TabletSplitter(const TabletSplitter&) = delete; |
37 | | void operator=(const TabletSplitter&) = delete; |
38 | | |
39 | 112 | virtual ~TabletSplitter() = default; |
40 | | |
41 | | // Implementation should apply tablet split Raft operation. |
42 | | // state is a context of operation to apply. |
43 | | // If raft_log is specified - it will be used as a source tablet Raft log (during tablet bootstrap |
44 | | // tablet peer's Raft consensus is not yet initialized, so we pass raft_log explicitly). |
45 | | virtual CHECKED_STATUS ApplyTabletSplit(SplitOperation* operation, log::Log* raft_log) = 0; |
46 | | }; |
47 | | |
48 | | } // namespace tablet |
49 | | } // namespace yb |
50 | | |
51 | | #endif /* YB_TABLET_TABLET_SPLITTER_H */ |