fsnotify

package
v0.0.1-20240408-0001 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventData

type EventData struct {
	// This is the path where it happened!
	Path string
	// This is the time when happened the event
	Time time.Time
	// This is the filtered Name
	Name string
	// This is the operation that happened
	Op Op
}

This is the Event structure when we receive from the watcher

type Notifier

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

func New

func New() (*Notifier, error)

func (*Notifier) IsStarted

func (n *Notifier) IsStarted() bool

func (*Notifier) IsStopped

func (n *Notifier) IsStopped() bool

func (*Notifier) OnError

func (n *Notifier) OnError(callback OnError) *Notifier

func (*Notifier) Remove

func (n *Notifier) Remove(path string) *Notifier

Remove the watcher!

func (*Notifier) Start

func (n *Notifier) Start() *Notifier

func (*Notifier) Stop

func (n *Notifier) Stop() *Notifier

func (*Notifier) Watch

func (n *Notifier) Watch(
	path string,
	watchConfig WatchConfig,
) *Notifier

type OnError

type OnError func(err error)

type Op

type Op fsnotify.Op
const (
	Create Op = 1 << iota
	Write
	Remove
	Rename
	Chmod
)

Just extending! These are the operations of an event!

type WatchCallback

type WatchCallback func(e EventData)

type WatchConfig

type WatchConfig struct {
	CallbackGoRoutine bool
	// This is the callback which should be called!
	Callback WatchCallback
	// What operations should listen on!
	Op []Op
}

This is the structure when we send the configuration to the watcher!

Jump to

Keyboard shortcuts

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