Everett
Loading...
Searching...
No Matches
native_file_merge.h
Go to the documentation of this file.
1
13#pragma once
14
17
18namespace everett {
19 namespace profile_detail {
20 template <class P, class Ops> struct native_file_output_ref {
21 using policy_type = P;
23 std::uint64_t size() const noexcept { return output->size(); }
24 bool finished() const noexcept { return output->finished(); }
25 bool failed() const noexcept { return output->failed(); }
26 auto common_value_width() const noexcept { return output->common_value_width(); }
27 void append(std::uint64_t retained, bit_view literal, bit_view value) { output->append(retained, literal, value); }
28 object_seal_receipt finish() { return output->finish(); }
29 };
30 }
31
32 // Owns a streaming output and the ordinary incremental merge frontier.
33 // Sources stay pinned through pauses and failures. The default/value-only
34 // composition path forwards encoded literals without a third full-key buffer.
35 // One step is measured in distinct keys, not bytes or durable progress.
36 // Only finish seals the output; interrupted attempts cannot be resumed.
37 template <class P, class Native = profile_array<P>, class Compose = replace_native_value,
38 class Ops = posix_object_ops> struct native_file_merge {
39 using policy_type = P;
40 using source_pointer = std::shared_ptr<Native const>;
42 native_file_merge(std::filesystem::path root, object_id id, object_attempt_id attempt,
43 source_pointer older, source_pointer newer, Compose compose = {},
44 std::optional<std::uint64_t> common = P::value_width)
45 : output_(std::move(root), std::move(id), std::move(attempt), common),
46 builder_({&output_}, std::move(older), std::move(newer), std::move(compose)) {}
47 native_file_merge(std::filesystem::path root, object_id id, object_attempt_id attempt,
48 source_pointer older, source_pointer newer, Ops & ops, Compose compose = {},
49 std::optional<std::uint64_t> common = P::value_width)
50 : output_(std::move(root), std::move(id), std::move(attempt), common, ops),
51 builder_({&output_}, std::move(older), std::move(newer), std::move(compose)) {}
56 bool done() const noexcept { return builder_.done(); }
57 bool failed() const noexcept { return builder_.failed(); }
58 bool finished() const noexcept { return builder_.finished(); }
59 native_merge_progress progress() const noexcept { return builder_.progress(); }
60 native_merge_progress step(std::uint64_t key_budget = 1) { return builder_.step(key_budget); }
62 object_write_paths const & paths() const & noexcept { return output_.paths(); }
63 object_write_paths const & paths() const && = delete;
64 private:
65 profile_detail::native_file_output<P, Ops> output_;
67 };
68}
Definition active_engine.h:18
Streams ordinary front-coded native objects with bounded payload buffering.
Merges ordered native streams incrementally with policy-specific value composition.
Definition profile.h:56
Definition native_file_merge.h:38
bool failed() const noexcept
Definition native_file_merge.h:57
native_file_merge(native_file_merge const &)=delete
native_merge_progress step(std::uint64_t key_budget=1)
Definition native_file_merge.h:60
bool finished() const noexcept
Definition native_file_merge.h:58
object_write_paths const & paths() const &noexcept
Definition native_file_merge.h:62
native_file_merge(std::filesystem::path root, object_id id, object_attempt_id attempt, source_pointer older, source_pointer newer, Compose compose={}, std::optional< std::uint64_t > common=P::value_width)
Definition native_file_merge.h:42
object_seal_receipt finish()
Definition native_file_merge.h:61
native_merge_progress progress() const noexcept
Definition native_file_merge.h:59
native_file_merge & operator=(native_file_merge &&)=delete
std::shared_ptr< Native const > source_pointer
Definition native_file_merge.h:40
P policy_type
Definition native_file_merge.h:39
native_file_merge & operator=(native_file_merge const &)=delete
object_write_paths const & paths() const &&=delete
native_file_merge(std::filesystem::path root, object_id id, object_attempt_id attempt, source_pointer older, source_pointer newer, Ops &ops, Compose compose={}, std::optional< std::uint64_t > common=P::value_width)
Definition native_file_merge.h:47
native_file_merge(native_file_merge &&)=delete
bool done() const noexcept
Definition native_file_merge.h:56
builder_type builder_
Definition native_file_merge.h:66
profile_detail::native_file_output< P, Ops > output_
Definition native_file_merge.h:65
Definition native_merge.h:174
native_merge_progress step(std::uint64_t key_budget=1)
Definition native_merge.h:225
auto finish()
Definition native_merge.h:278
bool done() const noexcept
Definition native_merge.h:216
bool finished() const noexcept
Definition native_merge.h:220
native_merge_progress progress() const noexcept
Definition native_merge.h:221
bool failed() const noexcept
Definition native_merge.h:219
Definition native_merge.h:148
Definition object_writer.h:39
Definition object_path.h:38
Definition object_writer.h:88
Definition object_writer.h:53
Definition native_file_merge.h:20
native_file_output< P, Ops > * output
Definition native_file_merge.h:22
bool failed() const noexcept
Definition native_file_merge.h:25
bool finished() const noexcept
Definition native_file_merge.h:24
auto common_value_width() const noexcept
Definition native_file_merge.h:26
void append(std::uint64_t retained, bit_view literal, bit_view value)
Definition native_file_merge.h:27
object_seal_receipt finish()
Definition native_file_merge.h:28
P policy_type
Definition native_file_merge.h:21
std::uint64_t size() const noexcept
Definition native_file_merge.h:23
Definition profile_file_output.h:44