fork of https://github.com/oxigraph/rocksdb and https://github.com/facebook/rocksdb for nextgraph and oxigraph
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
4.8 KiB
128 lines
4.8 KiB
9 years ago
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
||
8 years ago
|
// 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).
|
||
12 years ago
|
|
||
11 years ago
|
#pragma once
|
||
10 years ago
|
|
||
|
#ifndef ROCKSDB_LITE
|
||
|
|
||
11 years ago
|
#include <string>
|
||
6 years ago
|
#include <vector>
|
||
6 years ago
|
#include "db/db_impl/db_impl.h"
|
||
12 years ago
|
|
||
11 years ago
|
namespace rocksdb {
|
||
12 years ago
|
|
||
|
class DBImplReadOnly : public DBImpl {
|
||
11 years ago
|
public:
|
||
11 years ago
|
DBImplReadOnly(const DBOptions& options, const std::string& dbname);
|
||
11 years ago
|
virtual ~DBImplReadOnly();
|
||
12 years ago
|
|
||
11 years ago
|
// Implementations of the DB interface
|
||
|
using DB::Get;
|
||
|
virtual Status Get(const ReadOptions& options,
|
||
11 years ago
|
ColumnFamilyHandle* column_family, const Slice& key,
|
||
8 years ago
|
PinnableSlice* value) override;
|
||
12 years ago
|
|
||
11 years ago
|
// TODO: Implement ReadOnly MultiGet?
|
||
12 years ago
|
|
||
11 years ago
|
using DBImpl::NewIterator;
|
||
|
virtual Iterator* NewIterator(const ReadOptions&,
|
||
11 years ago
|
ColumnFamilyHandle* column_family) override;
|
||
12 years ago
|
|
||
11 years ago
|
virtual Status NewIterators(
|
||
|
const ReadOptions& options,
|
||
11 years ago
|
const std::vector<ColumnFamilyHandle*>& column_families,
|
||
11 years ago
|
std::vector<Iterator*>* iterators) override;
|
||
11 years ago
|
|
||
11 years ago
|
using DBImpl::Put;
|
||
7 years ago
|
virtual Status Put(const WriteOptions& /*options*/,
|
||
|
ColumnFamilyHandle* /*column_family*/,
|
||
|
const Slice& /*key*/, const Slice& /*value*/) override {
|
||
11 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
|
using DBImpl::Merge;
|
||
7 years ago
|
virtual Status Merge(const WriteOptions& /*options*/,
|
||
|
ColumnFamilyHandle* /*column_family*/,
|
||
|
const Slice& /*key*/, const Slice& /*value*/) override {
|
||
11 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
|
using DBImpl::Delete;
|
||
7 years ago
|
virtual Status Delete(const WriteOptions& /*options*/,
|
||
|
ColumnFamilyHandle* /*column_family*/,
|
||
|
const Slice& /*key*/) override {
|
||
11 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
9 years ago
|
using DBImpl::SingleDelete;
|
||
7 years ago
|
virtual Status SingleDelete(const WriteOptions& /*options*/,
|
||
|
ColumnFamilyHandle* /*column_family*/,
|
||
|
const Slice& /*key*/) override {
|
||
9 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
7 years ago
|
virtual Status Write(const WriteOptions& /*options*/,
|
||
|
WriteBatch* /*updates*/) override {
|
||
11 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
|
using DBImpl::CompactRange;
|
||
7 years ago
|
virtual Status CompactRange(const CompactRangeOptions& /*options*/,
|
||
|
ColumnFamilyHandle* /*column_family*/,
|
||
|
const Slice* /*begin*/,
|
||
|
const Slice* /*end*/) override {
|
||
11 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
10 years ago
|
|
||
10 years ago
|
using DBImpl::CompactFiles;
|
||
|
virtual Status CompactFiles(
|
||
7 years ago
|
const CompactionOptions& /*compact_options*/,
|
||
|
ColumnFamilyHandle* /*column_family*/,
|
||
|
const std::vector<std::string>& /*input_file_names*/,
|
||
7 years ago
|
const int /*output_level*/, const int /*output_path_id*/ = -1,
|
||
6 years ago
|
std::vector<std::string>* const /*output_file_names*/ = nullptr,
|
||
|
CompactionJobInfo* /*compaction_job_info*/ = nullptr) override {
|
||
10 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
|
|
||
11 years ago
|
virtual Status DisableFileDeletions() override {
|
||
11 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
10 years ago
|
|
||
7 years ago
|
virtual Status EnableFileDeletions(bool /*force*/) override {
|
||
11 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
6 years ago
|
virtual Status GetLiveFiles(std::vector<std::string>& ret,
|
||
|
uint64_t* manifest_file_size,
|
||
|
bool /*flush_memtable*/) override {
|
||
|
return DBImpl::GetLiveFiles(ret, manifest_file_size,
|
||
|
false /* flush_memtable */);
|
||
11 years ago
|
}
|
||
10 years ago
|
|
||
11 years ago
|
using DBImpl::Flush;
|
||
7 years ago
|
virtual Status Flush(const FlushOptions& /*options*/,
|
||
|
ColumnFamilyHandle* /*column_family*/) override {
|
||
11 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
12 years ago
|
|
||
9 years ago
|
using DBImpl::SyncWAL;
|
||
|
virtual Status SyncWAL() override {
|
||
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
|
|
||
8 years ago
|
using DB::IngestExternalFile;
|
||
|
virtual Status IngestExternalFile(
|
||
7 years ago
|
ColumnFamilyHandle* /*column_family*/,
|
||
|
const std::vector<std::string>& /*external_files*/,
|
||
|
const IngestExternalFileOptions& /*ingestion_options*/) override {
|
||
8 years ago
|
return Status::NotSupported("Not supported operation in read only mode.");
|
||
|
}
|
||
|
|
||
11 years ago
|
private:
|
||
|
friend class DB;
|
||
12 years ago
|
|
||
11 years ago
|
// No copying allowed
|
||
|
DBImplReadOnly(const DBImplReadOnly&);
|
||
|
void operator=(const DBImplReadOnly&);
|
||
12 years ago
|
};
|
||
6 years ago
|
} // namespace rocksdb
|
||
10 years ago
|
|
||
|
#endif // !ROCKSDB_LITE
|