#[non_exhaustive]pub struct EdgeBelief {
pub source_id: String,
pub target_id: String,
pub edge_type: String,
pub valid_from: String,
pub valid_to: String,
pub branch_id: String,
}Expand description
One lineage’s belief about one edge, at the instant a fold asked (§15.2).
§Why this is a struct and was a five-tuple until 0.14.5
The tuple had nowhere to put branch_id, and that was not a cosmetic
shortfall: D-216 widened
the four SQL folds to partition by (table_name, entity_id, branch_id) so
two lineages’ beliefs about one edge would stay two rows, and then the
composition immediately downstream re-collapsed them, because edge_key
composed source|target|type|valid_from and the map it fed had one slot per
edge key. The widened partition was handing two rows to a container that
could not hold two. That is D-221,
and this type is its fix.
A struct rather than a six-tuple because the next field to arrive should be
additive, which is why it is also #[non_exhaustive] — the same call
D-207 made for
DbError, one release earlier, for the same reason. Construct these by
reading a MaterializedState; the crate is the only writer.
Ordered by the tuple order of its fields, so a Vec<EdgeBelief> sorts to
a canonical form and two reconstructions of the same instant are equal
rather than merely equivalent — a property the snapshot suite compares on.
§Constructing one
#[non_exhaustive] means no crate but this one may write the literal, and
save_snapshot is public and takes a
MaterializedState — so without a constructor the attribute would not make
the next field additive, it would make a public function uncallable. Use
EdgeBelief::new, which takes the five fields that were the tuple and
defaults the sixth to the trunk, with EdgeBelief::on_branch for the
rest. That is EdgeAssertion::new’s
shape, deliberately: the two are the same fact travelling in opposite
directions and should not need two idioms.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.source_id: String§target_id: String§edge_type: String§valid_from: String§valid_to: String§branch_id: StringThe lineage that holds this belief (0.14.5, D-221).
#[serde(default = "default_branch")] so the field is additive at the
bincode level. It is belt and braces — the snapshot container refuses any
file whose format version is not this build’s, and 0.14.5 bumps it
precisely so a state written without this field gets a named refusal
rather than a deserialisation error — but a default that is right costs
nothing and 'main' is what every pre-v12 row actually carried.
Implementations§
Source§impl EdgeBelief
impl EdgeBelief
Sourcepub fn new(
source_id: impl Into<String>,
target_id: impl Into<String>,
edge_type: impl Into<String>,
valid_from: impl Into<String>,
valid_to: impl Into<String>,
) -> Self
pub fn new( source_id: impl Into<String>, target_id: impl Into<String>, edge_type: impl Into<String>, valid_from: impl Into<String>, valid_to: impl Into<String>, ) -> Self
A belief held by the trunk. Use Self::on_branch for any other.
Five arguments rather than six because main is what every belief
written before 0.14.5 carried, so a caller porting a five-tuple wraps it
and is correct rather than being asked a question the old shape could
not have answered.
Sourcepub fn on_branch(self, branch_id: impl Into<String>) -> Self
pub fn on_branch(self, branch_id: impl Into<String>) -> Self
The lineage holding this belief.
Unchecked against branches, because this type is a value and not a
write: a MaterializedState naming a lineage the register has never
heard of is a snapshot that will disagree with the log, which
verify_snapshot_chain is there to report.
Sourcepub fn entity_id(&self) -> String
pub fn entity_id(&self) -> String
The log entity_id this belief was folded under.
Must match trg_links_log_insert’s
source_id || '|' || target_id || '|' || edge_type || '|' || valid_from
exactly, or a delta row will fail to replace the snapshot row it
supersedes. Safe because ULIDs are Crockford base32 and edge types are
[A-Z0-9]+, so | cannot occur inside a component (§4.3).
This is not a unique key across lineages and must not be used as one
— see Self::belief_key, which is.
Sourcepub fn belief_key(&self) -> String
pub fn belief_key(&self) -> String
What identifies this belief: the edge key and the lineage holding it.
Trait Implementations§
Source§impl Clone for EdgeBelief
impl Clone for EdgeBelief
Source§fn clone(&self) -> EdgeBelief
fn clone(&self) -> EdgeBelief
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EdgeBelief
impl Debug for EdgeBelief
Source§impl<'de> Deserialize<'de> for EdgeBelief
impl<'de> Deserialize<'de> for EdgeBelief
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for EdgeBelief
Source§impl Hash for EdgeBelief
impl Hash for EdgeBelief
Source§impl Ord for EdgeBelief
impl Ord for EdgeBelief
Source§fn cmp(&self, other: &EdgeBelief) -> Ordering
fn cmp(&self, other: &EdgeBelief) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for EdgeBelief
impl PartialEq for EdgeBelief
Source§impl PartialOrd for EdgeBelief
impl PartialOrd for EdgeBelief
Source§impl Serialize for EdgeBelief
impl Serialize for EdgeBelief
impl StructuralPartialEq for EdgeBelief
Auto Trait Implementations§
impl Freeze for EdgeBelief
impl RefUnwindSafe for EdgeBelief
impl Send for EdgeBelief
impl Sync for EdgeBelief
impl Unpin for EdgeBelief
impl UnsafeUnpin for EdgeBelief
impl UnwindSafe for EdgeBelief
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request