Documentation ¶
Index ¶
- Constants
- Variables
- func DecomposesUnicode(path string) (bool, error)
- func DeviceID(info os.FileInfo) (uint64, error)
- func DirectoryContents(path string) ([]os.FileInfo, error)
- func GetOwnership(info os.FileInfo) (int, int, error)
- func Mutagen(create bool, subpath ...string) (string, error)
- func Normalize(path string) (string, error)
- func PreservesExecutability(path string) (bool, error)
- func RenameFileAtomic(oldPath, newPath string) error
- func SetOwnership(path string, uid, gid int) error
- func Walk(root string, visitor filepath.WalkFunc) error
- func Watch(context context.Context, root string, events chan struct{}, mode WatchMode, ...)
- func WriteFileAtomic(path string, data []byte, permissions os.FileMode) error
- type Locker
- type WatchMode
Constants ¶
const (
// DefaultPollingInterval is the default watch polling interval, in seconds.
DefaultPollingInterval = 10
)
const ( // MutagenDirectoryName is the name of the Mutagen control directory inside // the user's home directory. MutagenDirectoryName = ".mutagen" )
Variables ¶
var HomeDirectory string
HomeDirectory is the cached path to the current user's home directory.
var MutagenConfigurationPath string
MutagenConfigurationPath is the path to the Mutagen configuration file.
var WatchMode_name = map[int32]string{
0: "WatchDefault",
1: "WatchPortable",
2: "WatchForcePoll",
}
var WatchMode_value = map[string]int32{
"WatchDefault": 0,
"WatchPortable": 1,
"WatchForcePoll": 2,
}
Functions ¶
func DecomposesUnicode ¶
func PreservesExecutability ¶
func RenameFileAtomic ¶
RenameFileAtomic performs an atomic file rename. In the simplest case, it's a simple alias for os.Rename. However, if moving a file across filesystems, it will fall back to a copy/rename combination that should still approximate atomicity (at least in terms of swapping the destination file contents). It does NOT support renaming directories, only files. It takes inspiration from: https://github.com/golang/dep/blob/4ad9f4ec24012607dc247ca24528e3224d61519a/fs.go#L80
func SetOwnership ¶
func Walk ¶ added in v0.5.0
Walk provides a faster implementation of path/filepath.Walk with slightly different semantics. In particular, it only walks directory contents after metadata for the directory has been collected and does not sort entries by name. It gains speed by avoiding sorting and, more importantly, using os.File.Readdir for vastly more efficient traversal on Windows.
func Watch ¶
func Watch(context context.Context, root string, events chan struct{}, mode WatchMode, pollInterval uint32)
TODO: Document that this function closes the events channel when the watch is cancelled. TODO: Document that this function will always succeed in one way or another (it doesn't have any total failure modes) and won't exit until the associated context is cancelled. TODO: Document that the events channel must be buffered.
Types ¶
type WatchMode ¶
type WatchMode int32
WatchMode specifies the mode for filesystem watching.
const ( // WatchMode_WatchDefault represents an unspecified watch mode. It should be // converted to one of the following values based on the desired default // behavior. WatchMode_WatchDefault WatchMode = 0 // WatchMode_WatchPortable specifies that native recursive watching should // be used to monitor paths on systems that support it if those paths fall // under the home directory. In these cases, a watch on the entire home // directory is established and filtered for events pertaining to the // specified path. On all other systems and for all other paths, poll-based // watching is used. WatchMode_WatchPortable WatchMode = 1 // WatchMode_WatchForcePoll specifies that only poll-based watching should // be used. WatchMode_WatchForcePoll WatchMode = 2 )
func (WatchMode) Description ¶
Description returns a human-readable description of a watch mode.
func (WatchMode) EnumDescriptor ¶
func (WatchMode) Supported ¶
Supported indicates whether or not a particular watch mode is a valid, non-default value.
func (*WatchMode) UnmarshalText ¶
UnmarshalText implements the text unmarshalling interface used when loading from TOML files.
Source Files ¶
- atomic.go
- atomic_posix.go
- device_posix.go
- directory.go
- executability_posix.go
- locker.go
- locker_posix.go
- normalize.go
- ownership_posix.go
- paths.go
- unicode_posix.go
- visibility_posix.go
- walk.go
- watch.go
- watch.pb.go
- watch_native.go
- watch_native_non_recursive.go
- watch_native_non_recursive_inotify.go
- watch_native_posix.go
- watch_poll.go
Directories ¶
Path | Synopsis |
---|---|
Package winfsnotify allows the user to receive file system event notifications on Windows.
|
Package winfsnotify allows the user to receive file system event notifications on Windows. |