--- a/util/channel.h 2022-01-10 03:06:56.580066258 +0800 +++ b/util/channel.h 2022-01-10 03:06:46.337071094 +0800 @@ -60,7 +60,7 @@ private: std::condition_variable cv_; - std::mutex lock_; + mutable std::mutex lock_; std::queue buffer_; bool eof_; }; diff --git a/include/rocksdb/metadata.h b/include/rocksdb/metadata.h --- a/include/rocksdb/metadata.h +++ b/include/rocksdb/metadata.h @@ -15,42 +15,6 @@ namespace rocksdb { struct ColumnFamilyMetaData; -struct LevelMetaData; -struct SstFileMetaData; - -// The metadata that describes a column family. -struct ColumnFamilyMetaData { - ColumnFamilyMetaData() : size(0), file_count(0), name("") {} - ColumnFamilyMetaData(const std::string& _name, uint64_t _size, - const std::vector&& _levels) : - size(_size), name(_name), levels(_levels) {} - - // The size of this column family in bytes, which is equal to the sum of - // the file size of its "levels". - uint64_t size; - // The number of files in this column family. - size_t file_count; - // The name of the column family. - std::string name; - // The metadata of all levels in this column family. - std::vector levels; -}; - -// The metadata that describes a level. -struct LevelMetaData { - LevelMetaData(int _level, uint64_t _size, - const std::vector&& _files) : - level(_level), size(_size), - files(_files) {} - - // The level which this meta data describes. - const int level; - // The size of this level in bytes, which is equal to the sum of - // the file size of its "files". - const uint64_t size; - // The metadata of all sst files in this level. - const std::vector files; -}; // The metadata that describes a SST file. struct SstFileMetaData { @@ -100,4 +64,38 @@ struct LiveFileMetaData : SstFileMetaData { std::string column_family_name; // Name of the column family int level; // Level at which this file resides. }; + +// The metadata that describes a level. +struct LevelMetaData { + LevelMetaData(int _level, uint64_t _size, + const std::vector&& _files) : + level(_level), size(_size), + files(_files) {} + + // The level which this meta data describes. + const int level; + // The size of this level in bytes, which is equal to the sum of + // the file size of its "files". + const uint64_t size; + // The metadata of all sst files in this level. + const std::vector files; +}; + +// The metadata that describes a column family. +struct ColumnFamilyMetaData { + ColumnFamilyMetaData() : size(0), file_count(0), name("") {} + ColumnFamilyMetaData(const std::string& _name, uint64_t _size, + const std::vector&& _levels) : + size(_size), name(_name), levels(_levels) {} + + // The size of this column family in bytes, which is equal to the sum of + // the file size of its "levels". + uint64_t size; + // The number of files in this column family. + size_t file_count; + // The name of the column family. + std::string name; + // The metadata of all levels in this column family. + std::vector levels; +}; } // namespace rocksdb