builder.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.
  8. #pragma once
  9. #include <string>
  10. #include <utility>
  11. #include <vector>
  12. #include "db/internal_stats.h"
  13. #include "db/range_tombstone_fragmenter.h"
  14. #include "db/seqno_to_time_mapping.h"
  15. #include "db/table_properties_collector.h"
  16. #include "db/version_set.h"
  17. #include "logging/event_logger.h"
  18. #include "options/cf_options.h"
  19. #include "rocksdb/comparator.h"
  20. #include "rocksdb/env.h"
  21. #include "rocksdb/listener.h"
  22. #include "rocksdb/options.h"
  23. #include "rocksdb/status.h"
  24. #include "rocksdb/table_properties.h"
  25. #include "rocksdb/types.h"
  26. namespace ROCKSDB_NAMESPACE {
  27. struct FileMetaData;
  28. class VersionSet;
  29. class BlobFileAddition;
  30. class SnapshotChecker;
  31. class TableCache;
  32. class TableBuilder;
  33. class WritableFileWriter;
  34. class BlobFileCompletionCallback;
  35. // Convenience function for NewTableBuilder on the embedded table_factory.
  36. TableBuilder* NewTableBuilder(const TableBuilderOptions& tboptions,
  37. WritableFileWriter* file);
  38. // Build a Table file from the contents of *iter. The generated file
  39. // will be named according to number specified in meta. On success, the rest of
  40. // *meta will be filled with metadata about the generated table.
  41. // If no data is present in *iter, meta->file_size will be set to
  42. // zero, and no Table file will be produced.
  43. //
  44. // @param column_family_name Name of the column family that is also identified
  45. // by column_family_id, or empty string if unknown.
  46. // @param flush_stats treat flush as level 0 compaction in internal stats
  47. Status BuildTable(
  48. const std::string& dbname, VersionSet* versions,
  49. const ImmutableDBOptions& db_options, const TableBuilderOptions& tboptions,
  50. const FileOptions& file_options, TableCache* table_cache,
  51. InternalIterator* iter,
  52. std::vector<std::unique_ptr<FragmentedRangeTombstoneIterator>>
  53. range_del_iters,
  54. FileMetaData* meta, std::vector<BlobFileAddition>* blob_file_additions,
  55. std::vector<SequenceNumber> snapshots, SequenceNumber earliest_snapshot,
  56. SequenceNumber earliest_write_conflict_snapshot,
  57. SequenceNumber job_snapshot, SnapshotChecker* snapshot_checker,
  58. bool paranoid_file_checks, InternalStats* internal_stats,
  59. IOStatus* io_status, const std::shared_ptr<IOTracer>& io_tracer,
  60. BlobFileCreationReason blob_creation_reason,
  61. UnownedPtr<const SeqnoToTimeMapping> seqno_to_time_mapping,
  62. EventLogger* event_logger = nullptr, int job_id = 0,
  63. TableProperties* table_properties = nullptr,
  64. Env::WriteLifeTimeHint write_hint = Env::WLTH_NOT_SET,
  65. const std::string* full_history_ts_low = nullptr,
  66. BlobFileCompletionCallback* blob_callback = nullptr,
  67. Version* version = nullptr, uint64_t* memtable_payload_bytes = nullptr,
  68. uint64_t* memtable_garbage_bytes = nullptr,
  69. InternalStats::CompactionStats* flush_stats = nullptr);
  70. } // namespace ROCKSDB_NAMESPACE