Skip to main content

EdgeAssertion

Struct EdgeAssertion 

Source
#[non_exhaustive]
pub struct EdgeAssertion { pub source: String, pub target: String, pub edge_type: String, pub valid_from: String, pub valid_to: String, pub weight: f64, pub properties: String, pub branch: Option<BranchId>, }
Expand description

Edge assertion builder for assert / retire / re-assert lifecycle operations.

§#[non_exhaustive] since 0.14.8, and what that costs

branch is the first field added to this struct since it was written, and adding a public field to a struct with all-public fields is already a break: EdgeAssertion { source, target, .. } as a literal stops compiling. Taking #[non_exhaustive] in the same release converts a break that will recur into one that happens once — the builder (new and the setters) is the documented path, is what every caller in this crate and its bindings uses, and keeps working untouched. EdgeBelief took the same treatment at 0.14.5 for the same reason (D-222).

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: String§target: String§edge_type: String§valid_from: String§valid_to: String§weight: f64§properties: String§branch: Option<BranchId>

The lineage this assertion is made on, or None for the trunk (§15.4, D-225).

None and Some(BranchId::main()) name the same lineage and are not distinguished by the write, which is deliberate: main is a branch like any other and a caller who spells it out should get exactly what a caller who left it unset gets. What None buys is on the cost side — the write path can take the pre-0.14.8 statement, with no branch existence check and no second parameter, so a database that never forks pays nothing for a column it cannot vary. See Database::assert_edge.

Implementations§

Source§

impl EdgeAssertion

Source

pub fn new( source: impl Into<String>, target: impl Into<String>, edge_type: impl Into<String>, ) -> Self

Source

pub fn valid_from(self, ts: impl Into<String>) -> Self

When the asserted fact starts being true (valid time, Doctrine II).

Source

pub fn valid_to(self, ts: impl Into<String>) -> Self

When the asserted fact stops being true. Defaults to the open sentinel.

Source

pub fn weight(self, weight: f64) -> Self

Source

pub fn properties(self, json: impl Into<String>) -> Self

Source

pub fn on_branch(self, branch: BranchId) -> Self

Assert this edge on branch rather than on the trunk (0.14.8, §15.4).

The same name the read side takes (TraversalBuilder::on_branch), because it is the same question asked of the other half: which lineage is this about. Until 0.14.8 only the read could ask it, and a caller who forked and then asserted got a successful write on the trunk — the gap Database::fork’s rustdoc has named since 0.14.7 and this closes.

§This writes a row beside the ancestor’s, never over it

links_current is keyed (source_id, target_id, edge_type, valid_from, branch_id), so an assertion on a branch about an edge it inherited adds the branch’s own row and leaves the parent’s untouched. That is the whole storage cost of divergence, and it is what makes the parent’s history unchanged by anything a branch does — Doctrine III is not a policy the write path enforces here, it is a shape the key makes unrepresentable.

The read resolves the two by nearest lineage (D-220), so the branch sees its own and the trunk keeps seeing the trunk’s.

Source

pub fn normalized(self) -> Result<Self>

Check the assertion and put its timestamps in canonical form (D-029).

Runs before the write reaches the actor, so a malformed edge type or a second-precision timestamp comes back as a typed error rather than as an engine CHECK failure from the other side of a channel — by which point the caller has lost the context that would explain it.

Trait Implementations§

Source§

impl Clone for EdgeAssertion

Source§

fn clone(&self) -> EdgeAssertion

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 EdgeAssertion

Source§

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

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

impl PartialEq for EdgeAssertion

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EdgeAssertion

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<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