mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-30 04:41:49 +00:00
05e8854085
Summary: This diff introduces a new Merge operation into rocksdb. The purpose of this review is mostly getting feedback from the team (everyone please) on the design. Please focus on the four files under include/leveldb/, as they spell the client visible interface change. include/leveldb/db.h include/leveldb/merge_operator.h include/leveldb/options.h include/leveldb/write_batch.h Please go over local/my_test.cc carefully, as it is a concerete use case. Please also review the impelmentation files to see if the straw man implementation makes sense. Note that, the diff does pass all make check and truly supports forward iterator over db and a version of Get that's based on iterator. Future work: - Integration with compaction - A raw Get implementation I am working on a wiki that explains the design and implementation choices, but coding comes just naturally and I think it might be a good idea to share the code earlier. The code is heavily commented. Test Plan: run all local tests Reviewers: dhruba, heyongqiang Reviewed By: dhruba CC: leveldb, zshao, sheki, emayanke, MarkCallaghan Differential Revision: https://reviews.facebook.net/D9651
77 lines
2.3 KiB
C++
77 lines
2.3 KiB
C++
// Copyright (c) 2012 Facebook. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef STORAGE_LEVELDB_DB_DB_IMPL_READONLY_H_
|
|
#define STORAGE_LEVELDB_DB_DB_IMPL_READONLY_H_
|
|
|
|
#include "db/db_impl.h"
|
|
|
|
#include <deque>
|
|
#include <set>
|
|
#include "db/dbformat.h"
|
|
#include "db/log_writer.h"
|
|
#include "db/snapshot.h"
|
|
#include "leveldb/db.h"
|
|
#include "leveldb/env.h"
|
|
#include "port/port.h"
|
|
#include "util/stats_logger.h"
|
|
|
|
#ifdef USE_SCRIBE
|
|
#include "scribe/scribe_logger.h"
|
|
#endif
|
|
|
|
namespace leveldb {
|
|
|
|
class DBImplReadOnly : public DBImpl {
|
|
public:
|
|
DBImplReadOnly(const Options& options, const std::string& dbname);
|
|
virtual ~DBImplReadOnly();
|
|
|
|
// Implementations of the DB interface
|
|
virtual Status Get(const ReadOptions& options,
|
|
const Slice& key,
|
|
std::string* value);
|
|
virtual Iterator* NewIterator(const ReadOptions&);
|
|
|
|
virtual Status Put(const WriteOptions&, const Slice& key, const Slice& value) {
|
|
return Status::NotSupported("Not supported operation in read only mode.");
|
|
}
|
|
virtual Status Merge(const WriteOptions&, const Slice& key,
|
|
const Slice& value) {
|
|
return Status::NotSupported("Not supported operation in read only mode.");
|
|
}
|
|
virtual Status Delete(const WriteOptions&, const Slice& key) {
|
|
return Status::NotSupported("Not supported operation in read only mode.");
|
|
}
|
|
virtual Status Write(const WriteOptions& options, WriteBatch* updates) {
|
|
return Status::NotSupported("Not supported operation in read only mode.");
|
|
}
|
|
virtual void CompactRange(const Slice* begin, const Slice* end) {
|
|
}
|
|
virtual Status DisableFileDeletions() {
|
|
return Status::NotSupported("Not supported operation in read only mode.");
|
|
}
|
|
virtual Status EnableFileDeletions() {
|
|
return Status::NotSupported("Not supported operation in read only mode.");
|
|
}
|
|
virtual Status GetLiveFiles(std::vector<std::string>&,
|
|
uint64_t* manifest_file_size) {
|
|
return Status::NotSupported("Not supported operation in read only mode.");
|
|
}
|
|
virtual Status Flush(const FlushOptions& options) {
|
|
return Status::NotSupported("Not supported operation in read only mode.");
|
|
}
|
|
|
|
private:
|
|
friend class DB;
|
|
|
|
// No copying allowed
|
|
DBImplReadOnly(const DBImplReadOnly&);
|
|
void operator=(const DBImplReadOnly&);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|