Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConflict = errors.New("graph: conflict")
ErrConflict indicates a uniqueness violation (e.g. duplicate repo:// URI).
View Source
var ErrNotFound = errors.New("graph: not found")
ErrNotFound indicates the requested node or edge does not exist.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct {
From NodeID `json:"from"`
To NodeID `json:"to"`
Type EdgeType `json:"type"`
Props map[string]string `json:"props,omitempty"`
}
Edge connects two nodes with a typed relationship.
type Node ¶
type Node struct {
ID NodeID `json:"id"`
Kind string `json:"kind"`
Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"`
Props map[string]string `json:"props,omitempty"`
}
Node is a vertex in the code graph.
type Store ¶
type Store interface {
Close() error
PutNode(node Node) error
GetNode(id NodeID) (Node, error)
DeleteNode(id NodeID) error
PutEdge(edge Edge) error
DeleteEdge(from NodeID, to NodeID, edgeType EdgeType) error
// OutEdges returns edges leaving from. If edgeType is non-empty, results are filtered.
OutEdges(from NodeID, edgeType EdgeType) ([]Edge, error)
// InEdges returns edges entering to. If edgeType is non-empty, results are filtered.
InEdges(to NodeID, edgeType EdgeType) ([]Edge, error)
// ForEachNode invokes fn for every node. Iteration stops early if fn returns false.
ForEachNode(fn func(Node) bool) error
// GetNodeByURI resolves a canonical repo:// URI via the secondary unique index.
// Nodes without a URI are not findable this way.
GetNodeByURI(repoURI string) (Node, error)
}
Store persists graph nodes and typed edges.
Click to show internal directories.
Click to hide internal directories.