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.
14 #include "rocksdb/types.h"
17 struct ColumnFamilyMetaData
;
19 struct SstFileMetaData
;
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
) {}
28 // The size of this column family in bytes, which is equal to the sum of
29 // the file size of its "levels".
31 // The number of files in this column family.
33 // The name of the column family.
35 // The metadata of all levels in this column family.
36 std::vector
<LevelMetaData
> levels
;
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
),
46 // The level which this meta data describes.
48 // The size of this level in bytes, which is equal to the sum of
49 // the file size of its "files".
51 // The metadata of all sst files in this level.
52 const std::vector
<SstFileMetaData
> files
;
55 // The metadata that describes a SST file.
56 struct 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
) {}
70 // File size in bytes.
72 // The name of the file.
74 // The full path where the file locates.
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.
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.
92 } // namespace rocksdb