Documentation ¶
Index ¶
Constants ¶
const ( // Create is a volume creation event Create = iota // Remove is a volume deletion event Remove )
Variables ¶
This section is empty.
Functions ¶
func IDDevicePath ¶
IDDevicePath gives the full path to the target in the deviceDir
Types ¶
type VolumeWatcher ¶
type VolumeWatcher struct {
// contains filtered or unexported fields
}
VolumeWatcher watches the disk area for new volumes and posts them to the Events channel
Create a VolumeWatcher by calling the NewWatcher function
func NewWatchDir ¶
func NewWatchDir(dir string) *VolumeWatcher
NewWatchDir creates a new volume watcher on an arbitrary directory
func NewWatcher ¶
func NewWatcher() *VolumeWatcher
NewWatcher creates a new volume watcher. It launches a separate Go routine in a separate context which watches for volumes being created and removed. The watcher can be cancelled by calling the returned context cancellation function
func (*VolumeWatcher) Cancel ¶
func (vw *VolumeWatcher) Cancel()
Cancel signals to the watcher that it should stop watching and close down
func (*VolumeWatcher) Done ¶
func (vw *VolumeWatcher) Done() <-chan struct{}
Done returns a channel that is closed when the watcher has been cancelled
func (*VolumeWatcher) Err ¶
func (vw *VolumeWatcher) Err() error
Err returns a Cancelled error when the watcher has been stopped
func (*VolumeWatcher) Events ¶
func (vw *VolumeWatcher) Events() <-chan Event
Events returns the main events channel