mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 16:30:56 +00:00
8948dc8524
Summary: The ImmutableCFOptions contained a bunch of fields that belonged to the ImmutableDBOptions. This change cleans that up by introducing an ImmutableOptions struct. Following the pattern of Options struct, this class inherits from the DB and CFOption structs (of the Immutable form). Only one structural change (the ImmutableCFOptions::fs was changed to a shared_ptr from a raw one) is in this PR. All of the other changes involve moving the member variables from the ImmutableCFOptions into the ImmutableOptions and changing member variables or function parameters as required for compilation purposes. Follow-on PRs may do a further clean-up of the code, such as renaming variables (such as "ImmutableOptions cf_options") and potentially eliminating un-needed function parameters (there is no longer a need to pass both an ImmutableDBOptions and an ImmutableOptions to a function). Pull Request resolved: https://github.com/facebook/rocksdb/pull/8262 Reviewed By: pdillinger Differential Revision: D28226540 Pulled By: mrambacher fbshipit-source-id: 18ae71eadc879dedbe38b1eb8e6f9ff5c7147dbf
57 lines
1.8 KiB
C++
57 lines
1.8 KiB
C++
// Copyright (c) 2019-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
#pragma once
|
|
|
|
#include "rocksdb/filter_policy.h"
|
|
#include "table/block_based/block_based_filter_block.h"
|
|
#include "table/block_based/block_based_table_reader.h"
|
|
#include "table/block_based/filter_policy_internal.h"
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
namespace mock {
|
|
|
|
class MockBlockBasedTable : public BlockBasedTable {
|
|
public:
|
|
explicit MockBlockBasedTable(Rep* rep)
|
|
: BlockBasedTable(rep, nullptr /* block_cache_tracer */) {}
|
|
};
|
|
|
|
class MockBlockBasedTableTester {
|
|
static constexpr int kMockLevel = 0;
|
|
|
|
public:
|
|
Options options_;
|
|
ImmutableOptions ioptions_;
|
|
EnvOptions env_options_;
|
|
BlockBasedTableOptions table_options_;
|
|
InternalKeyComparator icomp_;
|
|
std::unique_ptr<BlockBasedTable> table_;
|
|
|
|
MockBlockBasedTableTester(const FilterPolicy *filter_policy)
|
|
: ioptions_(options_),
|
|
env_options_(options_),
|
|
icomp_(options_.comparator) {
|
|
table_options_.filter_policy.reset(filter_policy);
|
|
|
|
constexpr bool skip_filters = false;
|
|
constexpr bool immortal_table = false;
|
|
table_.reset(new MockBlockBasedTable(new BlockBasedTable::Rep(
|
|
ioptions_, env_options_, table_options_, icomp_, skip_filters,
|
|
12345 /*file_size*/, kMockLevel, immortal_table)));
|
|
}
|
|
|
|
FilterBitsBuilder* GetBuilder() const {
|
|
FilterBuildingContext context(table_options_);
|
|
context.column_family_name = "mock_cf";
|
|
context.compaction_style = ioptions_.compaction_style;
|
|
context.level_at_creation = kMockLevel;
|
|
context.info_log = ioptions_.logger;
|
|
return BloomFilterPolicy::GetBuilderFromContext(context);
|
|
}
|
|
};
|
|
|
|
} // namespace mock
|
|
} // namespace ROCKSDB_NAMESPACE
|