pub struct PermSet(/* private fields */);Expand description
Which permutations a file stores — a 6-bit set over
IndexPermutation::section_index, recorded in the header so a reader
never has to assume six.
Every legal set is a superset of PermSet::CORE = {SPO, POS, OSP}. That
is not a convention: those three tie the longest bound prefix on all eight
triple-pattern shapes, so GraphIndex::best_permutation never selects
outside them and a lean file routes every pattern exactly where a full one
does — same tiles, same rows. What the other three (SOP, PSO, OPS) add is a
sort order: they let GraphIndex::permutation_sorted_on hand a
sort-merge join a co-sorted stream for three of the twelve
(bound-set, join-column) shapes it otherwise has to hash-join. Absent, the
merge seed declines and the hash path answers — the cost is a fast path,
never correctness (bgp::try_merge_join already returns Option).
CORE is the smallest legal set, PermSet::ALL is the default and what
every file written before this existed carries.
Implementations§
Source§impl PermSet
impl PermSet
Sourcepub const CORE: PermSet
pub const CORE: PermSet
The three routing permutations {SPO, POS, OSP}: every pattern shape routes as well as it does with six, no merge-join sort orders.
Sourcepub fn from_bits(bits: u8) -> Result<PermSet, &'static str>
pub fn from_bits(bits: u8) -> Result<PermSet, &'static str>
Parse a raw mask. Err when it is not a superset of PermSet::CORE
or addresses a permutation this build has no section index for — a
pattern would then route to a permutation the file does not carry, which
is the one failure mode that must never be silent.
Sourcepub fn contains(self, perm: IndexPermutation) -> bool
pub fn contains(self, perm: IndexPermutation) -> bool
Is perm stored in this file?
Sourcepub fn is_empty(self) -> bool
pub fn is_empty(self) -> bool
Never true: every legal set contains PermSet::CORE. Present because
a public len without it is a clippy error, and the honest answer is
more useful than an allow.
Sourcepub fn iter(self) -> impl Iterator<Item = IndexPermutation>
pub fn iter(self) -> impl Iterator<Item = IndexPermutation>
The stored permutations in [ALL_PERMS] (= container) order.
Sourcepub fn position(self, perm: IndexPermutation) -> Option<usize>
pub fn position(self, perm: IndexPermutation) -> Option<usize>
perm’s position inside the index container, which is its rank
among the stored permutations — not IndexPermutation::section_index,
which is its slot in the format’s fixed six-wide addressing. The two
coincide only for PermSet::ALL.
Sourcepub fn has_merge_orders(self) -> bool
pub fn has_merge_orders(self) -> bool
Does this set carry the three merge-join orders?