detect

package module
v0.0.0-...-e1f4a84 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: ISC Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Verbosity com.Level = com.Common
)

Functions

This section is empty.

Types

type Change

type Change uint8

Change represents the type of a detected modification.

const (
	No Change = iota
	Edit
	Owner
	Group
	Permission
	Size
	Init
	Gone
	Hash
	Bitrot
	Unknown
)

func (Change) String

func (c Change) String() string

type Changes

type Changes []Change

Changes is a collection of detected modifications.

type Difference

type Difference struct {
	Changes  *store.Store[string, Changes]
	Counters *counter.Counters
}

Difference holds information like detected changes and stats.

type FileInfo

type FileInfo struct {
	Mtime       time.Time
	Permissions os.FileMode
	Size        int64
	Owner       uint32
	Group       uint32
	Hash        []byte
}

FileInfo holds meta data about a regular file.

type Root

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

Root is the store.

func New

func New(path string) *Root

New creates a new pointer at a Root for the given path.

func (*Root) Compare

func (r *Root) Compare() (Difference, error)

Compare triggers an additional scan of the files in the directory tree and notifies if it detects changes.

func (*Root) Init

func (r *Root) Init() (*counter.Counters, error)

Init runs the initial scan of the files in the directory tree.

func (*Root) List

func (r *Root) List(pattern string) map[string]FileInfo

List returns a map of the matches against the pattern.

func (*Root) Load

func (r *Root) Load(i io.Reader) error

func (*Root) Save

func (r *Root) Save(w io.Writer) error

func (*Root) WithHash

func (r *Root) WithHash() *Root

WithHash enables the use of xxh3 to collect and compare hashes.

Jump to

Keyboard shortcuts

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