Documentation
¶
Index ¶
- type AnnotatingParser
- type FileInfo
- type Parser
- type Store
- type SyncStats
- type Syncer
- func (s *Syncer) SetResolveOptions(opts edgeresolve.ResolveOptions)
- func (s *Syncer) Sync(ctx context.Context, files map[string]FileInfo) (*SyncStats, error)
- func (s *Syncer) SyncWithExisting(ctx context.Context, files map[string]FileInfo, existingFiles []string) (*SyncStats, error)
- func (s *Syncer) SyncWithExistingStore(ctx context.Context, syncStore Store, files map[string]FileInfo, ...) (*SyncStats, error)
- type SyncerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnotatingParser ¶
type AnnotatingParser interface {
Parser
ParseWithComments(ctx context.Context, filePath string, content []byte) ([]model.Node, []model.Edge, []treesitter.CommentBlock, error)
Language() string
}
AnnotatingParser exposes richer parse output needed to restore annotations. @intent allow incremental sync to reuse comment-aware parsing when available
type FileInfo ¶
FileInfo holds change-tracking data for one file. @intent carry file content and hash so sync can detect modifications cheaply
type Parser ¶
type Parser interface {
Parse(filePath string, content []byte) ([]model.Node, []model.Edge, error)
}
Parser parses one file into graph nodes and edges. @intent decouple incremental sync from language-specific parsing logic
type Store ¶
type Store interface {
GetNodesByIDs(ctx context.Context, ids []uint) ([]model.Node, error)
GetNodesByFile(ctx context.Context, filePath string) ([]model.Node, error)
GetNodesByFiles(ctx context.Context, filePaths []string) (map[string][]model.Node, error)
GetNodesByQualifiedNames(ctx context.Context, names []string) (map[string][]model.Node, error)
UpsertNodes(ctx context.Context, nodes []model.Node) error
UpsertEdges(ctx context.Context, edges []model.Edge) error
DeleteNodesByFile(ctx context.Context, filePath string) error
}
Store defines persistence operations needed for incremental sync. @intent abstract graph storage so changed files can be reparsed and upserted
type SyncStats ¶
type SyncStats struct {
Added int
Modified int
Skipped int
Deleted int
Unresolved edgeresolve.FilterResolvedDiagnostics
}
SyncStats summarizes one incremental sync run. @intent report how many files were added, modified, skipped, or deleted
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer incrementally updates graph data for changed files. @intent avoid full rebuilds by reparsing only files whose content hash changed
func New ¶
func New(store Store, parser Parser, opts ...SyncerOption) *Syncer
New creates an incremental syncer. @intent wire storage, parser, and optional configuration into a sync coordinator @ensures returned syncer always has a non-nil logger
func NewWithRegistry ¶
func NewWithRegistry(store Store, parsers map[string]Parser, opts ...SyncerOption) *Syncer
NewWithRegistry creates an incremental syncer with extension-based parser dispatch. @intent support multi-language incremental parsing without breaking the legacy single-parser constructor
func (*Syncer) SetResolveOptions ¶
func (s *Syncer) SetResolveOptions(opts edgeresolve.ResolveOptions)
SetResolveOptions updates edge resolution policy for an existing syncer instance. @intent avoid rebuilding the syncer for every Build/Update invocation.
func (*Syncer) Sync ¶
Sync updates graph data using only the provided file snapshot. @intent run incremental parsing when only current files are known @param files current file snapshot keyed by repository-relative path @see incremental.Syncer.SyncWithExisting
func (*Syncer) SyncWithExisting ¶
func (s *Syncer) SyncWithExisting(ctx context.Context, files map[string]FileInfo, existingFiles []string) (*SyncStats, error)
SyncWithExisting updates graph data and removes files no longer present. @intent reconcile parsed graph state with the latest changed-file snapshot @param files current file snapshot keyed by repository-relative path @param existingFiles previously known file paths used to detect deletions @return counts of added, modified, skipped, and deleted files @sideEffect writes structured logs during sync execution @domainRule unchanged files are skipped when the stored hash matches the incoming hash @mutates graph storage by deleting stale nodes and upserting parsed nodes and edges @ensures deleted files are removed from storage when absent from files
func (*Syncer) SyncWithExistingStore ¶
func (s *Syncer) SyncWithExistingStore(ctx context.Context, syncStore Store, files map[string]FileInfo, existingFiles []string) (*SyncStats, error)
SyncWithExistingStore runs sync with the provided store without mutating the receiver. @intent let callers bind incremental sync to an existing transaction-scoped store
type SyncerOption ¶
type SyncerOption func(*Syncer)
SyncerOption configures a Syncer instance. @intent customize incremental sync behavior without expanding the constructor signature
func WithLogger ¶
func WithLogger(l *slog.Logger) SyncerOption
WithLogger sets the logger used during sync. @intent allow callers to observe incremental sync progress through structured logs @mutates Syncer.logger
func WithParsers ¶
func WithParsers(parsers map[string]Parser) SyncerOption
WithParsers sets extension-based parsers used during sync. @intent let incremental sync dispatch parsing per file extension for multi-language projects