fileobserver

package
v0.0.0-...-db72f7f Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExitOnChangeReactor reactorFn = func(filename string, action ActionType) error {
	klog.Infof("exiting because %q changed", filename)
	os.Exit(0)
	return nil
}

ExitOnChangeReactor provides reactor function that causes the process to exit when the change is detected.

Functions

This section is empty.

Types

type ActionType

type ActionType int

ActionType define a type of action observed on the file

const (
	// FileModified means the file content was modified.
	FileModified ActionType = iota

	// FileCreated means the file was just created.
	FileCreated

	// FileDeleted means the file was deleted.
	FileDeleted
)

func (ActionType) String

func (t ActionType) String(filename string) string

String returns human readable form of action taken on a file.

type Observer

type Observer interface {
	Run(stopChan <-chan struct{})
	AddReactor(reaction reactorFn, startingFileContent map[string][]byte, files ...string) Observer
}

func NewObserver

func NewObserver(interval time.Duration) (Observer, error)

Jump to

Keyboard shortcuts

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