github.com/jmigpin/editor@v1.6.0/core/fswatcher/watcher.go (about)

     1  package fswatcher
     2  
     3  type Watcher interface {
     4  	Add(name string) error
     5  	Remove(name string) error
     6  	Events() <-chan interface{}
     7  	OpMask() *Op
     8  	Close() error
     9  }
    10  
    11  //----------
    12  
    13  type Event struct {
    14  	Op   Op
    15  	Name string
    16  }
    17  
    18  //----------
    19  
    20  type Op uint16
    21  
    22  func (op Op) HasAny(op2 Op) bool { return op&op2 != 0 }
    23  func (op *Op) Add(op2 Op)        { *op |= op2 }
    24  func (op *Op) Remove(op2 Op)     { *op &^= op2 }
    25  
    26  //----------
    27  
    28  const (
    29  	Attrib Op = 1 << iota
    30  	Create
    31  	Modify // write, truncate
    32  	Remove
    33  	Rename
    34  
    35  	AllOps Op = Attrib | Create | Modify | Remove | Rename
    36  )