YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/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
79
Result<ColumnId> MetadataColumnId(SnapshotCoordinatorContext* context) {
32
79
  return context->schema().ColumnIdByName(kSysCatalogTableColMetadata);
33
79
}
34
35
} // namespace
36
37
Result<docdb::KeyBytes> EncodedKey(
38
79
    SysRowEntryType type, const Slice& id, SnapshotCoordinatorContext* context) {
39
79
  docdb::DocKey doc_key({ docdb::PrimitiveValue::Int32(type),
40
79
                          docdb::PrimitiveValue(id.ToBuffer()) });
41
79
  docdb::SubDocKey sub_doc_key(
42
79
      doc_key, docdb::PrimitiveValue(VERIFY_RESULT(MetadataColumnId(context))));
43
0
  return sub_doc_key.Encode();
44
79
}
45
46
} // namespace master
47
} // namespace yb