Help us shape the future of Go! Take the 2026 Go Developer Survey

indexer

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package indexer assembles deterministic repository snapshots without executing repository code.

Index

Constants

View Source
const MaxSourceBytes = 2 * 1024 * 1024
View Source
const MaxSourceFiles = 10000
View Source
const MaxTotalSourceBytes = 64 << 20

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, repository, revision string, p Provider) (model.Snapshot, error)

Build parses every supported file a provider exposes. Working-tree and committed snapshots share this loop, limits and diagnostics.

func ExcludedPath

func ExcludedPath(p string) bool

ExcludedPath applies one generated and private directory policy to every source.

func Index

func Index(ctx context.Context, root, revision string) (model.Snapshot, error)

Index snapshots the working tree below root. Inside a Git work tree the file list honors .gitignore; otherwise the directory is walked.

Types

type Commit

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

Commit reads an immutable Git commit through a single batch object reader.

func NewCommit

func NewCommit(root, sha string) *Commit

NewCommit prepares a provider for an already resolved commit SHA.

func (*Commit) Close

func (c *Commit) Close() error

Close releases the batch reader.

func (*Commit) Entries

func (c *Commit) Entries(ctx context.Context) ([]Entry, error)

func (*Commit) Method

func (c *Commit) Method() string

func (*Commit) Read

func (c *Commit) Read(ctx context.Context, e Entry, limit int64) ([]byte, error)

type Entry

type Entry struct {
	Path string
	Size int64
	Mode EntryMode
	// contains filtered or unexported fields
}

Entry is one repository path offered by a Provider.

type EntryMode

type EntryMode int

EntryMode classifies a repository entry without following it.

const (
	ModeRegular EntryMode = iota
	ModeSymlink
	ModeSubmodule
	ModeOther
)

type Provider

type Provider interface {
	Method() string
	Entries(ctx context.Context) ([]Entry, error)
	Read(ctx context.Context, e Entry, limit int64) ([]byte, error)
}

Provider supplies repository files from the working tree or a Git commit.

func NewWorktree

func NewWorktree(root string) (Provider, error)

NewWorktree supplies non-ignored repository entries without executing source. Consumers must inspect entry modes and enforce bounded reads.

Jump to

Keyboard shortcuts

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