files

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownFile = errors.New("unknown file name")
	ErrFileTracked = errors.New("file already tracked")
)

Functions

This section is empty.

Types

type Event

type Event struct {
	Name string
	Op   fsnotify.Op
}

func (Event) Type

func (e Event) Type() EventType

type EventType

type EventType string
const (
	EventTypeUnknown EventType = "unknown"
	EventTypeChmod   EventType = "chmod"
	EventTypeCreate  EventType = "create"
	EventTypeRemove  EventType = "remove"
	EventTypeRename  EventType = "rename"
	EventTypeWrite   EventType = "write"
)

type FileInfo

type FileInfo struct {
	fs.FileInfo

	FileType   FileType
	WasDeleted bool // This is to track the deletion of initial files. New files will be removed from the map with Delete()
}

func (FileInfo) IsInitial

func (f FileInfo) IsInitial() bool

type FileMap

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

func NewFileMap

func NewFileMap() *FileMap

func (*FileMap) AddFile

func (f *FileMap) AddFile(name string, info FileInfo) error

func (*FileMap) Delete

func (f *FileMap) Delete(name string) error

func (*FileMap) DeletedFiles

func (f *FileMap) DeletedFiles() []string

func (*FileMap) Get

func (f *FileMap) Get(name string) (FileInfo, error)

func (*FileMap) IsInitial

func (f *FileMap) IsInitial(name string) bool

func (*FileMap) NewFiles

func (f *FileMap) NewFiles() []string

type FileType

type FileType string
const (
	FileTypeInitial FileType = "initial"
	FileTypeNew     FileType = "new"
)

type Monitor

type Monitor struct {
	Events chan Event
	// contains filtered or unexported fields
}

func NewMonitor

func NewMonitor(opts *MonitorOpts) (*Monitor, error)

func (*Monitor) Close

func (m *Monitor) Close()

func (*Monitor) Run

func (m *Monitor) Run(ctx context.Context)

func (*Monitor) Stats

func (m *Monitor) Stats(final bool) *Stats

func (*Monitor) WatchDirRecursive

func (m *Monitor) WatchDirRecursive(path string) error

func (*Monitor) WatchFile

func (m *Monitor) WatchFile(path string) error

type MonitorOpts

type MonitorOpts struct {
	RootPath  string
	WatchRoot bool
}

func (*MonitorOpts) OK

func (m *MonitorOpts) OK() error

type Stats

type Stats struct {
	NumFilesCreated int64
	NumFilesDeleted int64
	NewFiles        []string
	DeletedFiles    []string
}

Jump to

Keyboard shortcuts

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