build

package
v0.0.0-...-f8e8ada Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Overview

package build implements a more convenient interface for building zoekt indices.

Index

Constants

This section is empty.

Variables

View Source
var DefaultDir = filepath.Join(os.Getenv("HOME"), ".zoekt")

Functions

This section is empty.

Types

type Branch

type Branch struct {
	Name    string
	Version string
}

Branch describes a single branch version.

type Builder

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

Builder manages (parallel) creation of uniformly sized shards. The builder buffers up documents until it collects enough documents and then builds a shard and writes.

func NewBuilder

func NewBuilder(opts Options) (*Builder, error)

NewBuilder creates a new Builder instance.

func (*Builder) Add

func (b *Builder) Add(doc zoekt.Document) error

func (*Builder) AddFile

func (b *Builder) AddFile(name string, content []byte) error

AddFile is a convenience wrapper for the Add method

func (*Builder) Finish

func (b *Builder) Finish() error

Finish creates a last shard from the buffered documents, and clears stale shards from previous runs. This should always be called, also in failure cases, to ensure cleanup.

type Options

type Options struct {
	// IndexDir is a directory that holds *.zoekt index files.
	IndexDir string

	// SizeMax is the maximum file size
	SizeMax int

	// Parallelism is the maximum number of shards to index in parallel
	Parallelism int

	// ShardMax sets the maximum corpus size for a single shard
	ShardMax int

	// TrigramMax sets the maximum number of distinct trigrams per document.
	TrigramMax int

	// RepositoryDescription holds names and URLs for the repository.
	RepositoryDescription zoekt.Repository

	// SubRepositories is a path => sub repository map.
	SubRepositories map[string]*zoekt.Repository

	// Path to exuberant ctags binary to run
	CTags string

	// If set, ctags must succeed.
	CTagsMustSucceed bool

	// Write memory profiles to this file.
	MemProfile string

	// LargeFiles is a slice of glob patterns, including ** for any number
	// of directories, where matching file paths should be indexed
	// regardless of their size. The full pattern syntax is here:
	// https://github.com/bmatcuk/doublestar/tree/v1#patterns.
	LargeFiles []string
}

Options sets options for the index building.

func (*Options) Flags

func (o *Options) Flags(fs *flag.FlagSet)

Flags adds flags for build options to fs.

func (*Options) HashOptions

func (o *Options) HashOptions() string

HashOptions creates a hash of the options that affect an index.

func (*Options) IgnoreSizeMax

func (o *Options) IgnoreSizeMax(name string) bool

IgnoreSizeMax determines whether the max size should be ignored.

func (*Options) IncrementalSkipIndexing

func (o *Options) IncrementalSkipIndexing() bool

IncrementalSkipIndexing returns true if the index present on disk matches the build options.

func (*Options) SetDefaults

func (o *Options) SetDefaults()

SetDefaults sets reasonable default options.

Jump to

Keyboard shortcuts

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