cache

package
v0.0.0-...-ea6fe2d Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReadBatchSize = 1024 * runtime.NumCPU()
)

Functions

func ChangeSet

func ChangeSet(ctx context.Context, walker walk.Walker, filesCh chan<- *walk.File) error

ChangeSet is used to walk a filesystem, starting at root, and outputting any new or changed paths using pathsCh. It determines if a path is new or has changed by comparing against cache entries.

func Close

func Close() error

Close closes any open instance of the cache.

func Open

func Open(treeRoot string, clean bool, formatters map[string]*format.Formatter) (err error)

Open creates an instance of bolt.DB for a given treeRoot path. If clean is true, Open will delete any existing data in the cache.

The database will be located in `XDG_CACHE_DIR/treefmt/eval-cache/<id>.db`, where <id> is determined by hashing the treeRoot path. This associates a given treeRoot with a given instance of the cache.

func Update

func Update(files []*walk.File) error

Update is used to record updated cache information for the specified list of paths.

Types

type Entry

type Entry struct {
	Size     int64
	Modified time.Time
}

Entry represents a cache entry, indicating the last size and modified time for a file path.

Jump to

Keyboard shortcuts

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