Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChanErrSink ¶
type ChanErrSink chan error
func (ChanErrSink) Error ¶
func (s ChanErrSink) Error(err error)
type Command ¶
type Command struct { // the type of request. Values in this field will mean different things // depending on the driver Type int // The payload used to fulfill the operation. Maybe nil depending on the // driver and the operation Payload interface{} // A channel where errors can be reported back to the watcher goroutine. Reply chan error }
Command represents a request sent from the fsnotify watcher to the driver. The driver is (presumably) running asynchronously wrt to the watcher, and thus operations that modify the state of the driver are passed via channels.
The Command object is the object that gets passed from the watcher goroutine to the driver goroutine.
type CommandOption ¶
type CommandOption interface { Option // contains filtered or unexported methods }
func WithAck ¶
func WithAck(b bool) CommandOption
type CommandQueue ¶
type CommandQueue struct {
// contains filtered or unexported fields
}
func NewCommandQueue ¶
func NewCommandQueue(chooser CommandQueueEgressChooser) *CommandQueue
func (*CommandQueue) Append ¶
func (q *CommandQueue) Append(cmd *Command)
func (*CommandQueue) Drain ¶
func (q *CommandQueue) Drain(ctx context.Context)
func (*CommandQueue) SendCmd ¶
func (q *CommandQueue) SendCmd(cmd *Command, options ...CommandOption) error
type CommandQueueEgressChooseFunc ¶
func (CommandQueueEgressChooseFunc) Choose ¶
func (fn CommandQueueEgressChooseFunc) Choose(cmd *Command) chan *Command
type Driver ¶
type Driver interface { // Add adds a new watch target to the driver. Add(string, ...CommandOption) error // Remove removes a watch target. Remove(string, ...CommandOption) error // Run starts the driver's processing of the entries. // // The second parameter is used to tell the caller (fsnotiy.Wathcer) // that the driver is ready to serve requests. When the driver is // ready, close the channel to tell the Watcher that it's ready. // // The third and fourht parameters are where events and errors // should be sent from the Driver Run(context.Context, chan struct{}, EventSink, ErrorSink) }
Driver is the interface that must be implemented by the underlying fsnotify implementation.
type ErrorSink ¶
type ErrorSink interface { // Error accepts an error that occurred during the execution // of `Watch()`. It must be non-blocking. Error(error) }
ErrorSink is the destination where errors are reported to
type Event ¶
type Event interface { // Name returns the name of file that caused this event Name() string // Op is a compatibility layer for github.com/fsnotify/fsnotify. Op() OpMask // OpMask returns a bitmask of operation(s) that caused this event Mask() OpMask // String() returns the string representation in a human readable // format. Do not expect the string to be stable or parsable. String() string }
Event represents a file system event. It is an interface because driver implementation may want to extend the event and store extra information
type EventSink ¶
type EventSink interface {
Event(Event)
}
EventSink is the destination where each Driver should send events to.
type NullDriver ¶
type NullDriver struct{}
NullDriver exists to be plugged in when there are no other drivers to be used. fsnotify will not function, but your code will at least not die a horrible death.
func (NullDriver) Add ¶
func (_ NullDriver) Add(_ string, _ ...CommandOption) error
func (NullDriver) Remove ¶
func (_ NullDriver) Remove(_ string, _ ...CommandOption) error