pub struct Node {
pub key: String,
pub kind: NodeKind,
pub name: String,
pub path: Option<String>,
pub lang: Option<String>,
pub blob_hash: Option<String>,
pub span: Option<Span>,
pub provenance: Provenance,
pub meta: Value,
}Expand description
A node in the knowledge graph.
Node::key is the deterministic natural identity used for upserts (e.g.
sym:rust:src/lib.rs#Store); the database row id is an internal detail.
Fields§
§key: StringDeterministic, unique natural key.
kind: NodeKindThe kind of thing this node represents.
name: StringHuman-facing name (need not be unique).
path: Option<String>Repository-relative source path, if any.
lang: Option<String>Language token (e.g. rust), if applicable.
blob_hash: Option<String>Git blob hash this node was extracted from, if applicable.
span: Option<Span>Byte span within the source blob, if applicable.
provenance: ProvenanceWhich layer produced this node: Provenance::Derived (tree-sitter
extraction), Provenance::Authored (ADR/blueprint/lat sections), or
Provenance::Inferred (Graphify import). Lets layer-scoped operations —
e.g. a derived-only incremental sync — target one layer without
disturbing the others.
Defaults to Derived when absent — correct for a legacy extraction
object-cache entry (derived-only) written before this field existed. A
legacy persisted import layer also deserializes its nodes as Derived,
but the store repairs that on load (an import node is never derived), so
the default never mislabels a durable import layer.
meta: ValueArbitrary structured metadata.
Implementations§
Source§impl Node
impl Node
Sourcepub fn new(
key: impl Into<String>,
kind: NodeKind,
name: impl Into<String>,
) -> Self
pub fn new( key: impl Into<String>, kind: NodeKind, name: impl Into<String>, ) -> Self
Construct a node with the given key, kind, and name; all optional fields
unset, meta null, and provenance Provenance::Derived (extraction is
the common case — authored/inferred producers call Node::with_provenance).
Sourcepub fn with_provenance(self, provenance: Provenance) -> Self
pub fn with_provenance(self, provenance: Provenance) -> Self
Set the producing layer, returning the node (builder style). Used by the authored (ADR/blueprint/lat) and inferred (Graphify) producers.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
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 Node
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.