devfs

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: EUPL-1.2 Imports: 10 Imported by: 1

Documentation

Overview

package devfs exposes FS utilities (watch a directory for changes, fallback chain of FS).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndRecorder added in v0.7.0

type EndRecorder func() map[string]struct{}

EndRecorder must be called to get all the files that were accessed during a given period.

type FallbackFS

type FallbackFS []fs.FS

FallbackFS will try to Open a file from each of the underlying fs, until succesful.

func (FallbackFS) Open

func (ffs FallbackFS) Open(name string) (fs.File, error)

type Watcher added in v0.7.0

type Watcher struct {
	fs.FS
	// contains filtered or unexported fields
}

func WatchDir added in v0.7.0

func WatchDir(ctx context.Context, dir string, fsEvents chan<- string, maxWatchedDirs int) (*Watcher, error)

WatchDir returns a wrapped os.DirFS. Each opened file is added to a watchlist, any write to those file (by external processes) is notified on the provided fsEvents channel.

At most maxWatchedDirs will be watched (folder with the least recent open/watch event will be evicted if needed).

func (*Watcher) Open added in v0.7.0

func (f *Watcher) Open(name string) (fs.File, error)

func (*Watcher) StartRecording added in v0.7.0

func (f *Watcher) StartRecording() EndRecorder

StartRecording returns an EndRecorder which will list all the opened files between the start and the time the EndRecorder was called.

Jump to

Keyboard shortcuts

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