pub struct EdgeId {
pub src: NodeId,
pub dst: NodeId,
pub label: String,
pub seq: u64,
}Expand description
Identifies a graph edge. Returned by graph_insert_edge.
An edge is uniquely identified by (src, dst, label, seq). The seq
field disambiguates parallel edges — multiple edges that share the same
(src, dst, label) bucket. seq = 0 means “the first (or only) edge
in this bucket”. The engine-side allocator that assigns monotonically
increasing seq values is a follow-up TODO; until it is wired in,
callers use seq = 0 via EdgeId::try_first.
§Wire format
Serialization uses the structured fields (serde / zerompk).
The Display / FromStr impl uses the length-prefixed text form
"{src_len}:{src}|{label_len}:{label}|{dst_len}:{dst}|{seq}" — unambiguous
even when node IDs or labels contain |, :, or -- characters.
The Display form is used only for logging and the pgwire DELETE path.
Fields§
§src: NodeIdSource node identifier.
dst: NodeIdDestination node identifier.
label: StringEdge label / relationship type (e.g. "KNOWS", "RELATES_TO").
seq: u64Sequence number within the (src, dst, label) bucket.
0 = “the only edge in this bucket (for now)”.
Engine-side allocation of monotonically increasing seq values is a
TODO — see nodedb/src/engine/graph/ for the follow-up location.
Implementations§
Source§impl EdgeId
impl EdgeId
Sourcepub fn try_first(
src: NodeId,
dst: NodeId,
label: impl Into<String>,
) -> Result<Self, IdError>
pub fn try_first( src: NodeId, dst: NodeId, label: impl Into<String>, ) -> Result<Self, IdError>
Create an EdgeId for the first (or only) edge in a (src, dst, label) bucket.
Validates the label against the same rules as NodeId::try_new. Returns
Err(IdError) if the label is empty, too long, or contains a NUL byte.
Node IDs are accepted pre-validated (callers hold NodeId values which
were already validated at construction time).
Sourcepub fn try_with_seq(
src: NodeId,
dst: NodeId,
label: impl Into<String>,
seq: u64,
) -> Result<Self, IdError>
pub fn try_with_seq( src: NodeId, dst: NodeId, label: impl Into<String>, seq: u64, ) -> Result<Self, IdError>
Create an EdgeId with an explicit sequence number.
Validates the label against the same rules as NodeId::try_new. Returns
Err(IdError) if the label is empty, too long, or contains a NUL byte.
Trait Implementations§
Source§impl Archive for EdgeId
impl Archive for EdgeId
Source§const COPY_OPTIMIZATION: CopyOptimization<Self>
const COPY_OPTIMIZATION: CopyOptimization<Self>
serialize. Read moreSource§type Archived = ArchivedEdgeId
type Archived = ArchivedEdgeId
Source§type Resolver = EdgeIdResolver
type Resolver = EdgeIdResolver
Source§impl<'de> Deserialize<'de> for EdgeId
impl<'de> Deserialize<'de> for EdgeId
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>,
Source§impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for EdgeId
impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for EdgeId
Source§impl ToMessagePack for EdgeId
impl ToMessagePack for EdgeId
impl Eq for EdgeId
impl StructuralPartialEq for EdgeId
Auto Trait Implementations§
impl Freeze for EdgeId
impl RefUnwindSafe for EdgeId
impl Send for EdgeId
impl Sync for EdgeId
impl Unpin for EdgeId
impl UnsafeUnpin for EdgeId
impl UnwindSafe for EdgeId
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.Source§impl<T, S> SerializeUnsized<S> for T
impl<T, S> SerializeUnsized<S> for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.