naivewatcher

package
v1.3.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

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

Mutex is the extended mutex

func (*Mutex) IsLocked

func (m *Mutex) IsLocked() bool

IsLocked returs whether the mutex is locked

func (*Mutex) Lock

func (m *Mutex) Lock()

Lock locks the mutex

func (*Mutex) TryLock

func (m *Mutex) TryLock() bool

TryLock returns true if it gets the lock, otherwise returns false

func (*Mutex) Unlock

func (m *Mutex) Unlock()

Unlock unlocks the mutex

type Watchable

type Watchable interface {
	Walk(root string, walkFn filepath.WalkFunc) error
	GetFileID(fi os.FileInfo) interface{}
}

Watchable is an interface of FS which can be watched by this watcher

type Watcher

type Watcher struct {
	Events chan fsevent.Event
	Errors chan error
	// contains filtered or unexported fields
}

Watcher is a file watcher

func NewWatcher

func NewWatcher(watchable Watchable) (*Watcher, error)

NewWatcher is the initializer of watcher struct

func (*Watcher) Add

func (w *Watcher) Add(dir string) error

Add adds a directory into the watch list

func (*Watcher) Check

func (w *Watcher) Check() error

Check checks the state of target directories

func (*Watcher) Close

func (w *Watcher) Close() error

Close cleans up the watcher

func (*Watcher) Remove

func (w *Watcher) Remove(dir string) error

Remove removes a directory from the watch list

func (*Watcher) Start

func (w *Watcher) Start(interval time.Duration) error

Start starts the watcher

func (*Watcher) Stop

func (w *Watcher) Stop() error

Stop stops the watcher

func (*Watcher) WatchList

func (w *Watcher) WatchList() []string

WatchList returns target directories

Jump to

Keyboard shortcuts

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