1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style license that can be
7 // found in the LICENSE file. See the AUTHORS file for names of contributors.
12 #include "db/range_tombstone_fragmenter.h"
13 #include "db/table_properties_collector.h"
14 #include "options/cf_options.h"
15 #include "rocksdb/comparator.h"
16 #include "rocksdb/env.h"
17 #include "rocksdb/listener.h"
18 #include "rocksdb/options.h"
19 #include "rocksdb/status.h"
20 #include "rocksdb/table_properties.h"
21 #include "rocksdb/types.h"
22 #include "table/scoped_arena_iterator.h"
23 #include "util/event_logger.h"
33 class SnapshotChecker
;
37 class WritableFileWriter
;
40 // @param column_family_name Name of the column family that is also identified
41 // by column_family_id, or empty string if unknown. It must outlive the
42 // TableBuilder returned by this function.
43 TableBuilder
* NewTableBuilder(
44 const ImmutableCFOptions
& options
, const MutableCFOptions
& moptions
,
45 const InternalKeyComparator
& internal_comparator
,
46 const std::vector
<std::unique_ptr
<IntTblPropCollectorFactory
>>*
47 int_tbl_prop_collector_factories
,
48 uint32_t column_family_id
, const std::string
& column_family_name
,
49 WritableFileWriter
* file
, const CompressionType compression_type
,
50 const uint64_t sample_for_compression
,
51 const CompressionOptions
& compression_opts
, int level
,
52 const bool skip_filters
= false, const uint64_t creation_time
= 0,
53 const uint64_t oldest_key_time
= 0, const uint64_t target_file_size
= 0);
55 // Build a Table file from the contents of *iter. The generated file
56 // will be named according to number specified in meta. On success, the rest of
57 // *meta will be filled with metadata about the generated table.
58 // If no data is present in *iter, meta->file_size will be set to
59 // zero, and no Table file will be produced.
61 // @param column_family_name Name of the column family that is also identified
62 // by column_family_id, or empty string if unknown.
63 extern Status
BuildTable(
64 const std::string
& dbname
, Env
* env
, const ImmutableCFOptions
& options
,
65 const MutableCFOptions
& mutable_cf_options
, const EnvOptions
& env_options
,
66 TableCache
* table_cache
, InternalIterator
* iter
,
67 std::vector
<std::unique_ptr
<FragmentedRangeTombstoneIterator
>>
69 FileMetaData
* meta
, const InternalKeyComparator
& internal_comparator
,
70 const std::vector
<std::unique_ptr
<IntTblPropCollectorFactory
>>*
71 int_tbl_prop_collector_factories
,
72 uint32_t column_family_id
, const std::string
& column_family_name
,
73 std::vector
<SequenceNumber
> snapshots
,
74 SequenceNumber earliest_write_conflict_snapshot
,
75 SnapshotChecker
* snapshot_checker
, const CompressionType compression
,
76 const uint64_t sample_for_compression
,
77 const CompressionOptions
& compression_opts
, bool paranoid_file_checks
,
78 InternalStats
* internal_stats
, TableFileCreationReason reason
,
79 EventLogger
* event_logger
= nullptr, int job_id
= 0,
80 const Env::IOPriority io_priority
= Env::IO_HIGH
,
81 TableProperties
* table_properties
= nullptr, int level
= -1,
82 const uint64_t creation_time
= 0, const uint64_t oldest_key_time
= 0,
83 Env::WriteLifeTimeHint write_hint
= Env::WLTH_NOT_SET
);
85 } // namespace rocksdb