]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/db/version_builder.h
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / rocksdb / db / version_builder.h
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 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file. See the AUTHORS file for names of contributors.
9 //
10 #pragma once
11 #include "rocksdb/env.h"
12 #include "rocksdb/slice_transform.h"
13
14 namespace rocksdb {
15
16 class TableCache;
17 class VersionStorageInfo;
18 class VersionEdit;
19 struct FileMetaData;
20 class InternalStats;
21
22 // A helper class so we can efficiently apply a whole sequence
23 // of edits to a particular state without creating intermediate
24 // Versions that contain full copies of the intermediate state.
25 class VersionBuilder {
26 public:
27 VersionBuilder(const EnvOptions& env_options, TableCache* table_cache,
28 VersionStorageInfo* base_vstorage, Logger* info_log = nullptr);
29 ~VersionBuilder();
30 void CheckConsistency(VersionStorageInfo* vstorage);
31 void CheckConsistencyForDeletes(VersionEdit* edit, uint64_t number,
32 int level);
33 bool CheckConsistencyForNumLevels();
34 void Apply(VersionEdit* edit);
35 void SaveTo(VersionStorageInfo* vstorage);
36 Status LoadTableHandlers(InternalStats* internal_stats, int max_threads,
37 bool prefetch_index_and_filter_in_cache,
38 bool is_initial_load,
39 const SliceTransform* prefix_extractor);
40 void MaybeAddFile(VersionStorageInfo* vstorage, int level, FileMetaData* f);
41
42 private:
43 class Rep;
44 Rep* rep_;
45 };
46
47 extern bool NewestFirstBySeqNo(FileMetaData* a, FileMetaData* b);
48 } // namespace rocksdb