Documentation
¶
Overview ¶
Package scan provides concurrent filesystem scanning code
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Scan ¶
func Scan(path string, fs Filesystem, handlers ...Handler)
Scan do specified path scanning and executes folder handler on each folder and all file handlers on each file
Types ¶
type File ¶ added in v0.10.10
type File interface { io.Closer // Readdir reads the contents of the directory associated with file and // returns a slice of up to n FileInfo values, as would be returned // by Lstat, in directory order. Subsequent calls on the same file will yield // further FileInfos. // If n > 0, Readdir returns at most n FileInfo structures. In this case, if // Readdir returns an empty slice, it will return a non-nil error // explaining why. At the end of a directory, the error is io.EOF. // // If n <= 0, Readdir returns all the FileInfo from the directory in // a single slice. In this case, if Readdir succeeds (reads all // the way to the end of the directory), it returns the slice and a // nil error. If it encounters an error before the end of the // directory, Readdir returns the FileInfo read until that point // and a non-nil error. Readdir(count int) ([]os.FileInfo, error) }
File represents an open file descriptor.
type Filesystem ¶ added in v0.10.10
Filesystem represents filesystem abstraction
type FolderEntry ¶
FolderEntry represent folder description
type Handler ¶
type Handler interface { // Handle handles filesystem event Handle(evt *ScanEvent) }
Handler defines scanning handler interface that handles filesystem events
type ScanEvent ¶
type ScanEvent struct { // File set not nil in case of file event occurred File *FileEntry // Folder set not nil in case of folder event occurred Folder *FolderEntry }
ScanEvent defines scanning event structure that can contain file or folder event information
Click to show internal directories.
Click to hide internal directories.