/Users/deen/code/yugabyte-db/src/yb/tablet/operations/truncate_operation.cc
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 | | #include "yb/tablet/operations/truncate_operation.h" |
15 | | |
16 | | #include <glog/logging.h> |
17 | | |
18 | | #include "yb/consensus/consensus_round.h" |
19 | | #include "yb/consensus/consensus.pb.h" |
20 | | |
21 | | #include "yb/tablet/tablet.h" |
22 | | |
23 | | #include "yb/util/trace.h" |
24 | | |
25 | | namespace yb { |
26 | | namespace tablet { |
27 | | |
28 | | template <> |
29 | | void RequestTraits<TruncatePB>::SetAllocatedRequest( |
30 | 0 | consensus::ReplicateMsg* replicate, TruncatePB* request) { |
31 | 0 | replicate->set_allocated_truncate(request); |
32 | 0 | } |
33 | | |
34 | | template <> |
35 | 212k | TruncatePB* RequestTraits<TruncatePB>::MutableRequest(consensus::ReplicateMsg* replicate) { |
36 | 212k | return replicate->mutable_truncate(); |
37 | 212k | } |
38 | | |
39 | 6 | Status TruncateOperation::DoAborted(const Status& status) { |
40 | 6 | return status; |
41 | 6 | } |
42 | | |
43 | 159k | Status TruncateOperation::DoReplicated(int64_t leader_term, Status* complete_status) { |
44 | 159k | TRACE("APPLY TRUNCATE: started"); |
45 | | |
46 | 159k | RETURN_NOT_OK(tablet()->Truncate(this)); |
47 | | |
48 | 159k | TRACE("APPLY TRUNCATE: finished"); |
49 | | |
50 | 159k | return Status::OK(); |
51 | 159k | } |
52 | | |
53 | | } // namespace tablet |
54 | | } // namespace yb |