Documentation ¶
Index ¶
- func CreateFileNodeWithTransactions(tbl [][]byte) (*filenode.FileNode, error)
- func NewFSWatcher(fsPath string) (Watcher, *EventTransaction, error)
- func NewPathWatcher(fsPath string) (*TreeWatcher, *EventTransaction, error)
- func NewVirtualPathWatcher(virtualPath string, extra *filenode.ExtraPayload) (*VirtualTree, *EventTransaction, error)
- func NewVirtualWatcher(fsPath string, extra *filenode.ExtraPayload) (Watcher, *EventTransaction, error)
- func RestoreWatcherWithTransactions(tbl [][]byte, tw Watcher) error
- type EventTransaction
- type TreeWatcher
- func (tw *TreeWatcher) Create(path connector.Path, extra *filenode.ExtraPayload) (*filenode.FileNode, error)
- func (tw *TreeWatcher) GetErrors() <-chan error
- func (tw *TreeWatcher) GetEvents() <-chan *EventTransaction
- func (tw *TreeWatcher) Handler(e event.Event, extras ...*filenode.ExtraPayload) (*EventTransaction, error)
- func (tw *TreeWatcher) Move(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error)
- func (tw *TreeWatcher) PrintTree(label string)
- func (tw *TreeWatcher) Remove(path connector.Path) (*filenode.FileNode, error)
- func (tw *TreeWatcher) Rename(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error)
- func (tw *TreeWatcher) Restore(tree *filenode.FileNode)
- func (tw *TreeWatcher) SearchByPath(path string) *filenode.FileNode
- func (tw *TreeWatcher) SearchByUUID(uuid string) *filenode.FileNode
- func (tw *TreeWatcher) Start()
- func (tw *TreeWatcher) Stop()
- func (tw *TreeWatcher) Watch()
- func (tw *TreeWatcher) Write(path connector.Path) (*filenode.FileNode, error)
- type VirtualTree
- func (tw *VirtualTree) Create(path connector.Path, extra *filenode.ExtraPayload) (*filenode.FileNode, error)
- func (tw *VirtualTree) GetErrors() <-chan error
- func (tw *VirtualTree) GetEvents() <-chan *EventTransaction
- func (tw *VirtualTree) Handler(e event.Event, extras ...*filenode.ExtraPayload) (*EventTransaction, error)
- func (tw *VirtualTree) Move(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error)
- func (tw *VirtualTree) PrintTree(label string)
- func (tw *VirtualTree) Remove(path connector.Path) (*filenode.FileNode, error)
- func (tw *VirtualTree) Rename(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error)
- func (tw *VirtualTree) Restore(tree *filenode.FileNode)
- func (tw *VirtualTree) SearchByPath(path string) *filenode.FileNode
- func (tw *VirtualTree) SearchByUUID(uuid string) *filenode.FileNode
- func (tw *VirtualTree) Start()
- func (tw *VirtualTree) Stop()
- func (tw *VirtualTree) Watch()
- func (tw *VirtualTree) Write(path connector.Path) (*filenode.FileNode, error)
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFSWatcher ¶
func NewFSWatcher(fsPath string) (Watcher, *EventTransaction, error)
func NewPathWatcher ¶
func NewPathWatcher(fsPath string) (*TreeWatcher, *EventTransaction, error)
func NewVirtualPathWatcher ¶
func NewVirtualPathWatcher(virtualPath string, extra *filenode.ExtraPayload) (*VirtualTree, *EventTransaction, error)
func NewVirtualWatcher ¶
func NewVirtualWatcher(fsPath string, extra *filenode.ExtraPayload) (Watcher, *EventTransaction, error)
Types ¶
type EventTransaction ¶
type EventTransaction struct { Name string Type event.Type UUID string ParentUUID string Meta filenode.MetaData }
func (*EventTransaction) Decode ¶
func (t *EventTransaction) Decode(b []byte) error
func (*EventTransaction) Encode ¶
func (t *EventTransaction) Encode() ([]byte, error)
type TreeWatcher ¶
type TreeWatcher struct { FileTree *filenode.FileNode Watcher *fsnotify.Watcher Path connector.Path ParentPath connector.Path Events chan *EventTransaction Errors chan error sync.Mutex EventManager event.EventHandler }
func (*TreeWatcher) Create ¶
func (tw *TreeWatcher) Create(path connector.Path, extra *filenode.ExtraPayload) (*filenode.FileNode, error)
func (*TreeWatcher) GetErrors ¶
func (tw *TreeWatcher) GetErrors() <-chan error
func (*TreeWatcher) GetEvents ¶
func (tw *TreeWatcher) GetEvents() <-chan *EventTransaction
func (*TreeWatcher) Handler ¶
func (tw *TreeWatcher) Handler(e event.Event, extras ...*filenode.ExtraPayload) (*EventTransaction, error)
Handler the 'extras' parameter is optional because we may need to move an external value to the node layer. sample; We want to parameterize the uuid from outside in VFS, but we don't want to do that in FS.
func (*TreeWatcher) Move ¶
func (tw *TreeWatcher) Move(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error)
func (*TreeWatcher) PrintTree ¶
func (tw *TreeWatcher) PrintTree(label string)
func (*TreeWatcher) Remove ¶
func (tw *TreeWatcher) Remove(path connector.Path) (*filenode.FileNode, error)
func (*TreeWatcher) Rename ¶
func (tw *TreeWatcher) Rename(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error)
func (*TreeWatcher) Restore ¶
func (tw *TreeWatcher) Restore(tree *filenode.FileNode)
func (*TreeWatcher) SearchByPath ¶
func (tw *TreeWatcher) SearchByPath(path string) *filenode.FileNode
func (*TreeWatcher) SearchByUUID ¶
func (tw *TreeWatcher) SearchByUUID(uuid string) *filenode.FileNode
func (*TreeWatcher) Start ¶
func (tw *TreeWatcher) Start()
func (*TreeWatcher) Stop ¶
func (tw *TreeWatcher) Stop()
func (*TreeWatcher) Watch ¶
func (tw *TreeWatcher) Watch()
type VirtualTree ¶
type VirtualTree struct { FileTree *filenode.FileNode Path connector.Path ParentPath connector.Path sync.Mutex }
func (*VirtualTree) Create ¶
func (tw *VirtualTree) Create(path connector.Path, extra *filenode.ExtraPayload) (*filenode.FileNode, error)
func (*VirtualTree) GetErrors ¶
func (tw *VirtualTree) GetErrors() <-chan error
func (*VirtualTree) GetEvents ¶
func (tw *VirtualTree) GetEvents() <-chan *EventTransaction
func (*VirtualTree) Handler ¶
func (tw *VirtualTree) Handler(e event.Event, extras ...*filenode.ExtraPayload) (*EventTransaction, error)
func (*VirtualTree) Move ¶
func (tw *VirtualTree) Move(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error)
func (*VirtualTree) PrintTree ¶
func (tw *VirtualTree) PrintTree(label string)
func (*VirtualTree) Remove ¶
func (tw *VirtualTree) Remove(path connector.Path) (*filenode.FileNode, error)
func (*VirtualTree) Rename ¶
func (tw *VirtualTree) Rename(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error)
func (*VirtualTree) Restore ¶
func (tw *VirtualTree) Restore(tree *filenode.FileNode)
func (*VirtualTree) SearchByPath ¶
func (tw *VirtualTree) SearchByPath(path string) *filenode.FileNode
func (*VirtualTree) SearchByUUID ¶
func (tw *VirtualTree) SearchByUUID(uuid string) *filenode.FileNode
func (*VirtualTree) Start ¶
func (tw *VirtualTree) Start()
func (*VirtualTree) Stop ¶
func (tw *VirtualTree) Stop()
func (*VirtualTree) Watch ¶
func (tw *VirtualTree) Watch()
type Watcher ¶
type Watcher interface { Stop() Start() Watch() PrintTree(label string) // for debug GetErrors() <-chan error GetEvents() <-chan *EventTransaction Restore(tree *filenode.FileNode) SearchByPath(path string) *filenode.FileNode SearchByUUID(uuid string) *filenode.FileNode Handler(event event.Event, extra ...*filenode.ExtraPayload) (*EventTransaction, error) Create(fromPath connector.Path, extra *filenode.ExtraPayload) (*filenode.FileNode, error) Write(fromPath connector.Path) (*filenode.FileNode, error) Remove(fromPath connector.Path) (*filenode.FileNode, error) Move(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error) Rename(fromPath connector.Path, toPath connector.Path) (*filenode.FileNode, error) }
Click to show internal directories.
Click to hide internal directories.