Documentation
¶
Index ¶
- Variables
- type Event
- type EventType
- type FileInfo
- type FileMap
- func (f *FileMap) AddFile(path string, info FileInfo) error
- func (f *FileMap) AddNewPath(path string) error
- func (f *FileMap) AddSwapWrite(path string) error
- func (f *FileMap) AddWrite(path string) error
- func (f *FileMap) Delete(path string) error
- func (f *FileMap) DeletedFiles() []string
- func (f *FileMap) FilePathsByBase(name string) []string
- func (f *FileMap) FilesCreated() int64
- func (f *FileMap) FilesDeleted() int64
- func (f *FileMap) Get(path string) (FileInfo, error)
- func (f *FileMap) Has(path string) bool
- func (f *FileMap) IsDir(path string) bool
- func (f *FileMap) IsInitial(path string) bool
- func (f *FileMap) MarkPendingSwap(path string)
- func (f *FileMap) NewFiles() []string
- func (f *FileMap) WrittenFiles() map[string]int64
- type FileType
- type Monitor
- type MonitorOpts
- type Stats
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 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()
Writes int64
PreSwapWrites int64 // Writes that occurred before editor swaps (not counted in final total)
PendingSwap bool // True if file has a pending delete that might be part of an editor swap
}
type FileMap ¶
type FileMap struct {
// contains filtered or unexported fields
}
func NewFileMap ¶
func NewFileMap() *FileMap
func (*FileMap) AddNewPath ¶
AddNewPath will stat the given path and add it to the map if it is not already known. This should not be used for initial files. Calling this with a known path will return ErrFileTracked.
func (*FileMap) AddSwapWrite ¶
AddSwapWrite records a write from an editor swap (delete+create pair). It also clears any writes that occurred just before the swap to avoid double-counting.
func (*FileMap) DeletedFiles ¶
func (*FileMap) FilePathsByBase ¶
func (*FileMap) FilesCreated ¶
func (*FileMap) FilesDeleted ¶
func (*FileMap) MarkPendingSwap ¶
MarkPendingSwap marks a file as potentially being swapped by an editor. This prevents writes from being counted until we know if a swap occurred.
func (*FileMap) WrittenFiles ¶
type Monitor ¶
type Monitor struct {
Events chan Event
// contains filtered or unexported fields
}
func NewMonitor ¶
func NewMonitor(opts *MonitorOpts) (*Monitor, error)
func (*Monitor) WatchDirRecursive ¶
type MonitorOpts ¶
func (*MonitorOpts) OK ¶
func (m *MonitorOpts) OK() error
Click to show internal directories.
Click to hide internal directories.