compaction_state.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) Meta Platforms, Inc. and affiliates.
  2. //
  3. // This source code is licensed under both the GPLv2 (found in the
  4. // COPYING file in the root directory) and Apache 2.0 License
  5. // (found in the LICENSE.Apache file in the root directory).
  6. //
  7. // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
  8. // Use of this source code is governed by a BSD-style license that can be
  9. // found in the LICENSE file. See the AUTHORS file for names of contributors.
  10. #pragma once
  11. #include "db/compaction/compaction.h"
  12. #include "db/compaction/subcompaction_state.h"
  13. #include "db/internal_stats.h"
  14. // Data structures used for compaction_job and compaction_service_job which has
  15. // the list of sub_compact_states and the aggregated information for the
  16. // compaction.
  17. namespace ROCKSDB_NAMESPACE {
  18. // Maintains state for the entire compaction
  19. class CompactionState {
  20. public:
  21. Compaction* const compaction;
  22. // REQUIRED: subcompaction states are stored in order of increasing key-range
  23. std::vector<SubcompactionState> sub_compact_states;
  24. Status status;
  25. void AggregateCompactionStats(
  26. InternalStats::CompactionStatsFull& internal_stats,
  27. CompactionJobStats& job_stats);
  28. explicit CompactionState(Compaction* c) : compaction(c) {}
  29. Slice SmallestUserKey();
  30. Slice LargestUserKey();
  31. };
  32. } // namespace ROCKSDB_NAMESPACE