Coverage Report

Created: 2024-09-08 07:17

/src/rocksdb/db/blob/blob_file_meta.cc
Line
Count
Source (jump to first uncovered line)
1
//  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2
//  This source code is licensed under both the GPLv2 (found in the
3
//  COPYING file in the root directory) and Apache 2.0 License
4
//  (found in the LICENSE.Apache file in the root directory).
5
6
#include "db/blob/blob_file_meta.h"
7
8
#include <ostream>
9
#include <sstream>
10
11
#include "db/blob/blob_log_format.h"
12
#include "rocksdb/slice.h"
13
14
namespace ROCKSDB_NAMESPACE {
15
0
uint64_t SharedBlobFileMetaData::GetBlobFileSize() const {
16
0
  return BlobLogHeader::kSize + total_blob_bytes_ + BlobLogFooter::kSize;
17
0
}
18
19
0
std::string SharedBlobFileMetaData::DebugString() const {
20
0
  std::ostringstream oss;
21
0
  oss << (*this);
22
23
0
  return oss.str();
24
0
}
25
26
std::ostream& operator<<(std::ostream& os,
27
0
                         const SharedBlobFileMetaData& shared_meta) {
28
0
  os << "blob_file_number: " << shared_meta.GetBlobFileNumber()
29
0
     << " total_blob_count: " << shared_meta.GetTotalBlobCount()
30
0
     << " total_blob_bytes: " << shared_meta.GetTotalBlobBytes()
31
0
     << " checksum_method: " << shared_meta.GetChecksumMethod()
32
0
     << " checksum_value: "
33
0
     << Slice(shared_meta.GetChecksumValue()).ToString(/* hex */ true);
34
35
0
  return os;
36
0
}
37
38
0
std::string BlobFileMetaData::DebugString() const {
39
0
  std::ostringstream oss;
40
0
  oss << (*this);
41
42
0
  return oss.str();
43
0
}
44
45
0
std::ostream& operator<<(std::ostream& os, const BlobFileMetaData& meta) {
46
0
  const auto& shared_meta = meta.GetSharedMeta();
47
0
  assert(shared_meta);
48
0
  os << (*shared_meta);
49
50
0
  os << " linked_ssts: {";
51
0
  for (uint64_t file_number : meta.GetLinkedSsts()) {
52
0
    os << ' ' << file_number;
53
0
  }
54
0
  os << " }";
55
56
0
  os << " garbage_blob_count: " << meta.GetGarbageBlobCount()
57
0
     << " garbage_blob_bytes: " << meta.GetGarbageBlobBytes();
58
59
0
  return os;
60
0
}
61
62
}  // namespace ROCKSDB_NAMESPACE