]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/db/version_builder.h
add subtree-ish sources for 12.0.3
[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 the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same 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
13 namespace rocksdb {
14
15 class TableCache;
16 class VersionStorageInfo;
17 class VersionEdit;
18 struct FileMetaData;
19 class InternalStats;
20
21 // A helper class so we can efficiently apply a whole sequence
22 // of edits to a particular state without creating intermediate
23 // Versions that contain full copies of the intermediate state.
24 class VersionBuilder {
25 public:
26 VersionBuilder(const EnvOptions& env_options, TableCache* table_cache,
27 VersionStorageInfo* base_vstorage, Logger* info_log = nullptr);
28 ~VersionBuilder();
29 void CheckConsistency(VersionStorageInfo* vstorage);
30 void CheckConsistencyForDeletes(VersionEdit* edit, uint64_t number,
31 int level);
32 void Apply(VersionEdit* edit);
33 void SaveTo(VersionStorageInfo* vstorage);
34 void LoadTableHandlers(InternalStats* internal_stats, int max_threads,
35 bool prefetch_index_and_filter_in_cache);
36 void MaybeAddFile(VersionStorageInfo* vstorage, int level, FileMetaData* f);
37
38 private:
39 class Rep;
40 Rep* rep_;
41 };
42
43 extern bool NewestFirstBySeqNo(FileMetaData* a, FileMetaData* b);
44 } // namespace rocksdb