1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 // This source code is licensed under both the GPLv2 (found in the 3 // COPYING file in the root directory) and Apache 2.0 License 4 // (found in the LICENSE.Apache file in the root directory). 5 // 6 #pragma once 7 8 #ifndef ROCKSDB_LITE 9 10 namespace ROCKSDB_NAMESPACE { 11 12 namespace blob_db { 13 14 /** 15 * Statistics related to a single garbage collection pass (i.e. a single 16 * (sub)compaction). 17 */ 18 class BlobDBGarbageCollectionStats { 19 public: AllBlobs()20 uint64_t AllBlobs() const { return all_blobs_; } AllBytes()21 uint64_t AllBytes() const { return all_bytes_; } RelocatedBlobs()22 uint64_t RelocatedBlobs() const { return relocated_blobs_; } RelocatedBytes()23 uint64_t RelocatedBytes() const { return relocated_bytes_; } NewFiles()24 uint64_t NewFiles() const { return new_files_; } HasError()25 bool HasError() const { return error_; } 26 AddBlob(uint64_t size)27 void AddBlob(uint64_t size) { 28 ++all_blobs_; 29 all_bytes_ += size; 30 } 31 AddRelocatedBlob(uint64_t size)32 void AddRelocatedBlob(uint64_t size) { 33 ++relocated_blobs_; 34 relocated_bytes_ += size; 35 } 36 AddNewFile()37 void AddNewFile() { ++new_files_; } 38 SetError()39 void SetError() { error_ = true; } 40 41 private: 42 uint64_t all_blobs_ = 0; 43 uint64_t all_bytes_ = 0; 44 uint64_t relocated_blobs_ = 0; 45 uint64_t relocated_bytes_ = 0; 46 uint64_t new_files_ = 0; 47 bool error_ = false; 48 }; 49 50 } // namespace blob_db 51 } // namespace ROCKSDB_NAMESPACE 52 #endif // ROCKSDB_LITE 53