groundstrike

package
v0.0.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package groundstrike provides typed, transport-independent source indexing and retrieval. Callers own workspace policy and lifecycle scheduling.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIndexUnavailable = errors.New("code index unavailable")
	ErrStorageExhausted = errors.New("disk storage exhausted")
	ErrWriterOwned      = errors.New("code index writer is owned by another process")
	ErrStale            = errors.New("code index stale")
	ErrCapacity         = errors.New("code index capacity exceeded")
	ErrPathDenied       = errors.New("code index path denied")
)

Functions

This section is empty.

Types

type Batch

type Batch struct {
	RootID         RootID
	SnapshotDigest string
	Files          []FileRecord
	Stream         FileBatchSource
	Retain         []string
	Deleted        []string
	Skipped        []Skip
}

type Chunk

type Chunk struct {
	Ordinal   int
	StartLine int
	EndLine   int
	Content   string
	Hash      string
}

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func New

func New(options Options) (*Engine, error)

func (*Engine) Outline

func (e *Engine) Outline(ctx context.Context, path string) ([]Symbol, error)

func (*Engine) Reconcile

func (e *Engine) Reconcile(ctx context.Context) (Report, error)

func (*Engine) Search

func (e *Engine) Search(ctx context.Context, query SearchQuery) ([]SearchHit, error)

func (*Engine) Status

func (e *Engine) Status(ctx context.Context) (Status, error)

type File

type File struct {
	RootID    RootID
	Path      string
	Size      int64
	MTimeNS   int64
	ModeClass ModeClass
	Language  string
}

type FileBatchSource

type FileBatchSource func(ctx context.Context, yield func([]FileRecord) error) error

FileBatchSource synchronously prepares bounded record batches before a Store enters its writer transaction. Each slice is borrowed only for the duration of yield; implementations must consume or copy it before yield returns. Each yielded batch independently must satisfy the Store's batch-byte limit.

type FileRecord

type FileRecord struct {
	File
	ContentHash string
	Chunks      []Chunk
	Symbols     []Symbol
}

type Generation

type Generation struct {
	ID        int64
	Digest    string
	CreatedAt time.Time
}

type IndexedFile

type IndexedFile struct {
	File
	ContentHash string
}

type MatchKind

type MatchKind string
const (
	MatchLexical MatchKind = "lexical"
	MatchSymbol  MatchKind = "symbol"
)

type ModeClass

type ModeClass string
const (
	ModeText ModeClass = "text"
)

type Options

type Options struct {
	RootID            RootID
	Source            Source
	Store             Store
	Workers           int
	MaxFileBytes      int64
	MaxBatchBytes     int64
	MaxFiles          int
	ChunkBytes        int
	ChunkLines        int
	MaxSymbolsPerFile int
	MaxResults        int
	MaxQueryBytes     int
	MaxQueryTerms     int
	MaxQueryTermBytes int
	MaxExcerptBytes   int
}

type Report

type Report struct {
	Generation Generation
	Scanned    int
	Changed    int
	Retained   int
	Deleted    int
	Skipped    map[SkipReason]int
}

type RootID

type RootID string

type SearchHit

type SearchHit struct {
	Path        string
	StartLine   int
	EndLine     int
	Excerpt     string
	Rank        float64
	Kind        MatchKind
	Symbol      string
	Generation  Generation
	ContentHash string
}

type SearchQuery

type SearchQuery struct {
	RootID          RootID
	Text            string
	PathPrefix      string
	Limit           int
	MaxExcerptBytes int
}

type Skip

type Skip struct {
	Path   string
	Reason SkipReason
	Detail string
}

type SkipReason

type SkipReason string
const (
	SkipIgnored     SkipReason = "ignored"
	SkipBinary      SkipReason = "binary"
	SkipOversized   SkipReason = "oversized"
	SkipUnreadable  SkipReason = "unreadable"
	SkipPathDenied  SkipReason = "path_denied"
	SkipSecret      SkipReason = "secret"
	SkipCapacity    SkipReason = "capacity"
	SkipParseError  SkipReason = "parse_error"
	SkipSpecialFile SkipReason = "special_file"
)

type Snapshot

type Snapshot struct {
	RootID  RootID
	Files   []File
	Skipped []Skip
	Digest  string
}

type Source

type Source interface {
	Snapshot(ctx context.Context) (Snapshot, error)
	Read(ctx context.Context, file File) ([]byte, error)
}

type State

type State string
const (
	StateDisabled    State = "disabled"
	StateOpening     State = "opening"
	StateReconciling State = "reconciling"
	StateReady       State = "ready"
	StateDegraded    State = "degraded"
	StateStopping    State = "stopping"
)

type Status

type Status struct {
	RootID     RootID
	State      State
	Generation Generation
	Fresh      bool
	LastError  string
	Files      int
	Chunks     int
	Symbols    int
}

type Store

type Store interface {
	Files(ctx context.Context, rootID RootID) ([]IndexedFile, error)
	Reconcile(ctx context.Context, batch Batch) (Generation, error)
	Search(ctx context.Context, query SearchQuery) ([]SearchHit, error)
	Outline(ctx context.Context, rootID RootID, path string) ([]Symbol, error)
	Status(ctx context.Context, rootID RootID) (Status, error)
}

type Symbol

type Symbol struct {
	Name      string
	Kind      string
	Signature string
	Receiver  string
	StartLine int
	EndLine   int
}

Directories

Path Synopsis
internal
Package sqliteindex persists complete code-index generations in relational SQLite tables and FTS5.
Package sqliteindex persists complete code-index generations in relational SQLite tables and FTS5.

Jump to

Keyboard shortcuts

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