/Users/deen/code/yugabyte-db/src/yb/master/snapshot_coordinator_context.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/master/snapshot_coordinator_context.h" |
15 | | |
16 | | #include "yb/common/schema.h" |
17 | | |
18 | | #include "yb/docdb/doc_key.h" |
19 | | #include "yb/docdb/key_bytes.h" |
20 | | #include "yb/docdb/primitive_value.h" |
21 | | |
22 | | #include "yb/master/sys_catalog_constants.h" |
23 | | |
24 | | #include "yb/util/result.h" |
25 | | |
26 | | namespace yb { |
27 | | namespace master { |
28 | | |
29 | | namespace { |
30 | | |
31 | 0 | Result<ColumnId> MetadataColumnId(SnapshotCoordinatorContext* context) { |
32 | 0 | return context->schema().ColumnIdByName(kSysCatalogTableColMetadata); |
33 | 0 | } |
34 | | |
35 | | } // namespace |
36 | | |
37 | | Result<docdb::KeyBytes> EncodedKey( |
38 | 0 | SysRowEntryType type, const Slice& id, SnapshotCoordinatorContext* context) { |
39 | 0 | docdb::DocKey doc_key({ docdb::PrimitiveValue::Int32(type), |
40 | 0 | docdb::PrimitiveValue(id.ToBuffer()) }); |
41 | 0 | docdb::SubDocKey sub_doc_key( |
42 | 0 | doc_key, docdb::PrimitiveValue(VERIFY_RESULT(MetadataColumnId(context)))); |
43 | 0 | return sub_doc_key.Encode(); |
44 | 0 | } |
45 | | |
46 | | } // namespace master |
47 | | } // namespace yb |