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).
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.
11 #include "rocksdb/env.h"
12 #include "rocksdb/slice_transform.h"
17 class VersionStorageInfo
;
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
{
27 VersionBuilder(const EnvOptions
& env_options
, TableCache
* table_cache
,
28 VersionStorageInfo
* base_vstorage
, Logger
* info_log
= nullptr);
30 void CheckConsistency(VersionStorageInfo
* vstorage
);
31 void CheckConsistencyForDeletes(VersionEdit
* edit
, uint64_t number
,
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
,
39 const SliceTransform
* prefix_extractor
);
40 void MaybeAddFile(VersionStorageInfo
* vstorage
, int level
, FileMetaData
* f
);
47 extern bool NewestFirstBySeqNo(FileMetaData
* a
, FileMetaData
* b
);
48 } // namespace rocksdb