loader

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 13 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowDotFiles added in v0.2.0

func AllowDotFiles(l *Loader)

func IgnoreDotFiles added in v0.2.0

func IgnoreDotFiles(l *Loader)

Types

type DirectoryRefresher added in v0.1.3

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

func (*DirectoryRefresher) ShouldRefresh added in v0.1.3

func (d *DirectoryRefresher) ShouldRefresh(path string, op FileSystemOp) bool

func (*DirectoryRefresher) WatchDirectory added in v0.1.3

func (d *DirectoryRefresher) WatchDirectory(runtimePath string, appDirPath string) string

func (*DirectoryRefresher) WatchFileSystemOps added in v0.3.0

func (d *DirectoryRefresher) WatchFileSystemOps(fsops ...FileSystemOp)

type FileSystemOp added in v0.1.3

type FileSystemOp int32
const (
	Create FileSystemOp = iota
	Write
	Remove
	Rename
	Chmod
)

Filesystem operations that are monitored for changes

type IFace

type IFace interface {
	// @return Snapshot the current snapshot. This reference is safe to use forever, but will grow
	//         stale so should not be stored beyond when it is immediately needed.
	Snapshot() snapshot.IFace

	// Add a channel that will be written to when a new snapshot is available. "1" will be written
	// to the channel as a sentinel.
	// @param callback supplies the callback to add.
	AddUpdateCallback(callback chan<- int)
}

func New deprecated

func New(runtimePath string, runtimeSubdirectory string, scope stats.Scope, refresher Refresher, opts ...Option) IFace

Deprecated: use New2 instead

func New2 added in v0.2.3

func New2(runtimePath, runtimeSubdirectory string, scope stats.Scope, refresher Refresher, opts ...Option) (IFace, error)

type Loader

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

Implementation of Loader that watches a symlink and reads from the filesystem.

func (*Loader) AddUpdateCallback

func (l *Loader) AddUpdateCallback(callback chan<- int)

func (*Loader) Snapshot

func (l *Loader) Snapshot() snapshot.IFace

type Nil

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

Implementation of Loader with no backing store.

func NewNil

func NewNil() Nil

func (Nil) AddUpdateCallback

func (Nil) AddUpdateCallback(callback chan<- int)

func (Nil) Snapshot

func (n Nil) Snapshot() snapshot.IFace

type Option added in v0.2.1

type Option func(l *Loader)

type Refresher added in v0.1.3

type Refresher interface {
	// @return The directory path to watch for changes.
	// @param runtimePath The root of the runtime path
	// @param appDirPath Any app specific path
	WatchDirectory(runtimePath string, appDirPath string) string

	// @return If the runtime needs to be refreshed
	// @param path The path that triggered the FileSystemOp
	// @param The Filesystem op that happened on the directory returned from WatchDirectory
	ShouldRefresh(path string, op FileSystemOp) bool
}

A Refresher is used to determine when to refresh the runtime

type SymlinkRefresher added in v0.1.3

type SymlinkRefresher struct {
	RuntimePath string
}

func (*SymlinkRefresher) ShouldRefresh added in v0.1.3

func (s *SymlinkRefresher) ShouldRefresh(path string, op FileSystemOp) bool

func (*SymlinkRefresher) WatchDirectory added in v0.1.3

func (s *SymlinkRefresher) WatchDirectory(runtimePath string, appDirPath string) string

Jump to

Keyboard shortcuts

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