builder.h 3.6 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.
5 6
//  This source code is also licensed under the GPLv2 license found in the
//  COPYING file in the root directory of this source tree.
J
jorlow@chromium.org 已提交
7 8 9
// 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.
10
#pragma once
11
#include <string>
12
#include <utility>
13 14
#include <vector>
#include "db/table_properties_collector.h"
15
#include "options/cf_options.h"
16
#include "rocksdb/comparator.h"
L
Lei Jin 已提交
17
#include "rocksdb/env.h"
18 19 20
#include "rocksdb/listener.h"
#include "rocksdb/options.h"
#include "rocksdb/status.h"
21
#include "rocksdb/table_properties.h"
22
#include "rocksdb/types.h"
A
Andrew Kryczka 已提交
23
#include "table/scoped_arena_iterator.h"
24
#include "util/event_logger.h"
J
jorlow@chromium.org 已提交
25

26
namespace rocksdb {
J
jorlow@chromium.org 已提交
27 28 29 30 31

struct Options;
struct FileMetaData;

class Env;
32
struct EnvOptions;
J
jorlow@chromium.org 已提交
33 34 35
class Iterator;
class TableCache;
class VersionEdit;
S
Siying Dong 已提交
36
class TableBuilder;
37
class WritableFileWriter;
38
class InternalStats;
S
sdong 已提交
39
class InternalIterator;
S
Siying Dong 已提交
40

41 42 43
// @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.
44 45
// @param compression_dict Data for presetting the compression library's
//    dictionary, or nullptr.
46 47 48 49 50
TableBuilder* NewTableBuilder(
    const ImmutableCFOptions& options,
    const InternalKeyComparator& internal_comparator,
    const std::vector<std::unique_ptr<IntTblPropCollectorFactory>>*
        int_tbl_prop_collector_factories,
51 52
    uint32_t column_family_id, const std::string& column_family_name,
    WritableFileWriter* file, const CompressionType compression_type,
S
Sagar Vemuri 已提交
53
    const CompressionOptions& compression_opts, int level,
54
    const std::string* compression_dict = nullptr,
S
Sagar Vemuri 已提交
55
    const bool skip_filters = false, const uint64_t creation_time = 0);
J
jorlow@chromium.org 已提交
56 57

// Build a Table file from the contents of *iter.  The generated file
58
// will be named according to number specified in meta. On success, the rest of
59 60 61
// *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.
62 63 64
//
// @param column_family_name Name of the column family that is also identified
//    by column_family_id, or empty string if unknown.
65 66
extern Status BuildTable(
    const std::string& dbname, Env* env, const ImmutableCFOptions& options,
A
Aaron Gao 已提交
67
    const MutableCFOptions& mutable_cf_options, const EnvOptions& env_options,
A
Andrew Kryczka 已提交
68
    TableCache* table_cache, InternalIterator* iter,
69
    std::unique_ptr<InternalIterator> range_del_iter, FileMetaData* meta,
S
sdong 已提交
70
    const InternalKeyComparator& internal_comparator,
71 72
    const std::vector<std::unique_ptr<IntTblPropCollectorFactory>>*
        int_tbl_prop_collector_factories,
73 74
    uint32_t column_family_id, const std::string& column_family_name,
    std::vector<SequenceNumber> snapshots,
75
    SequenceNumber earliest_write_conflict_snapshot,
76
    const CompressionType compression,
77
    const CompressionOptions& compression_opts, bool paranoid_file_checks,
78 79
    InternalStats* internal_stats, TableFileCreationReason reason,
    EventLogger* event_logger = nullptr, int job_id = 0,
80
    const Env::IOPriority io_priority = Env::IO_HIGH,
S
Sagar Vemuri 已提交
81 82
    TableProperties* table_properties = nullptr, int level = -1,
    const uint64_t creation_time = 0);
J
jorlow@chromium.org 已提交
83

84
}  // namespace rocksdb