/Users/deen/code/yugabyte-db/src/yb/tablet/operations/truncate_operation.h
Line | Count | Source |
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_TABLET_OPERATIONS_TRUNCATE_OPERATION_H |
15 | | #define YB_TABLET_OPERATIONS_TRUNCATE_OPERATION_H |
16 | | |
17 | | #include <mutex> |
18 | | #include <string> |
19 | | |
20 | | #include "yb/gutil/macros.h" |
21 | | #include "yb/tablet/operations.pb.h" |
22 | | #include "yb/tablet/operations/operation.h" |
23 | | #include "yb/util/locks.h" |
24 | | |
25 | | namespace yb { |
26 | | |
27 | | class Schema; |
28 | | |
29 | | namespace consensus { |
30 | | class Consensus; |
31 | | } |
32 | | |
33 | | namespace tablet { |
34 | | |
35 | | // Operation Context for the Truncate operation. |
36 | | // Keeps track of the Operation states (request, result, ...) |
37 | | // Executes the truncate transaction. |
38 | | class TruncateOperation : public OperationBase<OperationType::kTruncate, TruncatePB> { |
39 | | public: |
40 | | template <class... Args> |
41 | | explicit TruncateOperation(Args&&... args) |
42 | 170k | : OperationBase(std::forward<Args>(args)...) {} yb::tablet::TruncateOperation::TruncateOperation<yb::tablet::Tablet*, yb::tablet::TruncatePB const*>(yb::tablet::Tablet*&&, yb::tablet::TruncatePB const*&&) Line | Count | Source | 42 | 56.8k | : OperationBase(std::forward<Args>(args)...) {} |
Unexecuted instantiation: yb::tablet::TruncateOperation::TruncateOperation<yb::tablet::Tablet*, yb::tablet::TruncatePB*&>(yb::tablet::Tablet*&&, yb::tablet::TruncatePB*&) yb::tablet::TruncateOperation::TruncateOperation<yb::tablet::Tablet*>(yb::tablet::Tablet*&&) Line | Count | Source | 42 | 113k | : OperationBase(std::forward<Args>(args)...) {} |
|
43 | | |
44 | 171k | CHECKED_STATUS Prepare() override { return Status::OK(); } |
45 | | |
46 | | private: |
47 | | // Starts the TruncateOperation by assigning it a timestamp. |
48 | | CHECKED_STATUS DoReplicated(int64_t leader_term, Status* complete_status) override; |
49 | | CHECKED_STATUS DoAborted(const Status& status) override; |
50 | | }; |
51 | | |
52 | | } // namespace tablet |
53 | | } // namespace yb |
54 | | |
55 | | #endif // YB_TABLET_OPERATIONS_TRUNCATE_OPERATION_H |