Documentation
¶
Index ¶
- func EmitContainment(ctx context.Context, e Emitter, parentID, childID string) error
- func EmitOwnership(ctx context.Context, e Emitter, ownerID, ownedID string) error
- func GetScheme(uri string) string
- type CollectingEmitter
- func (e *CollectingEmitter) EmitContainment(ctx context.Context, parentID, childID string) error
- func (e *CollectingEmitter) EmitEdge(ctx context.Context, edge *graph.Edge) error
- func (e *CollectingEmitter) EmitNode(ctx context.Context, node *graph.Node) error
- func (e *CollectingEmitter) EmitOwnership(ctx context.Context, ownerID, ownedID string) error
- type Context
- func (c *Context) AddDirsIndexed(n int)
- func (c *Context) AddFilesIndexed(n int)
- func (c *Context) AddNodesDeleted(n int)
- func (c *Context) AddReposIndexed(n int)
- func (c *Context) DirsIndexed() int64
- func (c *Context) FilesIndexed() int64
- func (c *Context) InBounds(uri string) bool
- func (c *Context) NodesDeleted() int64
- func (c *Context) ReposIndexed() int64
- type CountingEmitter
- type Emitter
- type Event
- type EventType
- type GraphEmitter
- func (e *GraphEmitter) EmitContainment(ctx context.Context, parentID, childID string) error
- func (e *GraphEmitter) EmitEdge(ctx context.Context, edge *graph.Edge) error
- func (e *GraphEmitter) EmitNode(ctx context.Context, node *graph.Node) error
- func (e *GraphEmitter) EmitOwnership(ctx context.Context, ownerID, ownedID string) error
- type Indexer
- type PostIndexer
- type Registry
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitContainment ¶
EmitContainment creates bidirectional containment edges using any Emitter: - contains: parentID → childID (structural containment) - contained_by: childID → parentID (inverse) Use for physical/structural hierarchies (directories, nested structures).
func EmitOwnership ¶
EmitOwnership creates bidirectional ownership edges using any Emitter: - has: ownerID → ownedID (logical ownership) - belongs_to: ownedID → ownerID (inverse) Use when the child cannot exist without the parent (repo→branch, doc→section).
Types ¶
type CollectingEmitter ¶
CollectingEmitter collects nodes and edges for later processing. Useful for testing or batch operations.
func (*CollectingEmitter) EmitContainment ¶
func (e *CollectingEmitter) EmitContainment(ctx context.Context, parentID, childID string) error
EmitContainment creates bidirectional containment edges for testing.
func (*CollectingEmitter) EmitOwnership ¶
func (e *CollectingEmitter) EmitOwnership(ctx context.Context, ownerID, ownedID string) error
EmitOwnership creates bidirectional ownership edges for testing.
type Context ¶
type Context struct {
// Root is the URI where indexing started (defines the boundary).
Root string
// Generation is the current index generation for staleness tracking.
Generation string
// Graph provides access to the existing graph state.
Graph *graph.Graph
// Emitter is where discovered nodes and edges should be emitted.
Emitter Emitter
// Progress is an optional channel for reporting indexing progress.
// If nil, progress reporting is disabled.
Progress chan<- progress.Event
// Events is an optional channel for broadcasting indexer events.
// Other indexers can subscribe to these events to react dynamically.
// If nil, event broadcasting is disabled.
Events chan<- Event
// TriggerEvent is the event that triggered this indexer invocation.
// Nil for direct invocations (primary indexers).
// Set when the indexer is triggered by an event subscription.
TriggerEvent *Event
// contains filtered or unexported fields
}
Context provides the execution environment for an indexer.
func (*Context) AddDirsIndexed ¶
AddDirsIndexed atomically adds n to the count of indexed directories.
func (*Context) AddFilesIndexed ¶
AddFilesIndexed atomically adds n to the count of indexed files.
func (*Context) AddNodesDeleted ¶
AddNodesDeleted atomically adds n to the count of deleted nodes.
func (*Context) AddReposIndexed ¶
AddReposIndexed atomically adds n to the count of indexed repositories.
func (*Context) DirsIndexed ¶
DirsIndexed returns the total number of directories indexed.
func (*Context) FilesIndexed ¶
FilesIndexed returns the total number of files indexed.
func (*Context) InBounds ¶
InBounds returns true if the given URI is within the root boundary. This is used to prevent indexers from traversing outside their scope.
func (*Context) NodesDeleted ¶
NodesDeleted returns the total number of nodes deleted during cleanup.
func (*Context) ReposIndexed ¶
ReposIndexed returns the total number of repositories indexed.
type CountingEmitter ¶
type CountingEmitter struct {
// contains filtered or unexported fields
}
CountingEmitter wraps an Emitter and tracks node counts by type in the Context.
func NewCountingEmitter ¶
func NewCountingEmitter(inner Emitter, ictx *Context) *CountingEmitter
NewCountingEmitter creates an emitter that wraps inner and increments counters in ictx based on emitted node types.
type Emitter ¶
type Emitter interface {
// EmitNode adds or updates a node in the graph.
EmitNode(ctx context.Context, node *graph.Node) error
// EmitEdge adds or updates an edge in the graph.
EmitEdge(ctx context.Context, edge *graph.Edge) error
}
Emitter receives discovered nodes and edges during indexing.
type Event ¶
type Event struct {
// Type is the event type.
Type EventType
// URI is the full URI of the entry.
URI string
// Path is the filesystem path (if applicable).
Path string
// Name is the basename of the entry.
Name string
// NodeType is the type of node (e.g., "fs:dir", "fs:file").
NodeType string
// NodeID is the ID of the emitted node (empty if entry was skipped/ignored).
NodeID string
// Node is the node that was created (if available).
// This allows subscribers to modify the node without a DB round-trip.
Node *graph.Node
}
Event represents an indexing event that other indexers can subscribe to.
type GraphEmitter ¶
type GraphEmitter struct {
// contains filtered or unexported fields
}
GraphEmitter emits nodes and edges directly to a graph.
func NewGraphEmitter ¶
func NewGraphEmitter(g *graph.Graph, generation string) *GraphEmitter
NewGraphEmitter creates an emitter that writes to the given graph.
func (*GraphEmitter) EmitContainment ¶
func (e *GraphEmitter) EmitContainment(ctx context.Context, parentID, childID string) error
EmitContainment creates bidirectional containment edges: - contains: parentID → childID (structural containment) - contained_by: childID → parentID (inverse) Use for physical/structural hierarchies (directories, nested structures).
func (*GraphEmitter) EmitOwnership ¶
func (e *GraphEmitter) EmitOwnership(ctx context.Context, ownerID, ownedID string) error
EmitOwnership creates bidirectional ownership edges: - has: ownerID → ownedID (logical ownership) - belongs_to: ownedID → ownerID (inverse) Use when the child cannot exist without the parent (repo→branch, doc→section).
type Indexer ¶
type Indexer interface {
// Name returns the indexer identifier (e.g., "fs", "git", "golang").
Name() string
// Schemes returns the URI schemes this indexer handles (e.g., ["file"], ["git"]).
Schemes() []string
// Handles returns true if this indexer can process the given URI.
Handles(uri string) bool
// Subscriptions returns the events this indexer subscribes to.
// Return nil or empty slice if this indexer doesn't subscribe to events
// (i.e., it's a primary indexer triggered directly, not by events).
Subscriptions() []Subscription
// Index indexes starting from the root URI in the context.
Index(ctx context.Context, ictx *Context) error
// HandleEvent processes an event from another indexer.
// Called when an event matches one of this indexer's subscriptions.
// The event includes the Node so implementations can avoid DB round-trips.
HandleEvent(ctx context.Context, ictx *Context, event Event) error
}
Indexer discovers and indexes nodes/edges from a specific domain.
type PostIndexer ¶
type PostIndexer interface {
Indexer
// PostIndex is called after all indexers complete their Index() pass.
PostIndex(ctx context.Context, ictx *Context) error
}
PostIndexer is an optional interface for indexers that need a post-processing stage. This is called after all indexers have completed their initial Index() pass, allowing deferred resolution (e.g., resolving local links to files indexed later).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds registered indexers and routes URIs to them.
func (*Registry) ByName ¶ added in v0.6.0
ByName returns the indexer with the given name, or nil if not found.
func (*Registry) ForURI ¶
ForURI returns the first indexer that can handle the given URI. Returns nil if no indexer handles the URI.
func (*Registry) SubscribersFor ¶
SubscribersFor returns all indexers that have a subscription matching the event.
type Subscription ¶
type Subscription struct {
// EventType is the type of event to subscribe to.
EventType EventType
// NodeType filters by node type (empty = all types).
NodeType string
// Name filters by exact entry name match (empty = all names).
Name string
// Pattern filters by glob pattern on the entry name (e.g., "*.md", "test_*.go").
// Empty means no pattern filtering.
Pattern string
// Extensions filters by file extensions (e.g., []string{".md", ".markdown"}).
// Empty means no extension filtering.
Extensions []string
}
Subscription defines what events an indexer wants to receive.
func (Subscription) Matches ¶
func (s Subscription) Matches(e Event) bool
Matches returns true if the event matches this subscription.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package embeddings provides the Provider interface and built-in implementations for generating vector embeddings from text.
|
Package embeddings provides the Provider interface and built-in implementations for generating vector embeddings from text. |
|
commitparser
Package commitparser implements a lenient parser for Conventional Commits (https://www.conventionalcommits.org/).
|
Package commitparser implements a lenient parser for Conventional Commits (https://www.conventionalcommits.org/). |
|
Package golang provides an indexer for Go modules and packages.
|
Package golang provides an indexer for Go modules and packages. |
|
Package project provides an indexer for detecting project types from manifest files.
|
Package project provides an indexer for detecting project types from manifest files. |
|
Package todo indexes TODO/FIXME/HACK/XXX/NOTE annotation comments from source files, emitting one code:todo graph node per matched annotation.
|
Package todo indexes TODO/FIXME/HACK/XXX/NOTE annotation comments from source files, emitting one code:todo graph node per matched annotation. |