Skip to main content

EdgeBelief

Struct EdgeBelief 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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: String

The 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

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> EdgeBelief

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EdgeBelief

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EdgeBelief

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for EdgeBelief

Source§

impl Hash for EdgeBelief

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for EdgeBelief

Source§

fn cmp(&self, other: &EdgeBelief) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for EdgeBelief

Source§

fn eq(&self, other: &EdgeBelief) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for EdgeBelief

Source§

fn partial_cmp(&self, other: &EdgeBelief) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for EdgeBelief

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for EdgeBelief

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more