builder.h 4.3 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
#include <vector>
12
#include "db/range_tombstone_fragmenter.h"
13
#include "db/table_properties_collector.h"
14
#include "logging/event_logger.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"
J
jorlow@chromium.org 已提交
24

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

struct Options;
struct FileMetaData;

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

43 44 45
// @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.
46
TableBuilder* NewTableBuilder(
47
    const ImmutableCFOptions& options, const MutableCFOptions& moptions,
48 49 50
    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,
53
    const uint64_t sample_for_compression,
S
Sagar Vemuri 已提交
54
    const CompressionOptions& compression_opts, int level,
Y
Yi Wu 已提交
55
    const bool skip_filters = false, const uint64_t creation_time = 0,
S
Sagar Vemuri 已提交
56
    const uint64_t oldest_key_time = 0, const uint64_t target_file_size = 0,
57 58
    const uint64_t file_creation_time = 0, const std::string& db_id = "",
    const std::string& db_session_id = "");
J
jorlow@chromium.org 已提交
59 60

// Build a Table file from the contents of *iter.  The generated file
61
// will be named according to number specified in meta. On success, the rest of
62 63 64
// *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.
65 66 67
//
// @param column_family_name Name of the column family that is also identified
//    by column_family_id, or empty string if unknown.
68
extern Status BuildTable(
69 70
    const std::string& dbname, VersionSet* versions,
    const ImmutableDBOptions& db_options, const ImmutableCFOptions& options,
71
    const MutableCFOptions& mutable_cf_options, const FileOptions& file_options,
A
Andrew Kryczka 已提交
72
    TableCache* table_cache, InternalIterator* iter,
73 74
    std::vector<std::unique_ptr<FragmentedRangeTombstoneIterator>>
        range_del_iters,
75 76
    FileMetaData* meta, std::vector<BlobFileAddition>* blob_file_additions,
    const InternalKeyComparator& internal_comparator,
77 78
    const std::vector<std::unique_ptr<IntTblPropCollectorFactory>>*
        int_tbl_prop_collector_factories,
79 80
    uint32_t column_family_id, const std::string& column_family_name,
    std::vector<SequenceNumber> snapshots,
81
    SequenceNumber earliest_write_conflict_snapshot,
Y
Yi Wu 已提交
82
    SnapshotChecker* snapshot_checker, const CompressionType compression,
83
    const uint64_t sample_for_compression,
84
    const CompressionOptions& compression_opts, bool paranoid_file_checks,
85
    InternalStats* internal_stats, TableFileCreationReason reason,
86 87
    IOStatus* io_status, const std::shared_ptr<IOTracer>& io_tracer,
    EventLogger* event_logger = nullptr, int job_id = 0,
88
    const Env::IOPriority io_priority = Env::IO_HIGH,
S
Sagar Vemuri 已提交
89
    TableProperties* table_properties = nullptr, int level = -1,
S
Stream  
Shaohua Li 已提交
90
    const uint64_t creation_time = 0, const uint64_t oldest_key_time = 0,
S
Sagar Vemuri 已提交
91
    Env::WriteLifeTimeHint write_hint = Env::WLTH_NOT_SET,
92
    const uint64_t file_creation_time = 0, const std::string& db_id = "",
93
    const std::string& db_session_id = "",
94 95
    const std::string* full_history_ts_low = nullptr,
    BlobFileCompletionCallback* blob_callback = nullptr);
J
jorlow@chromium.org 已提交
96

97
}  // namespace ROCKSDB_NAMESPACE