service

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

@index Full graph build pipeline: spool, batch persistence, and edge resolution.

@index Filesystem walking, per-file parsing, and unreadable-file accounting.

@index Existing-graph file-state loading and change/force detection.

@index Graph building service that orchestrates parsing, persistence, and search indexing.

@index Language package discovery and package-level semantic edge maintenance.

@index Search-document refresh and FTS content generation.

@index Disk-backed spool records used to bound memory during build and update.

@index Incremental update pipeline: spool replay, deletions, and affected-node tracking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckParseFileSize

func CheckParseFileSize(relPath string, size int64, maxFileBytes int64) error

@intent reject individual files that exceed the configured per-file parse budget before loading them into memory.

func CheckTotalParsedBytes

func CheckTotalParsedBytes(relPath string, current int64, next int64, maxTotalBytes int64) error

@intent stop one build or update pass once cumulative parsed bytes would exceed the configured safety limit.

func ExistingGraphFiles

func ExistingGraphFiles(ctx context.Context, db *gorm.DB) ([]string, error)

ExistingGraphFiles returns namespace-scoped graph file paths currently stored. @intent share deletion-scope discovery across CLI and MCP incremental updates

func RefreshSearchDocuments

func RefreshSearchDocuments(ctx context.Context, db *gorm.DB) (int, error)

RefreshSearchDocuments rebuilds namespace-scoped search_documents from current graph nodes. @intent keep derived search documents consistent with graph state before FTS rebuilds

func RefreshSearchDocumentsFor

func RefreshSearchDocumentsFor(ctx context.Context, db *gorm.DB, nodeIDs []uint) (int, error)

RefreshSearchDocumentsFor rebuilds search_documents for the specified node IDs only. @intent incremental update 경로에서 영향받은 문서만 갱신한다.

Types

type BuildOptions

type BuildOptions struct {
	Dir                 string
	NoRecursive         bool
	ExcludePatterns     []string
	IncludePaths        []string
	MaxFileBytes        int64
	MaxTotalParsedBytes int64
	SkipSearchRebuild   bool
	FallbackCalls       bool
}

BuildOptions configures one graph build run. @intent 빌드 대상 경로와 탐색 범위를 호출자에서 제어하게 한다.

type BuildStats

type BuildStats struct {
	TotalFiles int
	TotalNodes int
	TotalEdges int
	Unresolved edgeresolve.FilterResolvedDiagnostics
}

BuildStats reports how much content a build processed. @intent CLI와 호출자가 빌드 결과 규모를 사용자에게 보여줄 수 있게 한다.

type GraphService

type GraphService struct {
	Store         store.GraphStore
	DB            *gorm.DB
	SearchBackend search.Backend
	Walkers       map[string]*treesitter.Walker
	Parsers       map[string]Parser
	Logger        *slog.Logger
	// contains filtered or unexported fields
}

GraphService orchestrates graph building and search document refresh. @intent 파싱 결과 저장과 검색 인덱스 재구성을 하나의 서비스로 묶는다.

func (*GraphService) Build

func (s *GraphService) Build(ctx context.Context, opts BuildOptions) (BuildStats, error)

Build walks source files, stores parsed graph data, and rebuilds search docs. @intent perform a full graph build from the specified directory. @sideEffect 파일 시스템을 읽고 그래프 저장소·DB·검색 인덱스를 갱신한다.

func (*GraphService) Update

Update incrementally syncs changed files into the graph and optionally rebuilds search. @intent centralize file collection, include path, parse limit, and search policy for update callers

type IncrementalSyncer

type IncrementalSyncer interface {
	SyncWithExisting(ctx context.Context, files map[string]incremental.FileInfo, existingFiles []string) (*incremental.SyncStats, error)
}

IncrementalSyncer defines the sync operation GraphService.Update delegates to. @intent keep filesystem/build policy in service while preserving the existing incremental engine

type Parser

type Parser interface {
	Parse(filePath string, content []byte) ([]model.Node, []model.Edge, error)
	ParseWithContext(ctx context.Context, filePath string, content []byte) ([]model.Node, []model.Edge, error)
}

Parser defines the minimum parser behavior required by graph builds. @intent let CLI, MCP, and tests share the same build policy with their parser implementations

type UnreadableFilesError

type UnreadableFilesError struct {
	Files []string
}

UnreadableFilesError signals that the update path encountered files it could not stat or read while FailOnUnreadable was enabled. @intent give webhook/server callers a structured failure they can surface instead of silent partial sync

func (*UnreadableFilesError) Error

func (e *UnreadableFilesError) Error() string

Error formats the unreadable file failure with a count and a representative sample path. @intent give operators a stable, single-line summary they can grep instead of dumping every path.

type UpdateOptions

type UpdateOptions struct {
	BuildOptions
	Syncer           IncrementalSyncer
	Replace          bool
	FailOnUnreadable bool
}

UpdateOptions configures one incremental graph sync run. @intent reuse GraphService traversal and parse limit policy for CLI and MCP updates

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL