]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/metadata.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / include / rocksdb / metadata.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
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
16 namespace rocksdb {
17 struct ColumnFamilyMetaData;
18 struct LevelMetaData;
19 struct SstFileMetaData;
20
21 // The metadata that describes a column family.
22 struct ColumnFamilyMetaData {
23 ColumnFamilyMetaData() : size(0), name("") {}
24 ColumnFamilyMetaData(const std::string& _name, uint64_t _size,
25 const std::vector<LevelMetaData>&& _levels) :
26 size(_size), name(_name), levels(_levels) {}
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.
40 struct LevelMetaData {
41 LevelMetaData(int _level, uint64_t _size,
42 const std::vector<SstFileMetaData>&& _files) :
43 level(_level), size(_size),
44 files(_files) {}
45
46 // The level which this meta data describes.
47 const int level;
48 // The size of this level in bytes, which is equal to the sum of
49 // the file size of its "files".
50 const uint64_t size;
51 // The metadata of all sst files in this level.
52 const std::vector<SstFileMetaData> files;
53 };
54
55 // The metadata that describes a SST file.
56 struct SstFileMetaData {
57 SstFileMetaData() {}
58 SstFileMetaData(const std::string& _file_name,
59 const std::string& _path, uint64_t _size,
60 SequenceNumber _smallest_seqno,
61 SequenceNumber _largest_seqno,
62 const std::string& _smallestkey,
63 const std::string& _largestkey,
64 bool _being_compacted) :
65 size(_size), name(_file_name),
66 db_path(_path), smallest_seqno(_smallest_seqno), largest_seqno(_largest_seqno),
67 smallestkey(_smallestkey), largestkey(_largestkey),
68 being_compacted(_being_compacted) {}
69
70 // File size in bytes.
71 uint64_t size;
72 // The name of the file.
73 std::string name;
74 // The full path where the file locates.
75 std::string db_path;
76
77 SequenceNumber smallest_seqno; // Smallest sequence number in file.
78 SequenceNumber largest_seqno; // Largest sequence number in file.
79 std::string smallestkey; // Smallest user defined key in the file.
80 std::string largestkey; // Largest user defined key in the file.
81 bool being_compacted; // true if the file is currently being compacted.
82 };
83
84 // The full set of metadata associated with each SST file.
85 struct LiveFileMetaData : SstFileMetaData {
86 std::string column_family_name; // Name of the column family
87 int level; // Level at which this file resides.
88 };
89
90
91
92 } // namespace rocksdb