Make "Table" pluggable

Summary: This patch makes Table and TableBuilder a abstract class and make all the implementation of the current table into BlockedBasedTable and BlockedBasedTable Builder.

Test Plan: Make db_test.cc to work with block based table. Add a new test simple_table_db_test.cc where a different simple table format is implemented.

Reviewers: dhruba, haobo, kailiu, emayanke, vamsi

Reviewed By: dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D13521
This commit is contained in:
Siying Dong
2013-10-28 17:54:09 -07:00
parent 8ace6b0f91
commit d4eec30ed0
28 changed files with 1616 additions and 211 deletions

View File

@@ -3,7 +3,6 @@
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
#include "table/table.h"
#include <map>
#include <string>
@@ -15,7 +14,7 @@
#include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "rocksdb/iterator.h"
#include "rocksdb/table_builder.h"
#include "rocksdb/table.h"
#include "table/block.h"
#include "table/block_builder.h"
#include "table/format.h"
@@ -76,7 +75,10 @@ Status SstFileReader::ReadSequential(bool print_kv,
}
uint64_t file_size;
table_options.env->GetFileSize(file_name_, &file_size);
s = Table::Open(table_options, soptions_, std::move(file), file_size, &table);
unique_ptr<TableFactory> table_factory;
s = table_options.table_factory->OpenTable(table_options, soptions_,
std::move(file), file_size,
&table);
if(!s.ok()) {
return s;
}