2013-10-29 03:34:02 +00:00
|
|
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
|
2014-04-15 20:39:26 +00:00
|
|
|
#ifndef ROCKSDB_LITE
|
2014-01-28 05:58:46 +00:00
|
|
|
#include "table/plain_table_factory.h"
|
2013-10-29 03:34:02 +00:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <stdint.h>
|
2014-01-27 21:53:22 +00:00
|
|
|
#include "db/dbformat.h"
|
2013-10-29 03:34:02 +00:00
|
|
|
#include "table/plain_table_builder.h"
|
|
|
|
#include "table/plain_table_reader.h"
|
|
|
|
#include "port/port.h"
|
|
|
|
|
|
|
|
namespace rocksdb {
|
|
|
|
|
2014-01-28 05:58:46 +00:00
|
|
|
Status PlainTableFactory::NewTableReader(const Options& options,
|
2013-10-29 03:34:02 +00:00
|
|
|
const EnvOptions& soptions,
|
2014-01-27 21:53:22 +00:00
|
|
|
const InternalKeyComparator& icomp,
|
2014-01-28 05:58:46 +00:00
|
|
|
unique_ptr<RandomAccessFile>&& file,
|
2013-10-29 03:34:02 +00:00
|
|
|
uint64_t file_size,
|
2014-01-28 05:58:46 +00:00
|
|
|
unique_ptr<TableReader>* table) const {
|
2014-01-27 21:53:22 +00:00
|
|
|
return PlainTableReader::Open(options, soptions, icomp, std::move(file),
|
|
|
|
file_size, table, bloom_bits_per_key_,
|
2014-02-08 00:25:38 +00:00
|
|
|
hash_table_ratio_, index_sparseness_);
|
2013-10-29 03:34:02 +00:00
|
|
|
}
|
|
|
|
|
2014-01-28 05:58:46 +00:00
|
|
|
TableBuilder* PlainTableFactory::NewTableBuilder(
|
2014-01-27 21:53:22 +00:00
|
|
|
const Options& options, const InternalKeyComparator& internal_comparator,
|
|
|
|
WritableFile* file, CompressionType compression_type) const {
|
2013-12-20 17:35:24 +00:00
|
|
|
return new PlainTableBuilder(options, file, user_key_len_);
|
2013-10-29 03:34:02 +00:00
|
|
|
}
|
2014-01-28 05:58:46 +00:00
|
|
|
|
|
|
|
extern TableFactory* NewPlainTableFactory(uint32_t user_key_len,
|
|
|
|
int bloom_bits_per_key,
|
2014-02-08 00:25:38 +00:00
|
|
|
double hash_table_ratio,
|
|
|
|
size_t index_sparseness) {
|
2014-01-28 05:58:46 +00:00
|
|
|
return new PlainTableFactory(user_key_len, bloom_bits_per_key,
|
2014-02-08 00:25:38 +00:00
|
|
|
hash_table_ratio, index_sparseness);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern TableFactory* NewTotalOrderPlainTableFactory(uint32_t user_key_len,
|
|
|
|
int bloom_bits_per_key,
|
|
|
|
size_t index_sparseness) {
|
|
|
|
return new PlainTableFactory(user_key_len, bloom_bits_per_key, 0,
|
|
|
|
index_sparseness);
|
2014-01-28 05:58:46 +00:00
|
|
|
}
|
|
|
|
|
2013-10-29 03:34:02 +00:00
|
|
|
} // namespace rocksdb
|
2014-04-15 20:39:26 +00:00
|
|
|
#endif // ROCKSDB_LITE
|