worker

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFileRead means file read error.
	ErrFileRead = errors.New("worker: file read error")

	// ErrYrScan means yr scan error.
	ErrYrScan = errors.New("worker: yr scan error")
)

Functions

func MatchesToStr added in v1.2.2

func MatchesToStr(matches yr.MatchRules) []string

MatchesToStr returns a slice string from given yr.MatcheRules.

Types

type Worker

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

Worker represents a worker. blkSz unit is byte.

func Mock

func Mock(env *env.Env) (*Worker, error)

Mock mocks a worker.

func New

func New(cfg *base.Cfg) (*Worker, error)

New returns a worker from given cfg, rules and max file age.

func (*Worker) Refresh added in v1.4.0

func (worker *Worker) Refresh() error

Refresh updates the worker to use the latest sigs with a new scanner.

func (*Worker) Scan

func (worker *Worker) Scan(path string, result *state.Job)

Scan scans given file path and job state. Results and errs to job state.

func (*Worker) Work

func (worker *Worker) Work(ctx context.Context, state *state.Job, queue chan string)

Work receives given queued paths to scan.

Jump to

Keyboard shortcuts

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