pub struct GraphNode {Show 17 fields
pub chunk_id: String,
pub content_hash: String,
pub primary_alias: Option<String>,
pub aliases: Vec<String>,
pub symbols_defined: Vec<String>,
pub symbols_referenced: Vec<String>,
pub language: String,
pub granularity: String,
pub byte_size: usize,
pub token_estimate: usize,
pub source_file: Option<String>,
pub source_lines: Option<(usize, usize)>,
pub outgoing_edges: Vec<(EdgeType, String)>,
pub incoming_edges: Vec<(EdgeType, String)>,
pub metadata: HashMap<String, String>,
pub created_at: String,
pub updated_at: String,
}Expand description
A node in the dependency graph
Fields§
§chunk_id: StringThe chunk ID (e.g., “chunk:sha256:abc123…”)
content_hash: StringContent hash of the chunk
primary_alias: Option<String>Primary alias for this chunk
aliases: Vec<String>All aliases pointing to this chunk
symbols_defined: Vec<String>Symbols this chunk defines/exports
symbols_referenced: Vec<String>Symbols this chunk references/imports
language: StringLanguage of the chunk
granularity: StringGranularity (function, type, module, etc.)
byte_size: usizeByte size of content
token_estimate: usizeEstimated token count (for LLM budgeting)
source_file: Option<String>Source file location
source_lines: Option<(usize, usize)>Line range in source file
outgoing_edges: Vec<(EdgeType, String)>Outgoing edges (this chunk depends on)
incoming_edges: Vec<(EdgeType, String)>Incoming edges (chunks that depend on this)
metadata: HashMap<String, String>Additional metadata
created_at: StringWhen this node was created
updated_at: StringWhen this node was last updated
Implementations§
Source§impl GraphNode
impl GraphNode
Sourcepub fn new(chunk_id: impl Into<String>, content_hash: impl Into<String>) -> Self
pub fn new(chunk_id: impl Into<String>, content_hash: impl Into<String>) -> Self
Create a new graph node
Sourcepub fn with_alias(self, alias: impl Into<String>) -> Self
pub fn with_alias(self, alias: impl Into<String>) -> Self
Set the primary alias
Sourcepub fn with_language(self, language: impl Into<String>) -> Self
pub fn with_language(self, language: impl Into<String>) -> Self
Set the language
Sourcepub fn with_granularity(self, granularity: impl Into<String>) -> Self
pub fn with_granularity(self, granularity: impl Into<String>) -> Self
Set the granularity
Sourcepub fn with_source(
self,
file: impl Into<String>,
start: usize,
end: usize,
) -> Self
pub fn with_source( self, file: impl Into<String>, start: usize, end: usize, ) -> Self
Set source location
Sourcepub fn with_defines(self, symbols: Vec<String>) -> Self
pub fn with_defines(self, symbols: Vec<String>) -> Self
Add symbols this chunk defines
Sourcepub fn with_references(self, symbols: Vec<String>) -> Self
pub fn with_references(self, symbols: Vec<String>) -> Self
Add symbols this chunk references
Sourcepub fn add_dependency(&mut self, edge_type: EdgeType, target_id: String)
pub fn add_dependency(&mut self, edge_type: EdgeType, target_id: String)
Add an outgoing edge (dependency)
Sourcepub fn add_dependent(&mut self, edge_type: EdgeType, source_id: String)
pub fn add_dependent(&mut self, edge_type: EdgeType, source_id: String)
Add an incoming edge (dependent)
Sourcepub fn dependencies(&self) -> impl Iterator<Item = &String>
pub fn dependencies(&self) -> impl Iterator<Item = &String>
Get all chunks this depends on
Sourcepub fn dependents(&self) -> impl Iterator<Item = &String>
pub fn dependents(&self) -> impl Iterator<Item = &String>
Get all chunks that depend on this
Sourcepub fn dependencies_of_type(&self, edge_type: EdgeType) -> Vec<&String>
pub fn dependencies_of_type(&self, edge_type: EdgeType) -> Vec<&String>
Get dependencies filtered by edge type
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
Deserialize from storage