index

package
v0.0.0-...-129dccd Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointFilter

type EndpointFilter func(ep *transport.Endpoint) bool

EndpointFilter is a function that returns true if the given endpoint should be included for indexing when scanning.

type Index

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

Index is an index of repository locations.

func Open

func Open(f string) (*Index, error)

Open opens the index database at path f.

func (*Index) Add

func (i *Index) Add(dir string) error

Add a clone path to the index.

func (*Index) Close

func (i *Index) Close()

Close closes the index.

func (*Index) Find

func (i *Index) Find(slug string) []string

Find returns a list of paths matching the given slug.

func (*Index) FindByDir

func (i *Index) FindByDir(dir string) (s []string, d string)

FindByDir returns a list of slugs that match dir. dir may be a sub-directory of the clone. d is the indexed directory, i.e. the clone root.

func (*Index) Has

func (i *Index) Has(dir string) (ok bool)

Has returns true if dir is in the index.

func (*Index) ListClones

func (i *Index) ListClones() []string

ListClones returns a list of all clone directories.

func (*Index) ListSlugs

func (i *Index) ListSlugs(p string) []string

ListSlugs returns the slugs that begin with p, which may be empty.

func (*Index) Prune

func (i *Index) Prune(w io.Writer) error

Prune removes directories that no longer exist.

func (*Index) Remove

func (i *Index) Remove(dir string) error

Remove removes a clone path from the index.

func (*Index) Scan

func (i *Index) Scan(
	w io.Writer,
	f EndpointFilter,
	dirs ...string,
) error

Scan recursively indexes dirs.

func (*Index) WriteTo

func (i *Index) WriteTo(w io.Writer) (int64, error)

WriteTo dumps a string representation of the database to w.

Jump to

Keyboard shortcuts

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