11#include " phlex/model/flush_gate.hpp"
22
3- #include " spdlog/spdlog.h"
4-
53#include < cassert>
64#include < functional>
7- #include < mutex>
85#include < ranges>
96#include < utility>
107
118namespace phlex ::experimental {
129
1310 flush_gate::flush_gate (data_cell_index_ptr index, std::size_t expected_flush_count) :
14- index_{std::move (index)},
15- committed_counts_{std::make_shared<data_cell_counts>()},
16- expected_flush_count_{expected_flush_count}
11+ index_{std::move (index)}, expected_flush_count_{expected_flush_count}
1712 {
1813 }
1914
@@ -24,13 +19,13 @@ namespace phlex::experimental {
2419
2520 std::size_t flush_gate::committed_total_count () const
2621 {
27- return std::ranges::fold_left (* committed_counts_ | std::views::values, 0uz, std::plus{});
22+ return std::ranges::fold_left (committed_counts_ | std::views::values, 0uz, std::plus{});
2823 }
2924
3025 std::size_t flush_gate::committed_count_for_layer (
3126 data_cell_index::hash_type const layer_hash) const
3227 {
33- return committed_counts_-> count (layer_hash);
28+ return committed_counts_. count (layer_hash);
3429 }
3530
3631 void flush_gate::update_expected_count (data_cell_index::hash_type const layer_hash,
@@ -40,11 +35,10 @@ namespace phlex::experimental {
4035 ++received_flush_count_;
4136 }
4237
43- void flush_gate::roll_up_child (data_cell_counts_const_ptr child_committed_counts)
38+ void flush_gate::roll_up_child (data_cell_counts const & child_committed_counts)
4439 {
45- assert (child_committed_counts);
46- for (auto const & [layer_hash, count] : *child_committed_counts) {
47- committed_counts_->add_to (layer_hash, count);
40+ for (auto const & [layer_hash, count] : child_committed_counts) {
41+ committed_counts_.add_to (layer_hash, count);
4842 }
4943 --pending_child_rollups_;
5044 }
@@ -89,7 +83,7 @@ namespace phlex::experimental {
8983 void flush_gate::commit ()
9084 {
9185 for (auto const & [layer_hash, count] : expected_counts_) {
92- committed_counts_-> add_to (layer_hash, count.load ());
86+ committed_counts_. add_to (layer_hash, count.load ());
9387 }
9488
9589 // At some point, we might consider clearing the expected_counts_ map to free memory,
0 commit comments