Documentation ¶
Overview ¶
Package file system provides endpoints for reading/writing from/to a local folder
Index ¶
- Constants
- Variables
- func PipeChan(capacity int) (inputCh chan notify.EventInfo, outputCh chan notify.EventInfo)
- type Discarder
- type FSClient
- func (c *FSClient) CreateNode(ctx context.Context, node *tree.Node, updateIfExists bool) (err error)
- func (c *FSClient) DeleteNode(ctx context.Context, path string) (err error)
- func (c *FSClient) ExistingFolders(ctx context.Context) (map[string][]*tree.Node, error)
- func (c *FSClient) FinishSession(ctx context.Context, sessionUuid string) error
- func (c *FSClient) FlushSession(ctx context.Context, sessionUuid string) error
- func (c *FSClient) GetEndpointInfo() model.EndpointInfo
- func (c *FSClient) GetReaderOn(path string) (out io.ReadCloser, err error)
- func (c *FSClient) GetWriterOn(cancel context.Context, path string, targetSize int64) (out io.WriteCloser, writeDone chan bool, writeErr chan error, err error)
- func (c *FSClient) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node *tree.Node, err error)
- func (c *FSClient) MoveNode(ctx context.Context, oldPath string, newPath string) (err error)
- func (c *FSClient) PatchUpdateSnapshot(ctx context.Context, patch interface{})
- func (c *FSClient) SetHidden(relativePath string, hidden bool) error
- func (c *FSClient) SetRefHashStore(source model.PathSyncSource)
- func (c *FSClient) SetUpdateSnapshot(target model.PathSyncTarget)
- func (c *FSClient) StartSession(ctx context.Context, rootNode *tree.Node, silent bool) (*tree.IndexationSession, error)
- func (c *FSClient) UpdateFolderUuid(ctx context.Context, node *tree.Node) (*tree.Node, error)
- func (c *FSClient) Walk(ctx context.Context, walkFunc model.WalkNodesFunc, root string, recursive bool) (err error)
- func (c *FSClient) Watch(recursivePath string) (*model.WatchObject, error)
- type FSEventDebouncer
- type WrapperWriter
Constants ¶
const (
SyncTmpPrefix = ".tmp.write."
)
Variables ¶
var ( // EventTypeAll contains the notify events that will cause a put (writer) EventTypeAll = []notify.Event{notify.All} // EventTypePut contains the notify events that will cause a put (writer) EventTypePut = []notify.Event{notify.Create, notify.Write, notify.Rename} // EventTypeCreate contains the notify events that will cause a put (writer) EventTypeCreate = []notify.Event{notify.Create} // EventTypeWrite contains the notify events that will cause a put (writer) EventTypeWrite = []notify.Event{notify.Write} // EventTypeRename contains the notify events that will cause a put (writer) EventTypeRename = []notify.Event{notify.Rename} // EventTypeDelete contains the notify events that will cause a delete (remove) EventTypeDelete = []notify.Event{notify.Remove} // EventTypeGet contains all notify events EventTypeGet []notify.Event // On macOS, FreeBSD, Solaris this is not available. )
Functions ¶
Types ¶
type FSClient ¶
FSClient implementation of an endpoint Implements all Sync interfaces (PathSyncTarget, PathSyncSource, DataSyncTarget and DataSyncSource) Takes a root folder as main parameter Underlying calls to FS are done through Afero.FS virtualization, allowing for mockups and automated testings.
func NewFSClient ¶
func NewFSClient(rootPath string, options model.EndpointOptions) (*FSClient, error)
NewFSClient initiate a FileSystem client and stats the provided root. It returns an error if the folder is not reachable
func (*FSClient) CreateNode ¶
func (*FSClient) DeleteNode ¶
func (*FSClient) ExistingFolders ¶
func (*FSClient) FinishSession ¶
FinishSession forwards session management to underlying snapshot
func (*FSClient) FlushSession ¶
FlushSession forwards session management to underlying snapshot
func (*FSClient) GetEndpointInfo ¶
func (c *FSClient) GetEndpointInfo() model.EndpointInfo
func (*FSClient) GetReaderOn ¶
func (c *FSClient) GetReaderOn(path string) (out io.ReadCloser, err error)
func (*FSClient) GetWriterOn ¶
func (*FSClient) LoadNode ¶
func (c *FSClient) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node *tree.Node, err error)
LoadNode is the Read in CRUD. leaf bools are used to avoid doing an FS.stat if we already know a node to be a leaf. NOTE : is it useful? Examine later.
func (*FSClient) PatchUpdateSnapshot ¶
PatchUpdateSnapshot applies a patch of Operations on the underlying snapshot, if there is one.
func (*FSClient) SetRefHashStore ¶
func (c *FSClient) SetRefHashStore(source model.PathSyncSource)
func (*FSClient) SetUpdateSnapshot ¶
func (c *FSClient) SetUpdateSnapshot(target model.PathSyncTarget)
SetUpdateSnapshot attaches a snapshot to this client, that will be updated at the same time that the client processes operations on the filesystem
func (*FSClient) StartSession ¶
func (c *FSClient) StartSession(ctx context.Context, rootNode *tree.Node, silent bool) (*tree.IndexationSession, error)
StartSession forwards session management to underlying snapshot
func (*FSClient) UpdateFolderUuid ¶
type FSEventDebouncer ¶
type FSEventDebouncer struct { Input chan model.EventInfo // contains filtered or unexported fields }
func NewFSEventDebouncer ¶
func NewFSEventDebouncer(out chan model.EventInfo, errors chan error, c *FSClient, finished func()) *FSEventDebouncer
type WrapperWriter ¶
type WrapperWriter struct { io.WriteCloser // contains filtered or unexported fields }
func (*WrapperWriter) Close ¶
func (w *WrapperWriter) Close() error