Add comments in compaction_picker.h

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/5357

Differential Revision: D15522825

Pulled By: siying

fbshipit-source-id: d775386b9d10c7179f5d3af2c821ed213abfacdf
main
Siying Dong 6 years ago committed by Facebook Github Bot
parent b5e4ee2e76
commit 4d0c3b1f96
  1. 20
      db/compaction_picker.h

@ -24,11 +24,26 @@
namespace rocksdb { namespace rocksdb {
// The file contains an abstract class CompactionPicker, and its two
// sub-classes LevelCompactionPicker and NullCompactionPicker, as
// well as some helper functions used by them.
class LogBuffer; class LogBuffer;
class Compaction; class Compaction;
class VersionStorageInfo; class VersionStorageInfo;
struct CompactionInputFiles; struct CompactionInputFiles;
// An abstract class to pick compactions from an existing LSM-tree.
//
// Each compaction style inherits the class and implement the
// interface to form automatic compactions. If NeedCompaction() is true,
// then call PickCompaction() to find what files need to be compacted
// and where to put the output files.
//
// Non-virtual functions CompactRange() and CompactFiles() are used to
// pick files to compact based on users' DB::CompactRange() and
// DB::CompactFiles() requests, respectively. There is little
// compaction style specific logic for them.
class CompactionPicker { class CompactionPicker {
public: public:
CompactionPicker(const ImmutableCFOptions& ioptions, CompactionPicker(const ImmutableCFOptions& ioptions,
@ -221,6 +236,9 @@ class CompactionPicker {
const InternalKeyComparator* const icmp_; const InternalKeyComparator* const icmp_;
}; };
// Picking compactions for leveled compaction. See wiki page
// https://github.com/facebook/rocksdb/wiki/Leveled-Compaction
// for description of Leveled compaction.
class LevelCompactionPicker : public CompactionPicker { class LevelCompactionPicker : public CompactionPicker {
public: public:
LevelCompactionPicker(const ImmutableCFOptions& ioptions, LevelCompactionPicker(const ImmutableCFOptions& ioptions,
@ -236,6 +254,8 @@ class LevelCompactionPicker : public CompactionPicker {
}; };
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
// A dummy compaction that never triggers any automatic
// compaction.
class NullCompactionPicker : public CompactionPicker { class NullCompactionPicker : public CompactionPicker {
public: public:
NullCompactionPicker(const ImmutableCFOptions& ioptions, NullCompactionPicker(const ImmutableCFOptions& ioptions,

Loading…
Cancel
Save