35 namespace cola_detail {
37 inline unsigned route(
unsigned value) {
38 if (value >= 2) error_detail::raise<std::out_of_range>(
"COLA target route");
41 inline std::uint64_t
target_ordinal(std::uint64_t ordinal, std::uint64_t stride) {
42 if (ordinal > std::numeric_limits<std::uint64_t>::max() / stride)
43 error_detail::raise<std::overflow_error>(
"COLA target ordinal overflow");
44 return ordinal * stride;
48 std::array<std::uint64_t, 3>
common{};
54 std::array<std::uint64_t, 3>
const & prefixes, Live live, Head head) {
57 for (
unsigned origin = 0; origin < 3; ++origin)
if (live(origin)) {
58 auto candidate = head(origin);
60 result.
origin = origin; key = candidate; result.
common[origin] = key.size();
63 auto first = prefixes[origin], second = prefixes[result.
origin];
65 if (first != second) comparison = {std::min(first, second), first > second ? -1 : 1};
67 comparison = compare_common_bits<Arch>(candidate.subview(first, candidate.size() - first),
68 key.subview(first, key.size() - first));
71 if (comparison.
order < 0) {
73 for (
unsigned i = 0; i < origin; ++i)
75 result.
origin = origin; key = candidate;
76 result.
common[origin] = key.size();
79 if (result.
origin == 3) error_detail::raise<std::invalid_argument>(
"COLA frontier has no live stream");
90 std::optional<profile_blob_native_match<P>>
native;
91 std::array<std::optional<profile_blob_borrowed_predecessor<P>>, 2>
predecessors;
96 std::array<std::optional<profile_blob_borrowed_predecessor<P>>, 2>
predecessors;
106 template <
class P,
class Native>
struct cola_stream_family<P, Native, std::void_t<typename Native::stream_family>> {
107 using type =
typename Native::stream_family;
121 std::array<rank_view, 2> ranks, std::array<std::span<std::byte const>, 2> flags,
122 std::array<word_view, 2> cuts, std::uint64_t count)
124 auto remaining = std::numeric_limits<std::uint64_t>::max() -
native.size();
127 error_detail::raise<std::invalid_argument>(
"COLA augmented count mismatch");
128 for (
unsigned route = 0; route < 2; ++route) {
130 if (size > std::numeric_limits<std::uint64_t>::max() - 7 || ranks[route].size() != count ||
131 flags[route].size() != ((size + 7) >> 3) || cuts[route].size() !=
group_count())
132 error_detail::raise<std::invalid_argument>(
"COLA section shape mismatch");
148 if (ordinal >=
borrowed_[route].size()) error_detail::raise<std::out_of_range>(
"COLA borrowed ordinal");
149 return (std::to_integer<unsigned>(
flags_[route][ordinal >> 3]) >> (ordinal & 7)) & 1;
153 if (group >=
group_count()) error_detail::raise<std::out_of_range>(
"COLA virtual group");
156 std::array<std::uint64_t, 2> prefix{}, population{};
157 for (
unsigned route = 0; route < 2; ++route) {
158 prefix[route] =
ranks_[route].template rank<typename P::architecture>(group);
159 population[route] =
ranks_[route].class_at(group);
160 if (prefix[route] > first || prefix[route] >
borrowed_[route].size() ||
161 population[route] > width || population[route] >
borrowed_[route].size() - prefix[route])
162 error_detail::raise<std::invalid_argument>(
"invalid COLA rank projection");
164 if (prefix[0] > first - prefix[1] || population[0] > width - population[1])
165 error_detail::raise<std::invalid_argument>(
"overlapping COLA population directories");
166 auto native_first = first - prefix[0] - prefix[1];
167 auto native_last = native_first + width - population[0] - population[1];
168 if (native_last >
native_.size()) error_detail::raise<std::invalid_argument>(
"invalid COLA native projection");
169 return {native_first, native_last, prefix,
170 {prefix[0] + population[0], prefix[1] + population[1]}};
174 std::array<profile_comparison_work *, 2> borrowed_work = {})
const {
175 return search_window_with<cola_window_result<P>>(group, lower,
176 [](std::uint64_t ordinal,
bit_view value) {
178 }, native_work, borrowed_work);
184 if (lower.
order() > 0) error_detail::raise<std::invalid_argument>(
"query precedes COLA boundary");
188 native_.compare_window(window.native_first, window.native_last, lower,
190 if (item.comparison.order() >= 0) {
191 result.native_ordinal = item.ordinal;
192 equal = !item.comparison.order();
197 for (
unsigned route = 0; route < 2; ++route) {
202 if (!comparison.order() && is_false && !equal) {
203 if (!window.native_first) error_detail::raise<std::invalid_argument>(
"COLA false borrow has no native predecessor");
204 result.native_ordinal = std::min(result.native_ordinal, window.native_first - 1);
207 borrowed_[
route].compare_window(window.borrowed_first[route], window.borrowed_last[route], lower,
208 [&](profile_comparison_item<P> item) {
209 if (item.comparison.order() > 0) return false;
210 remember(item.ordinal, item.comparison);
213 if (!result.predecessors[route] && window.borrowed_first[route])
214 remember(window.borrowed_first[route] - 1, lower.
predecessor(
cuts_[route][group]));
223 std::array<profile_comparison_work *, 2> borrowed_work = {})
const {
224 if (lower.
order() > 0) error_detail::raise<std::invalid_argument>(
"query precedes COLA boundary");
225 auto window = project(group);
227 native_.compare_window(window.native_first, window.native_last, lower,
229 if (!item.comparison.order())
230 result.native = capture(item.ordinal, item.value);
231 return item.comparison.order() < 0;
233 for (
unsigned route = 0; route < 2; ++route) {
235 auto is_false = false_borrow(route, ordinal);
238 if (!comparison.order() && is_false && !result.native) {
239 if (!window.native_first) error_detail::raise<std::invalid_argument>(
"COLA false borrow has no native predecessor");
240 auto native_ordinal = window.native_first - 1;
241 result.native = capture(native_ordinal, native_.encoded_at(native_ordinal).value);
244 borrowed_[
route].compare_window(window.borrowed_first[route], window.borrowed_last[route], lower,
245 [&](profile_comparison_item<P> item) {
246 if (item.comparison.order() > 0) return false;
247 remember(item.ordinal, item.comparison);
249 }, borrowed_work[route]);
250 if (!result.predecessors[route] && window.borrowed_first[route])
251 remember(window.borrowed_first[route] - 1, lower.
predecessor(cuts_[route][group]));
258 std::array<std::span<std::byte const>, 2>
flags_;
265 namespace cola_detail {
270 if (first >= leaf.size() || first % P::group_size || predecessor.
comparison.order() > 0)
271 error_detail::raise<std::invalid_argument>(
"invalid COLA secondary route");
272 auto last = first + std::min<std::uint64_t>(P::group_size, leaf.size() - first);
274 if (!item.comparison.order()) capture(item.ordinal, item.value);
275 return item.comparison.order() < 0;
282 std::optional<profile_blob_native_match<P>> result;
283 cola_detail::visit_secondary<P>(leaf, predecessor, [&](std::uint64_t ordinal,
bit_view value) {
289 template <
class P,
class Native = profile_array<P>,
class Main =
void>
struct cola_index;
290 template <
class P,
class Target = cola_index<P>>
struct cola_sample_cursor;
291 namespace cola_detail {
292 template <
class P,
class Native,
class Main>
struct index_output;
294 std::array<rank_groups<P::group_size>, 2>
ranks;
295 std::array<std::vector<std::byte>, 2>
flags;
296 std::array<std::vector<std::uint64_t>, 2>
cuts;
297 std::uint64_t count = 0;
300 template <
class P,
class Native = profile_array<P>,
class Main =
void,
304 std::uint64_t target_ordinal = 0;
306 std::uint64_t source_ordinal = 0;
315 template <
class P,
class Native,
class Main>
struct cola_index {
325 static constexpr auto group_size = P::group_size;
327 requires (std::is_same_v<Native, profile_array<P>> && std::is_void_v<Main>);
333 requires (std::is_same_v<Native, profile_array<P>> && std::is_void_v<Main>);
341 borrowed_array const & borrowed(
unsigned route) const & { require_active();
return borrowed_[cola_detail::route(route)]; }
349 std::span<std::byte const>
false_borrow_bits(
unsigned route)
const & { require_active();
return flags_[cola_detail::route(route)]; }
353 std::span<std::uint64_t const>
cut_lcps(
unsigned route)
const & { require_active();
return cuts_[cola_detail::route(route)]; }
354 std::span<std::uint64_t const>
cut_lcps(
unsigned)
const && =
delete;
359 std::uint64_t
virtual_size() const noexcept {
return native_ ? count_ : 0; }
360 std::uint64_t
group_count() const noexcept {
auto n = virtual_size();
return n / group_size + (n % group_size != 0); }
363 return {native_->view(), {borrowed_[0].view(), borrowed_[1].view()}, {ranks_[0].view(), ranks_[1].view()},
364 {flags_[0], flags_[1]}, {
word_view(std::span<std::uint64_t const>(cuts_[0])),
365 word_view(std::span<std::uint64_t const>(cuts_[1]))}, count_};
368 cola_window project(std::uint64_t group)
const {
return view().project(group); }
371 std::array<profile_comparison_work *, 2> borrowed_work = {})
const {
372 return view().search_window(group, lower, native_work, borrowed_work);
375 friend struct cola_detail::index_output<P, Native, Main>;
380 std::array<rank_groups<group_size>, 2>
ranks_;
381 std::array<std::vector<std::byte>, 2>
flags_;
382 std::array<std::vector<std::uint64_t>, 2>
cuts_;
385 if (!native_) error_detail::raise<std::logic_error>(
"moved-from COLA index");
389 std::array<std::vector<std::byte>, 2> flags, std::array<std::vector<std::uint64_t>, 2> cuts,
392 borrowed_(std::move(
borrowed)), ranks_(std::move(ranks)), flags_(std::move(flags)), cuts_(std::move(cuts)), count_(count) {}
395 namespace cola_detail {
402 bool failed() const noexcept {
return false; }
405 std::array<typename index_type::borrowed_array, 2>
borrowed{writers_[0].finish(), writers_[1].finish()};
409 std::array<typename index_type::borrowed_array, 2> borrowed,
index_metadata<P> metadata) {
411 std::move(metadata.
ranks), std::move(metadata.
flags), std::move(metadata.
cuts), metadata.
count);
414 std::array<typename index_type::stream_family::borrowed_writer, 2>
writers_;
423 bool done() const noexcept {
return !target_ || ordinal_ == count_; }
424 std::shared_ptr<Target const>
target() const noexcept {
return target_; }
426 if (done()) error_detail::raise<std::out_of_range>(
"COLA sampler at end");
427 auto origin = choose().origin;
428 if (!origin) {
auto item = native_.peek();
return {item.key.prefix, ordinal_, cola_origin::native, item.
ordinal}; }
429 auto item = borrowed_[origin - 1].peek();
433 void advance() { (void)advance_impl<false>(); }
440 if (done()) error_detail::raise<std::out_of_range>(
"COLA sampler at end");
441 auto selected = choose();
442 auto first_length = selected.common[selected.origin];
443 auto common = first_length;
444 auto width = std::min<std::uint64_t>(P::group_size, count_ - ordinal_);
445 for (std::uint64_t i = 0; i < width; ++i) {
446 prefixes_ = selected.common;
447 auto next = !selected.origin ? native_.advance_comparison() :
448 borrowed_[selected.origin - 1].advance_comparison();
449 if (next && (next->order > 0 || (!selected.origin && !next->order)))
450 error_detail::raise<std::invalid_argument>(
"COLA sample source order mismatch");
451 prefixes_[selected.origin] = next ? next->common_bits : 0;
453 if (!done() && (Compare || i + 1 < width)) {
455 if constexpr (Compare) common = std::min(common, prefixes_[selected.origin]);
458 if constexpr (Compare)
if (!done())
460 selected.common[selected.origin] == first_length ? 0 : -1};
463 using view_type =
decltype(std::declval<Target const &>().view());
464 using native_cursor =
decltype(std::declval<typename view_type::native_view>().cursor());
465 using borrowed_cursor =
decltype(std::declval<typename view_type::borrowed_view>().cursor());
470 std::array<std::uint64_t, 3> prefixes_{};
473 if (!target) error_detail::raise<std::invalid_argument>(
"null COLA sample target");
474 auto view = target->view();
475 return {std::move(target), std::move(view)};
478 : target_(std::move(source.target)), native_(source.view.
native()),
480 count_(source.view.virtual_size()) {}
482 return cola_detail::choose_frontier<typename P::architecture>(prefixes_,
483 [&](
unsigned origin) {
return !origin ? !native_.done() : !borrowed_[origin - 1].done(); },
484 [&](
unsigned origin) {
return !origin ? native_.peek().key.prefix : borrowed_[origin - 1].peek().key.prefix; });
504 : cola_index_builder(Output{}, std::move(native), std::move(main), std::move(secondary)) {}
506 : native_(checked(std::move(native))), main_(std::move(main)), secondary_(std::move(secondary)), output_(std::move(output)) {
507 auto remaining = std::numeric_limits<std::uint64_t>::max() - native_->size();
508 auto primary_count = main_ ? main_->group_count() : 0;
509 auto secondary_count = secondary_ ? secondary_->size() / P::group_size + (secondary_->size() % P::group_size != 0) : 0;
510 if (primary_count > remaining || secondary_count > remaining - primary_count)
511 error_detail::raise<std::length_error>(
"COLA augmented count overflow");
512 if (main_ || secondary_) native_cursor_.emplace(native_->view());
513 if (main_) primary_cursor_.emplace(main_);
514 if (secondary_) secondary_cursor_.emplace(secondary_->view());
521 return native_ && !failed_ && (native_cursor_ ? !live(0) && !live(1) && !live(2) : count_ == native_->size());
523 bool failed() const noexcept {
return failed_ || output_.failed(); }
524 bool finished() const noexcept {
return finished_; }
525 std::uint64_t
size() const noexcept {
return count_; }
529 std::uint64_t
step(std::uint64_t budget) {
535 if (!native_cursor_)
return step_terminal(budget);
536 while (
consumed < budget && !done()) {
537 auto selected = cola_detail::choose_frontier<typename P::architecture>(prefixes_,
538 [&](
unsigned origin) {
return live(origin); },
539 [&](
unsigned origin) {
return head(origin); });
540 auto origin = selected.origin;
541 auto key = head(origin);
542 auto common = prefixes_[origin];
543 bool equal = count_ && common == previous_length_ && key.size() == previous_length_;
544 if (!origin && equal)
545 error_detail::raise<std::invalid_argument>(
"COLA sources violate sorted native order");
546 for (
unsigned route = 0; route < 2; ++route)
547 if (borrowed_count_[route]) cut_common_[route] = std::min(cut_common_[route], common);
548 if (!width_)
for (
unsigned route = 0; route < 2; ++route)
549 cuts_[route].push_back(borrowed_count_[route] ? cut_common_[route] : 0);
550 native_equal_ = !origin || (equal && native_equal_);
552 auto route = origin - 1;
556 output_.append_known(route, key, borrowed_count_[route] ? cut_common_[route] : 0);
557 auto ordinal = borrowed_count_[route]++;
558 if (!(ordinal & 7)) flags_[route].push_back(std::byte{0});
559 if (native_equal_) flags_[route].back() |= std::byte(1u << (ordinal & 7));
560 ++population_[route];
561 cut_common_[route] = key.size();
563 previous_length_ = key.size();
564 prefixes_ = selected.common;
565 if (!origin) prefixes_[0] = advance_native(*native_cursor_);
566 else if (origin == 1) {
567 auto next = primary_cursor_->advance_comparison();
568 prefixes_[1] = next ? next->common_bits : 0;
570 auto next_common = key.size();
571 for (std::uint64_t i = 0; i < P::group_size && !secondary_cursor_->done(); ++i)
572 next_common = std::min(next_common, advance_native(*secondary_cursor_));
573 prefixes_[2] = next_common;
576 if (width_ == P::group_size) flush_group();
578 }
catch (...) { failed_ =
true;
throw; }
583 if (!done()) error_detail::raise<std::logic_error>(
"COLA builder has remaining input");
585 if (width_) flush_group();
587 std::move(flags_), std::move(cuts_), count_};
588 auto result = output_.finish(native_, main_, secondary_, std::move(metadata));
591 }
catch (...) { failed_ =
true;
throw; }
602 std::array<rank_groups_builder<P::group_size>, 2>
ranks_;
603 std::array<std::vector<std::byte>, 2>
flags_;
604 std::array<std::vector<std::uint64_t>, 2>
cuts_;
605 std::array<std::uint64_t, 2> borrowed_count_{}, cut_common_{}, population_{};
606 std::array<std::uint64_t, 3> prefixes_{};
607 std::uint64_t previous_length_ = 0, count_ = 0, width_ = 0;
608 bool native_equal_ =
false, failed_ =
false, finished_ =
false;
610 if (!
native) error_detail::raise<std::invalid_argument>(
"null COLA native source");
614 if (!native_ || failed() || finished_) error_detail::raise<std::logic_error>(
"COLA builder is no longer active");
616 bool live(
unsigned origin)
const noexcept {
617 if (!origin)
return native_cursor_ && !native_cursor_->done();
618 if (origin == 1)
return primary_cursor_ && !primary_cursor_->done();
619 return secondary_cursor_ && !secondary_cursor_->done();
622 if (!origin)
return native_cursor_->peek().key.
prefix;
623 if (origin == 1)
return primary_cursor_->peek().key;
624 return secondary_cursor_->peek().key.
prefix;
627 auto next = cursor.advance_comparison();
628 if (next && next->order >= 0)
629 error_detail::raise<std::invalid_argument>(
"COLA native source order mismatch");
630 return next ? next->common_bits : 0;
634 auto total = native_->size();
635 while (
consumed < budget && count_ < total) {
636 if (!width_)
for (
auto & cuts : cuts_) cuts.push_back(0);
637 auto chunk = std::min({budget -
consumed, total - count_, P::group_size - width_});
638 count_ += chunk;
consumed += chunk; width_ += chunk;
639 if (width_ == P::group_size) flush_group();
644 for (
unsigned route = 0; route < 2; ++route) ranks_[route].append(population_[route], width_);
645 width_ = 0; population_ = {};
649 template <
class P,
class Native,
class Main>
652 requires (std::is_same_v<Native, profile_array<P>> && std::is_void_v<Main>) {
654 for (
auto const & record : records) writer.
append(record);
655 return adopt_native(std::make_shared<native_array const>(writer.
finish()), std::move(
main), std::move(
secondary));
657 template <
class P,
class Native,
class Main>
661 while (!builder.
done()) builder.
step(4096);
664 template <
class P,
class Native,
class Main>
667 requires (std::is_same_v<Native, profile_array<P>> && std::is_void_v<Main>) {
669 auto empty = std::make_shared<native_array const>(native_array::build({}));
670 auto root = std::make_shared<cola_index const>(adopt_native(
empty, std::move(
main), std::move(
secondary)));
671 while (root->virtual_size() > group_size)
672 root = std::make_shared<cola_index const>(adopt_native(
empty, std::move(root)));
unsigned route(unsigned value)
Definition cola_index.h:37
frontier_selection choose_frontier(std::array< std::uint64_t, 3 > const &prefixes, Live live, Head head)
Definition cola_index.h:53
std::uint64_t target_ordinal(std::uint64_t ordinal, std::uint64_t stride)
Definition cola_index.h:41
void visit_secondary(View const &leaf, profile_blob_borrowed_predecessor< P > const &predecessor, Capture &&capture, profile_comparison_work *work=nullptr)
Definition cola_index.h:266
Definition active_engine.h:18
cola_target
Definition cola_index.h:33
std::optional< profile_blob_native_match< P > > cola_search_secondary(View leaf, profile_blob_borrowed_predecessor< P > const &predecessor, profile_comparison_work *work=nullptr)
Definition cola_index.h:279
cola_origin
Definition cola_index.h:34
Builds native front-coded profiles incrementally with explicit value widths.
Declares Everett's profile blob support.
Declares Everett's sequential sampling of pinned encoded blob pairs.
std::uint64_t common_bits
Definition profile.h:210
int order
Definition profile.h:211
static bit_string copy(bit_view source)
Definition profile.h:181
bit_view prefix(std::uint64_t count) const
Definition profile.h:80
Definition cola_index.h:46
std::array< std::uint64_t, 3 > common
Definition cola_index.h:48
unsigned origin
Definition cola_index.h:47
Definition cola_index.h:398
static index_type adopt(native_pointer native, main_pointer main, native_pointer secondary, std::array< typename index_type::borrowed_array, 2 > borrowed, index_metadata< P > metadata)
Definition cola_index.h:408
index_type finish(native_pointer native, main_pointer main, native_pointer secondary, index_metadata< P > metadata)
Definition cola_index.h:404
typename index_type::native_pointer native_pointer
Definition cola_index.h:400
typename index_type::main_pointer main_pointer
Definition cola_index.h:401
void append_known(unsigned route, bit_view key, std::uint64_t common)
Definition cola_index.h:403
std::array< typename index_type::stream_family::borrowed_writer, 2 > writers_
Definition cola_index.h:414
bool failed() const noexcept
Definition cola_index.h:402
Definition cola_query.h:85
Definition cola_index.h:496
native_pointer native_
Definition cola_index.h:594
cola_index_builder(cola_index_builder const &)=delete
main_pointer main_
Definition cola_index.h:595
void flush_group()
Definition cola_index.h:643
native_pointer secondary_target() const noexcept
Definition cola_index.h:528
std::optional< native_cursor_type > secondary_cursor_
Definition cola_index.h:600
cola_index_builder(Output output, native_pointer native, main_pointer main={}, native_pointer secondary={})
Definition cola_index.h:505
native_pointer secondary_
Definition cola_index.h:596
bit_view head(unsigned origin) const
Definition cola_index.h:621
cola_index_builder & operator=(cola_index_builder const &)=delete
std::uint64_t size() const noexcept
Definition cola_index.h:525
cola_index_builder(native_pointer native, main_pointer main={}, native_pointer secondary={})
Definition cola_index.h:503
P policy_type
Definition cola_index.h:497
std::uint64_t step_terminal(std::uint64_t budget)
Definition cola_index.h:632
main_pointer main_target() const noexcept
Definition cola_index.h:527
std::optional< cola_sample_cursor< P, target_type > > primary_cursor_
Definition cola_index.h:599
decltype(std::declval< Native const & >().view().cursor()) native_cursor_type
Definition cola_index.h:597
std::optional< native_cursor_type > native_cursor_
Definition cola_index.h:598
bool failed() const noexcept
Definition cola_index.h:523
static native_pointer checked(native_pointer native)
Definition cola_index.h:609
std::array< std::vector< std::uint64_t >, 2 > cuts_
Definition cola_index.h:604
typename index_type::main_pointer main_pointer
Definition cola_index.h:501
bool live(unsigned origin) const noexcept
Definition cola_index.h:616
bool finished() const noexcept
Definition cola_index.h:524
native_pointer native_owner() const noexcept
Definition cola_index.h:526
typename index_type::target_type target_type
Definition cola_index.h:502
cola_index_builder(cola_index_builder &&)=default
std::array< rank_groups_builder< P::group_size >, 2 > ranks_
Definition cola_index.h:602
std::array< std::vector< std::byte >, 2 > flags_
Definition cola_index.h:603
auto finish()
Definition cola_index.h:581
void require_active() const
Definition cola_index.h:613
bool done() const noexcept
Definition cola_index.h:520
std::uint64_t step(std::uint64_t budget)
Definition cola_index.h:529
Output output_
Definition cola_index.h:601
static std::uint64_t advance_native(native_cursor_type &cursor)
Definition cola_index.h:626
typename index_type::pair_type pair_type
Definition cola_index.h:500
typename index_type::native_pointer native_pointer
Definition cola_index.h:499
cola_index_builder & operator=(cola_index_builder &&)=default
Definition cola_index.h:114
native_view native_
Definition cola_index.h:255
word_view cut_lcps(cola_target route) const
Definition cola_index.h:143
typename Family::native_view native_view
Definition cola_index.h:116
std::uint64_t virtual_size() const noexcept
Definition cola_index.h:144
typename Family::borrowed_view borrowed_view
Definition cola_index.h:117
cola_window project(std::uint64_t group) const
Definition cola_index.h:152
std::array< rank_view, 2 > ranks_
Definition cola_index.h:257
borrowed_view const & borrowed(unsigned route) const
Definition cola_index.h:136
std::span< std::byte const > false_borrow_bits(unsigned route) const
Definition cola_index.h:140
rank_view const & interleave(unsigned route) const
Definition cola_index.h:138
P policy_type
Definition cola_index.h:115
bool false_borrow(cola_target route, std::uint64_t ordinal) const
Definition cola_index.h:151
word_view cut_lcps(unsigned route) const
Definition cola_index.h:142
static constexpr auto group_size
Definition cola_index.h:119
std::span< std::byte const > false_borrow_bits(cola_target route) const
Definition cola_index.h:141
cola_window_result< P > search_window(std::uint64_t group, profile_query_context< P > const &lower, profile_comparison_work *native_work=nullptr, std::array< profile_comparison_work *, 2 > borrowed_work={}) const
Definition cola_index.h:172
std::array< word_view, 2 > cuts_
Definition cola_index.h:259
borrowed_view const & borrowed(cola_target route) const
Definition cola_index.h:137
rank_view const & interleave(cola_target route) const
Definition cola_index.h:139
std::uint64_t group_count() const noexcept
Definition cola_index.h:145
std::uint64_t count_
Definition cola_index.h:260
bool false_borrow(unsigned route, std::uint64_t ordinal) const
Definition cola_index.h:146
native_view const & native() const noexcept
Definition cola_index.h:135
std::array< borrowed_view, 2 > borrowed_
Definition cola_index.h:256
cola_index_view(native_view native, std::array< borrowed_view, 2 > borrowed, std::array< rank_view, 2 > ranks, std::array< std::span< std::byte const >, 2 > flags, std::array< word_view, 2 > cuts, std::uint64_t count)
Definition cola_index.h:120
Result search_window_with(std::uint64_t group, profile_query_context< P > const &lower, Capture &&capture, profile_comparison_work *native_work=nullptr, std::array< profile_comparison_work *, 2 > borrowed_work={}) const
Definition cola_index.h:220
cola_lower_bound_result< P > lower_bound_window(std::uint64_t group, profile_query_context< P > const &lower, profile_comparison_work *work=nullptr) const
Definition cola_index.h:182
std::array< std::span< std::byte const >, 2 > flags_
Definition cola_index.h:258
Definition cola_index.h:315
view_type view() const &
Definition cola_index.h:361
std::array< std::vector< std::uint64_t >, 2 > cuts_
Definition cola_index.h:382
native_array const & native() const &
Definition cola_index.h:339
static cola_index build(std::span< profile_record const > records, main_pointer main={}, native_pointer secondary={})
Definition cola_index.h:650
main_pointer main_target() const noexcept
Definition cola_index.h:357
std::span< std::uint64_t const > cut_lcps(cola_target route) const &
Definition cola_index.h:355
std::array< std::vector< std::byte >, 2 > flags_
Definition cola_index.h:381
std::span< std::uint64_t const > cut_lcps(unsigned route) const &
Definition cola_index.h:353
native_pointer secondary_
Definition cola_index.h:378
borrowed_array const & borrowed(unsigned) const &&=delete
std::conditional_t< std::is_void_v< Main >, cola_index, Main > target_type
Definition cola_index.h:318
typename stream_family::borrowed_array borrowed_array
Definition cola_index.h:321
std::span< std::byte const > false_borrow_bits(unsigned route) const &
Definition cola_index.h:349
std::uint64_t group_count() const noexcept
Definition cola_index.h:360
cola_index(cola_index const &)=delete
std::shared_ptr< native_array const > native_pointer
Definition cola_index.h:322
Native native_array
Definition cola_index.h:317
std::uint64_t count_
Definition cola_index.h:383
std::array< borrowed_array, 2 > borrowed_
Definition cola_index.h:379
std::shared_ptr< cola_index const > pair_type
Definition cola_index.h:323
native_pointer native_
Definition cola_index.h:376
borrowed_array const & borrowed(cola_target) const &&=delete
std::span< std::byte const > false_borrow_bits(cola_target route) const &
Definition cola_index.h:351
native_pointer native_owner() const noexcept
Definition cola_index.h:338
rank_groups< group_size > const & interleave(unsigned route) const &
Definition cola_index.h:345
std::span< std::uint64_t const > cut_lcps(cola_target) const &&=delete
static cola_index adopt_native(native_pointer native, main_pointer main={}, native_pointer secondary={})
Definition cola_index.h:658
std::uint64_t virtual_size() const noexcept
Definition cola_index.h:359
cola_index & operator=(cola_index &&)=default
typename cola_stream_family< P, Native >::type stream_family
Definition cola_index.h:319
rank_groups< group_size > const & interleave(cola_target route) const &
Definition cola_index.h:347
rank_groups< group_size > const & interleave(cola_target) const &&=delete
std::shared_ptr< target_type const > main_pointer
Definition cola_index.h:324
main_pointer main_
Definition cola_index.h:377
borrowed_array const & borrowed(cola_target route) const &
Definition cola_index.h:343
std::array< rank_groups< group_size >, 2 > ranks_
Definition cola_index.h:380
native_array const & native() const &&=delete
cola_index(cola_index &&)=default
std::span< std::uint64_t const > cut_lcps(unsigned) const &&=delete
std::span< std::byte const > false_borrow_bits(cola_target) const &&=delete
native_pointer secondary_target() const noexcept
Definition cola_index.h:358
rank_groups< group_size > const & interleave(unsigned) const &&=delete
void require_active() const
Definition cola_index.h:384
std::span< std::byte const > false_borrow_bits(unsigned) const &&=delete
P policy_type
Definition cola_index.h:316
cola_index & operator=(cola_index const &)=delete
static pair_type prepare_root(pair_type main={}, native_pointer secondary={})
Definition cola_index.h:665
cola_index(native_pointer native, main_pointer main, native_pointer secondary, std::array< borrowed_array, 2 > borrowed, std::array< rank_groups< group_size >, 2 > ranks, std::array< std::vector< std::byte >, 2 > flags, std::array< std::vector< std::uint64_t >, 2 > cuts, std::uint64_t count)
Definition cola_index.h:387
view_type view() const &&=delete
Definition cola_index.h:94
std::array< std::optional< profile_blob_borrowed_predecessor< P > >, 2 > predecessors
Definition cola_index.h:96
std::uint64_t native_ordinal
Definition cola_index.h:95
Definition cola_index.h:466
std::shared_ptr< Target const > target
Definition cola_index.h:466
Definition cola_index.h:420
cola_sample_view< P > peek() const &&=delete
cola_sample_cursor(std::shared_ptr< Target const > target)
Definition cola_index.h:422
cola_sample_cursor(binding source)
Definition cola_index.h:477
static binding bind(std::shared_ptr< Target const > target)
Definition cola_index.h:472
decltype(std::declval< Target const & >().view()) view_type
Definition cola_index.h:463
std::array< borrowed_cursor, 2 > borrowed_
Definition cola_index.h:469
std::optional< bit_comparison > advance_comparison()
Definition cola_index.h:436
P policy_type
Definition cola_index.h:421
std::uint64_t count_
Definition cola_index.h:471
decltype(std::declval< typename view_type::native_view >().cursor()) native_cursor
Definition cola_index.h:464
std::optional< bit_comparison > advance_impl()
Definition cola_index.h:439
native_cursor native_
Definition cola_index.h:468
std::shared_ptr< Target const > target_
Definition cola_index.h:467
cola_detail::frontier_selection choose() const
Definition cola_index.h:481
decltype(std::declval< typename view_type::borrowed_view >().cursor()) borrowed_cursor
Definition cola_index.h:465
bool done() const noexcept
Definition cola_index.h:423
cola_sample_view< P > peek() const &
Definition cola_index.h:425
std::shared_ptr< Target const > target() const noexcept
Definition cola_index.h:424
Definition cola_index.h:302
bit_view key
Definition cola_index.h:303
typename Native::stream_family type
Definition cola_index.h:107
Definition cola_index.h:105
Definition cola_index.h:89
std::array< std::optional< profile_blob_borrowed_predecessor< P > >, 2 > predecessors
Definition cola_index.h:91
std::optional< profile_blob_native_match< P > > native
Definition cola_index.h:90
Definition cola_index.h:85
std::array< std::uint64_t, 2 > borrowed_first
Definition cola_index.h:87
std::uint64_t native_last
Definition cola_index.h:86
std::array< std::uint64_t, 2 > borrowed_last
Definition cola_index.h:87
std::uint64_t native_first
Definition cola_index.h:86
Definition profile_blob.h:52
profile_query_context< P > comparison
Definition profile_blob.h:57
std::uint64_t target_ordinal
Definition profile_blob.h:55
Definition profile_blob.h:45
Definition profile.h:1280
std::uint64_t ordinal
Definition profile.h:459
Definition native_writer.h:158
void append(bit_view key, bit_view value, std::optional< std::uint64_t > retained_limit_bits={})
Definition native_writer.h:181
profile_array< P > finish()
Definition native_writer.h:208
int order() const noexcept
Definition profile.h:352
profile_query_context predecessor(std::uint64_t lcp_bits) const
Definition profile.h:437
Definition cola_index.h:99
Definition rank_groups.h:241
Definition word_view.h:31