fsnotify

package
v0.0.0-...-406b276 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRemoveEvent

func IsRemoveEvent(event fsnotify.Event) bool

Check if event is a deletion event using the fsnotify.Remove flag.

func RouteWatch

func RouteWatch(ctx context.Context, logger *zap.Logger, rootAbsDir string, globManager FilepathChecker, eventReciever chan<- Event) error

Watches the specified directory or files changed.

Not that it is designed to be executed persistently.

Types

type Event

type Event = fsnotify.Event

type FilepathChecker

type FilepathChecker interface {
	// Check if a file path meets the include/exclude conditions.
	// If it does not satisfy either conditions, will return [FilepathCheckerDefault].
	IsInclude(absFilepath string) (FilepathCheckerResult, error)
}

Check if a file path meets the include/exclude conditions. If it does not satisfy either conditions, will return [FilepathCheckerDefault].

type FilepathCheckerResult

type FilepathCheckerResult int

Types result of checking path with glob rules in GlobRuleManager.

const (
	GlobRuleDefault FilepathCheckerResult = iota
	GlobRuleInclude
	GlobRuleExclude
)

type GlobRuleManager

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

func NewGlobRuleManager

func NewGlobRuleManager(rootDir string, prefferedRule GlobRuleType, includeGlobRules, excludeGlobRules []string) (*GlobRuleManager, error)

func (*GlobRuleManager) IsInclude

func (m *GlobRuleManager) IsInclude(path string) (FilepathCheckerResult, error)

Check if a file path meets the include/exclude conditions. If it does not satisfy either conditions, will return [FilepathCheckerDefault].

type GlobRuleType

type GlobRuleType bool

Types for file path glob rule (include/exclude).

const (
	GlobIncludeRule GlobRuleType = false
	GlobExcludeRule GlobRuleType = true
)

Jump to

Keyboard shortcuts

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