Documentation
¶
Overview ¶
package build implements a more convenient interface for building zoekt indices.
Index ¶
- Variables
- func BranchNamesEqual(a, b []zoekt.RepositoryBranch) bool
- type Branch
- type Builder
- type IndexState
- type Options
- func (o *Options) Args() []string
- func (o *Options) FindAllShards() []string
- func (o *Options) FindRepositoryMetadata() (repository *zoekt.Repository, ok bool, err error)
- func (o *Options) Flags(fs *flag.FlagSet)
- func (o *Options) HashOptions() string
- func (o *Options) IgnoreSizeMax(name string) bool
- func (o *Options) IncrementalSkipIndexing() bool
- func (o *Options) IndexState() (IndexState, string)
- func (o *Options) SetDefaults()
Constants ¶
This section is empty.
Variables ¶
var DefaultDir = filepath.Join(os.Getenv("HOME"), ".zoekt")
Functions ¶
func BranchNamesEqual ¶
func BranchNamesEqual(a, b []zoekt.RepositoryBranch) bool
BranchNamesEqual compares the given zoekt.RepositoryBranch slices, and returns true iff both slices specify the same set of branch names in the same order.
Types ¶
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 ¶
NewBuilder creates a new Builder instance.
func (*Builder) Finish ¶
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.
It is safe to call Finish() multiple times.
func (*Builder) MarkFileAsChangedOrRemoved ¶
MarkFileAsChangedOrRemoved indicates that the file specified by the given path has been changed or removed since the last indexing job for this repository.
If this build is a delta build, these files will be tombstoned in the older shards for this repository.
type IndexState ¶
type IndexState string
const ( IndexStateMissing IndexState = "missing" IndexStateCorrupt IndexState = "corrupt" IndexStateVersion IndexState = "version-mismatch" IndexStateOption IndexState = "option-mismatch" IndexStateMeta IndexState = "meta-mismatch" IndexStateContent IndexState = "content-mismatch" IndexStateEqual IndexState = "equal" )
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 // DisableCTags disables the generation of ctags metadata. DisableCTags bool // 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 // IsDelta is true if this run contains only the changed documents since the // last run. IsDelta bool // contains filtered or unexported fields }
Options sets options for the index building.
func (*Options) FindAllShards ¶
func (*Options) FindRepositoryMetadata ¶
func (o *Options) FindRepositoryMetadata() (repository *zoekt.Repository, ok bool, err error)
FindRepositoryMetadata returns the index metadata for the repository specified in the options. 'ok' is false if the repository's metadata couldn't be found or if an error occurred.
func (*Options) HashOptions ¶
HashOptions creates a hash of the options that affect an index.
func (*Options) IgnoreSizeMax ¶
IgnoreSizeMax determines whether the max size should be ignored.
func (*Options) IncrementalSkipIndexing ¶
IncrementalSkipIndexing returns true if the index present on disk matches the build options.
func (*Options) IndexState ¶
func (o *Options) IndexState() (IndexState, string)
IndexState checks how the index present on disk compares to the build options and returns the IndexState and the name of the first shard.
func (*Options) SetDefaults ¶
func (o *Options) SetDefaults()
SetDefaults sets reasonable default options.