]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
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 | ||
1e59de90 TL |
8 | #include <cstdint> |
9 | ||
10 | #include "rocksdb/rocksdb_namespace.h" | |
11 | ||
f67539c2 TL |
12 | #ifndef ROCKSDB_LITE |
13 | ||
14 | namespace ROCKSDB_NAMESPACE { | |
15 | ||
16 | namespace blob_db { | |
17 | ||
18 | /** | |
19 | * Statistics related to a single garbage collection pass (i.e. a single | |
20 | * (sub)compaction). | |
21 | */ | |
22 | class BlobDBGarbageCollectionStats { | |
23 | public: | |
24 | uint64_t AllBlobs() const { return all_blobs_; } | |
25 | uint64_t AllBytes() const { return all_bytes_; } | |
26 | uint64_t RelocatedBlobs() const { return relocated_blobs_; } | |
27 | uint64_t RelocatedBytes() const { return relocated_bytes_; } | |
28 | uint64_t NewFiles() const { return new_files_; } | |
29 | bool HasError() const { return error_; } | |
30 | ||
31 | void AddBlob(uint64_t size) { | |
32 | ++all_blobs_; | |
33 | all_bytes_ += size; | |
34 | } | |
35 | ||
36 | void AddRelocatedBlob(uint64_t size) { | |
37 | ++relocated_blobs_; | |
38 | relocated_bytes_ += size; | |
39 | } | |
40 | ||
41 | void AddNewFile() { ++new_files_; } | |
42 | ||
43 | void SetError() { error_ = true; } | |
44 | ||
45 | private: | |
46 | uint64_t all_blobs_ = 0; | |
47 | uint64_t all_bytes_ = 0; | |
48 | uint64_t relocated_blobs_ = 0; | |
49 | uint64_t relocated_bytes_ = 0; | |
50 | uint64_t new_files_ = 0; | |
51 | bool error_ = false; | |
52 | }; | |
53 | ||
54 | } // namespace blob_db | |
55 | } // namespace ROCKSDB_NAMESPACE | |
56 | #endif // ROCKSDB_LITE |