builder.h 3.1 KB
Newer Older
1
//  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2 3 4
//  This source code is licensed under the BSD-style license found in the
//  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.
J
jorlow@chromium.org 已提交
5 6 7
// 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.
8
#pragma once
9
#include <string>
10
#include <utility>
11 12
#include <vector>
#include "db/table_properties_collector.h"
13
#include "rocksdb/comparator.h"
L
Lei Jin 已提交
14
#include "rocksdb/env.h"
15 16
#include "rocksdb/status.h"
#include "rocksdb/types.h"
S
Siying Dong 已提交
17
#include "rocksdb/options.h"
L
Lei Jin 已提交
18
#include "rocksdb/immutable_options.h"
19
#include "rocksdb/table_properties.h"
J
jorlow@chromium.org 已提交
20

21
namespace rocksdb {
J
jorlow@chromium.org 已提交
22 23 24 25 26

struct Options;
struct FileMetaData;

class Env;
27
struct EnvOptions;
J
jorlow@chromium.org 已提交
28 29 30
class Iterator;
class TableCache;
class VersionEdit;
S
Siying Dong 已提交
31
class TableBuilder;
32
class WritableFileWriter;
33
class InternalStats;
S
sdong 已提交
34
class InternalIterator;
S
Siying Dong 已提交
35

36 37 38
// @param column_family_name Name of the column family that is also identified
//    by column_family_id, or empty string if unknown. It must outlive the
//    TableBuilder returned by this function.
39 40
// @param compression_dict Data for presetting the compression library's
//    dictionary, or nullptr.
41 42 43 44 45
TableBuilder* NewTableBuilder(
    const ImmutableCFOptions& options,
    const InternalKeyComparator& internal_comparator,
    const std::vector<std::unique_ptr<IntTblPropCollectorFactory>>*
        int_tbl_prop_collector_factories,
46 47
    uint32_t column_family_id, const std::string& column_family_name,
    WritableFileWriter* file, const CompressionType compression_type,
48
    const CompressionOptions& compression_opts,
49
    const std::string* compression_dict = nullptr,
50
    const bool skip_filters = false);
J
jorlow@chromium.org 已提交
51 52

// Build a Table file from the contents of *iter.  The generated file
53
// will be named according to number specified in meta. On success, the rest of
54 55 56
// *meta will be filled with metadata about the generated table.
// If no data is present in *iter, meta->file_size will be set to
// zero, and no Table file will be produced.
57 58 59
//
// @param column_family_name Name of the column family that is also identified
//    by column_family_id, or empty string if unknown.
60 61
extern Status BuildTable(
    const std::string& dbname, Env* env, const ImmutableCFOptions& options,
S
sdong 已提交
62 63 64
    const EnvOptions& env_options, TableCache* table_cache,
    InternalIterator* iter, FileMetaData* meta,
    const InternalKeyComparator& internal_comparator,
65 66
    const std::vector<std::unique_ptr<IntTblPropCollectorFactory>>*
        int_tbl_prop_collector_factories,
67 68
    uint32_t column_family_id, const std::string& column_family_name,
    std::vector<SequenceNumber> snapshots,
69
    SequenceNumber earliest_write_conflict_snapshot,
70
    const CompressionType compression,
71
    const CompressionOptions& compression_opts, bool paranoid_file_checks,
72
    InternalStats* internal_stats,
73
    const Env::IOPriority io_priority = Env::IO_HIGH,
74
    TableProperties* table_properties = nullptr, int level = -1);
J
jorlow@chromium.org 已提交
75

76
}  // namespace rocksdb