builder.h 3.5 KB
Newer Older
1
//  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
S
Siying Dong 已提交
2 3 4
//  This source code is licensed under both the GPLv2 (found in the
//  COPYING file in the root directory) and Apache 2.0 License
//  (found in the LICENSE.Apache file in the root 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 "options/cf_options.h"
14
#include "rocksdb/comparator.h"
L
Lei Jin 已提交
15
#include "rocksdb/env.h"
16 17 18
#include "rocksdb/listener.h"
#include "rocksdb/options.h"
#include "rocksdb/status.h"
19
#include "rocksdb/table_properties.h"
20
#include "rocksdb/types.h"
A
Andrew Kryczka 已提交
21
#include "table/scoped_arena_iterator.h"
22
#include "util/event_logger.h"
J
jorlow@chromium.org 已提交
23

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

struct Options;
struct FileMetaData;

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

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

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

83
}  // namespace rocksdb