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
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
// Copyright (c) 2011-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 <cinttypes>
|
|
|
|
#include "cache/cache_helpers.h"
|
|
#include "rocksdb/rocksdb_namespace.h"
|
|
#include "util/mutexlock.h"
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
|
|
class Cache;
|
|
struct ImmutableOptions;
|
|
struct FileOptions;
|
|
class HistogramImpl;
|
|
class Status;
|
|
class BlobFileReader;
|
|
class Slice;
|
|
class IOTracer;
|
|
|
|
class BlobFileCache {
|
|
public:
|
|
BlobFileCache(Cache* cache, const ImmutableOptions* immutable_options,
|
|
const FileOptions* file_options, uint32_t column_family_id,
|
|
HistogramImpl* blob_file_read_hist,
|
|
const std::shared_ptr<IOTracer>& io_tracer);
|
|
|
|
BlobFileCache(const BlobFileCache&) = delete;
|
|
BlobFileCache& operator=(const BlobFileCache&) = delete;
|
|
|
|
Status GetBlobFileReader(uint64_t blob_file_number,
|
|
CacheHandleGuard<BlobFileReader>* blob_file_reader);
|
|
|
|
private:
|
|
Cache* cache_;
|
|
// Note: mutex_ below is used to guard against multiple threads racing to open
|
|
// the same file.
|
|
Striped<port::Mutex, Slice> mutex_;
|
|
const ImmutableOptions* immutable_cf_options_;
|
|
const FileOptions* file_options_;
|
|
uint32_t column_family_id_;
|
|
HistogramImpl* blob_file_read_hist_;
|
|
std::shared_ptr<IOTracer> io_tracer_;
|
|
|
|
static constexpr size_t kNumberOfMutexStripes = 1 << 7;
|
|
};
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|