52 using SnapshotIdSupplier = std::function<int64_t()>;
64 ManifestContent content, int64_t target_size_bytes, int32_t min_count_to_merge,
65 bool merge_enabled, std::shared_ptr<FileIO> file_io,
66 SnapshotIdSupplier snapshot_id_supplier,
67 std::function<Status(
const std::string&)> delete_file = {});
85 const std::vector<ManifestFile>& existing_manifests,
86 const std::vector<ManifestFile>& new_manifests,
const TableMetadata& metadata,
98 int32_t min_count_to_merge,
bool merge_enabled,
99 std::shared_ptr<FileIO> file_io,
100 SnapshotIdSupplier snapshot_id_supplier,
101 std::function<Status(
const std::string&)> delete_file);
103 struct MergedManifestCache {
105 std::vector<ManifestFile> bin;
106 bool operator==(
const Key& other)
const =
default;
110 size_t operator()(
const Key& key)
const;
113 const ManifestFile* Find(
const std::vector<const ManifestFile*>& bin)
const;
114 void Add(
const std::vector<const ManifestFile*>& bin,
const ManifestFile& manifest);
115 bool empty()
const {
return entries_.empty(); }
117 const std::unordered_set<std::string>& committed, int64_t snapshot_id,
118 const std::function<Status(
const std::string&)>& delete_file);
121 static Key MakeKey(
const std::vector<const ManifestFile*>& bin);
123 std::unordered_map<Key, ManifestFile, KeyHash> entries_;
131 const std::vector<const ManifestFile*>& group,
const ManifestFile* first,
146 const int64_t target_size_bytes_;
147 const int32_t min_count_to_merge_;
148 const bool merge_enabled_;
149 std::shared_ptr<FileIO> file_io_;
150 SnapshotIdSupplier snapshot_id_supplier_;
151 std::function<Status(
const std::string&)> delete_file_;
152 int32_t replaced_manifests_count_{0};
153 MergedManifestCache merged_manifests_;
static Result< std::unique_ptr< ManifestMergeManager > > Make(ManifestContent content, int64_t target_size_bytes, int32_t min_count_to_merge, bool merge_enabled, std::shared_ptr< FileIO > file_io, SnapshotIdSupplier snapshot_id_supplier, std::function< Status(const std::string &)> delete_file={})
Construct a merge manager with the given configuration.
Result< std::vector< ManifestFile > > MergeManifests(const std::vector< ManifestFile > &existing_manifests, const std::vector< ManifestFile > &new_manifests, const TableMetadata &metadata, const ManifestWriterFactory &writer_factory)
Merge existing and new manifests according to configured thresholds.
std::function< Result< std::unique_ptr< ManifestWriter > >(int32_t spec_id, ManifestContent content)> ManifestWriterFactory
Factory type for creating ManifestWriter instances.
Definition manifest_writer.h:169