fswatch

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Monitor

func Monitor(addr, dir string)

func Subscriber

func Subscriber(port string, handler func(event *pb.EventRequest))

Types

type ActionHandler

type ActionHandler struct {
	Client pb.WatcherClient
}

ActionHandler publish directory changes over to remote grpc server.

func (*ActionHandler) OnFileCreated

func (g *ActionHandler) OnFileCreated(path string) error

OnFileCreated sends Create action details to remote events server.

func (*ActionHandler) OnFileDeleted

func (g *ActionHandler) OnFileDeleted(path string) error

OnFileDeleted sends remove action details to remote events server.

type EventHandler

type EventHandler interface {
	OnFileCreated(path string) error
	OnFileDeleted(path string) error
}

type Watcher

type Watcher struct {
	Dir          string
	EventHandler EventHandler
	// contains filtered or unexported fields
}

Watcher watches the Dir and sends notification about file system changes events to EventHandler.

func New

func New(dir string, eventHanlder EventHandler) *Watcher

func (*Watcher) Run

func (w *Watcher) Run() error

Run starts dir notification watcher and forwards events to EventHandler.

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop the watcher.

Jump to

Keyboard shortcuts

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