]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/include/rocksdb/metadata.h
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / rocksdb / include / rocksdb / metadata.h
CommitLineData
7c673cae 1// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
11fdf7f2
TL
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).
7c673cae
FG
5
6#pragma once
7
8#include <stdint.h>
9
10#include <limits>
11#include <string>
12#include <vector>
13
14#include "rocksdb/types.h"
15
16namespace rocksdb {
17struct ColumnFamilyMetaData;
18struct LevelMetaData;
19struct SstFileMetaData;
20
21// The metadata that describes a column family.
22struct ColumnFamilyMetaData {
11fdf7f2 23 ColumnFamilyMetaData() : size(0), file_count(0), name("") {}
7c673cae 24 ColumnFamilyMetaData(const std::string& _name, uint64_t _size,
494da23a
TL
25 const std::vector<LevelMetaData>&& _levels)
26 : size(_size), name(_name), levels(_levels) {}
7c673cae
FG
27
28 // The size of this column family in bytes, which is equal to the sum of
29 // the file size of its "levels".
30 uint64_t size;
31 // The number of files in this column family.
32 size_t file_count;
33 // The name of the column family.
34 std::string name;
35 // The metadata of all levels in this column family.
36 std::vector<LevelMetaData> levels;
37};
38
39// The metadata that describes a level.
40struct LevelMetaData {
41 LevelMetaData(int _level, uint64_t _size,
494da23a
TL
42 const std::vector<SstFileMetaData>&& _files)
43 : level(_level), size(_size), files(_files) {}
7c673cae
FG
44
45 // The level which this meta data describes.
46 const int level;
47 // The size of this level in bytes, which is equal to the sum of
48 // the file size of its "files".
49 const uint64_t size;
50 // The metadata of all sst files in this level.
51 const std::vector<SstFileMetaData> files;
52};
53
54// The metadata that describes a SST file.
55struct SstFileMetaData {
11fdf7f2
TL
56 SstFileMetaData()
57 : size(0),
58 name(""),
59 db_path(""),
60 smallest_seqno(0),
61 largest_seqno(0),
62 smallestkey(""),
63 largestkey(""),
64 num_reads_sampled(0),
494da23a
TL
65 being_compacted(false),
66 num_entries(0),
67 num_deletions(0) {}
68
11fdf7f2
TL
69 SstFileMetaData(const std::string& _file_name, const std::string& _path,
70 size_t _size, SequenceNumber _smallest_seqno,
7c673cae
FG
71 SequenceNumber _largest_seqno,
72 const std::string& _smallestkey,
11fdf7f2
TL
73 const std::string& _largestkey, uint64_t _num_reads_sampled,
74 bool _being_compacted)
75 : size(_size),
76 name(_file_name),
77 db_path(_path),
78 smallest_seqno(_smallest_seqno),
79 largest_seqno(_largest_seqno),
80 smallestkey(_smallestkey),
81 largestkey(_largestkey),
82 num_reads_sampled(_num_reads_sampled),
494da23a
TL
83 being_compacted(_being_compacted),
84 num_entries(0),
85 num_deletions(0) {}
7c673cae
FG
86
87 // File size in bytes.
11fdf7f2 88 size_t size;
7c673cae
FG
89 // The name of the file.
90 std::string name;
91 // The full path where the file locates.
92 std::string db_path;
93
94 SequenceNumber smallest_seqno; // Smallest sequence number in file.
95 SequenceNumber largest_seqno; // Largest sequence number in file.
494da23a
TL
96 std::string smallestkey; // Smallest user defined key in the file.
97 std::string largestkey; // Largest user defined key in the file.
98 uint64_t num_reads_sampled; // How many times the file is read.
7c673cae 99 bool being_compacted; // true if the file is currently being compacted.
494da23a
TL
100
101 uint64_t num_entries;
102 uint64_t num_deletions;
7c673cae
FG
103};
104
105// The full set of metadata associated with each SST file.
106struct LiveFileMetaData : SstFileMetaData {
107 std::string column_family_name; // Name of the column family
494da23a
TL
108 int level; // Level at which this file resides.
109 LiveFileMetaData() : column_family_name(), level(0) {}
7c673cae 110};
7c673cae 111} // namespace rocksdb