/Users/deen/code/yugabyte-db/src/yb/rocksdb/db/metadata.cc
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 | | #include "yb/rocksdb/metadata.h" |
15 | | |
16 | | #include "yb/util/format.h" |
17 | | |
18 | | namespace rocksdb { |
19 | | |
20 | 928 | std::string FileBoundaryValuesBase::ToString() const { |
21 | 928 | return yb::Format("{ seqno: $0 user_frontier: $1 }", seqno, user_frontier); |
22 | 928 | } |
23 | | |
24 | 320M | void UserFrontier::Update(const UserFrontier* rhs, UpdateUserValueType type, UserFrontierPtr* out) { |
25 | 320M | if (!rhs) { |
26 | 317M | return; |
27 | 317M | } |
28 | 2.44M | if (*out) { |
29 | 4.46k | (**out).Update(*rhs, type); |
30 | 2.43M | } else { |
31 | 2.43M | *out = rhs->Clone(); |
32 | 2.43M | } |
33 | 2.44M | } |
34 | | |
35 | 16 | bool UserFrontier::Dominates(const UserFrontier& rhs, UpdateUserValueType update_type) const { |
36 | | // Check that this value, if updated with the given rhs, stays the same, and hence "dominates" it. |
37 | 16 | std::unique_ptr<UserFrontier> copy = Clone(); |
38 | 16 | copy->Update(rhs, update_type); |
39 | 16 | return Equals(*copy); |
40 | 16 | } |
41 | | |
42 | | void UpdateUserFrontier(UserFrontierPtr* value, const UserFrontierPtr& update, |
43 | 11.4k | UpdateUserValueType type) { |
44 | 11.4k | if (*value) { |
45 | 6.15k | (**value).Update(*update, type); |
46 | 6.15k | } else { |
47 | 5.28k | *value = update; |
48 | 5.28k | } |
49 | 11.4k | } |
50 | | |
51 | | void UpdateUserFrontier(UserFrontierPtr* value, UserFrontierPtr&& update, |
52 | 554k | UpdateUserValueType type) { |
53 | 554k | if (*value) { |
54 | 15.6k | (**value).Update(*update, type); |
55 | 539k | } else { |
56 | 539k | *value = std::move(update); |
57 | 539k | } |
58 | 554k | } |
59 | | |
60 | 14 | std::string UserFrontiers::ToString() const { |
61 | 14 | return ::yb::Format("{ smallest: $0 largest: $1 }", Smallest(), Largest()); |
62 | 14 | } |
63 | | |
64 | 236 | std::string LiveFileMetaData::ToString() const { |
65 | 236 | return YB_STRUCT_TO_STRING( |
66 | 236 | total_size, base_size, uncompressed_size, name, db_path, imported, |
67 | 236 | being_compacted, column_family_name, level, smallest, largest); |
68 | 236 | } |
69 | | |
70 | | } // namespace rocksdb |