fsys

package
v0.0.0-...-7899014 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PathSeparator = string([]rune{os.PathSeparator})

Functions

func GetDevice

func GetDevice(stat os.FileInfo) uint64

func RealPath

func RealPath(path string) (ret string, err error)

func TestRestrictedPath

func TestRestrictedPath(
	t *testing.T,
	set SetRestrictedPath,
	is IsRestrictedPath,
)

func TestShuffleDir

func TestShuffleDir(
	t *testing.T,
	shuffle ShuffleDir,
)

func TestWatch

func TestWatch(
	t *testing.T,
	watch Watch,
	shuffle ShuffleDir,
	wg *pr2.WaitGroup,
)

Types

type Def

type Def struct{}

func (Def) EnsureDir

func (_ Def) EnsureDir() EnsureDir

func (Def) SetRestrictedPath

func (_ Def) SetRestrictedPath() (
	set SetRestrictedPath,
	is IsRestrictedPath,
)

func (Def) ShuffleDir

func (Def) ShuffleDir() ShuffleDir

func (Def) Watch

func (Def) Watch() (
	watch Watch,
)

type EnsureDir

type EnsureDir func(path string) error

type IsRestrictedPath

type IsRestrictedPath func(string) (bool, error)

type Node

type Node struct {
	ModTime time.Time
	Subs    map[string]*Node
}

func NewTree

func NewTree(subPath []string, t time.Time) *Node

func (*Node) Delete

func (n *Node) Delete(subPath []string)

func (*Node) Get

func (n *Node) Get(subPath []string) (time.Time, bool)

func (*Node) Update

func (n *Node) Update(subPath []string, t time.Time)

type OnInitDone

type OnInitDone func()

func (OnInitDone) IsWatchOption

func (OnInitDone) IsWatchOption()

type OnUpdatedSpec

type OnUpdatedSpec struct {
	MaxDelay time.Duration
	Func     func()
}

func OnUpdated

func OnUpdated(maxDelay time.Duration, fn func()) OnUpdatedSpec

func (OnUpdatedSpec) IsWatchOption

func (OnUpdatedSpec) IsWatchOption()

type SetRestrictedPath

type SetRestrictedPath func(string) error

type ShuffleDir

type ShuffleDir func(string) (
	op string,
	path1 string,
	path2 string,
	err error,
)

type SingleDevice

type SingleDevice bool

func (SingleDevice) IsWatchOption

func (SingleDevice) IsWatchOption()

type TapUpdatePaths

type TapUpdatePaths func([]string)

func (TapUpdatePaths) IsWatchOption

func (TapUpdatePaths) IsWatchOption()

type TrackFiles

type TrackFiles bool

func (TrackFiles) IsWatchOption

func (TrackFiles) IsWatchOption()

type Watch

type Watch func(
	ctx context.Context,
	path string,
	options ...WatchOption,
) (
	watcher *Watcher,
	err error,
)

type WatchOption

type WatchOption interface {
	IsWatchOption()
}

type Watcher

type Watcher struct {
	sync.RWMutex

	Ready chan struct{}
	// contains filtered or unexported fields
}

func (*Watcher) PathModTime

func (w *Watcher) PathModTime(path string) (_ *time.Time, err error)

func (*Watcher) PathNotChanged

func (w *Watcher) PathNotChanged(
	path string,
	from time.Time,
) (
	notChanged bool,
	err error,
)

Jump to

Keyboard shortcuts

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