#[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
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
impl EdgeAssertion
pub fn new( source: impl Into<String>, target: impl Into<String>, edge_type: impl Into<String>, ) -> Self
Sourcepub fn valid_from(self, ts: impl Into<String>) -> Self
pub fn valid_from(self, ts: impl Into<String>) -> Self
When the asserted fact starts being true (valid time, Doctrine II).
Sourcepub fn valid_to(self, ts: impl Into<String>) -> Self
pub fn valid_to(self, ts: impl Into<String>) -> Self
When the asserted fact stops being true. Defaults to the open sentinel.
pub fn weight(self, weight: f64) -> Self
pub fn properties(self, json: impl Into<String>) -> Self
Sourcepub fn on_branch(self, branch: BranchId) -> Self
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.
Sourcepub fn normalized(self) -> Result<Self>
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
impl Clone for EdgeAssertion
Source§fn clone(&self) -> EdgeAssertion
fn clone(&self) -> EdgeAssertion
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 EdgeAssertion
impl Debug for EdgeAssertion
Source§impl PartialEq for EdgeAssertion
impl PartialEq for EdgeAssertion
impl StructuralPartialEq for EdgeAssertion
Auto Trait Implementations§
impl Freeze for EdgeAssertion
impl RefUnwindSafe for EdgeAssertion
impl Send for EdgeAssertion
impl Sync for EdgeAssertion
impl Unpin for EdgeAssertion
impl UnsafeUnpin for EdgeAssertion
impl UnwindSafe for EdgeAssertion
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<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