repo

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2018 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoResult - search has no result
	ErrNoResult = errors.New("no result")
)

Functions

This section is empty.

Types

type Repo

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

Repo content is saved to the disk.

func New

func New(path string, maxEntries int) *Repo

New repo object.

func (*Repo) Add

func (r *Repo) Add(path string, t time.Time)

Add path to repo. If the path is known, the repo data is updated, else a new entry will be created.

func (*Repo) List

func (r *Repo) List(q pref.Query, cutLong bool) rated.Slice

List returns all RatedSlice for the query q.

func (*Repo) Load

func (r *Repo) Load(datadir string)

Load from dir, or create directory if not existent.

func (*Repo) Save

func (r *Repo) Save() error

Save repo map to dataPath.

func (*Repo) Search

func (r *Repo) Search(ch ResourceChecker, q pref.Query) (*rated.Rated, error)

Search repo for query.

func (*Repo) Size

func (r *Repo) Size() int

Size of the repository.

func (*Repo) Walk

func (r *Repo) Walk(root string)

Walk adds directories from root, for count of Repo.maxEntries, osWalker.lvlDeep.

type ResourceChecker

type ResourceChecker interface {
	DoesExist(string) bool
}

ResourceChecker returns true when a resource exists.

Jump to

Keyboard shortcuts

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