local

package
v0.0.0-...-e391311 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2015 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Local filesystem interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFs

func NewFs(name, root string) (fs.Fs, error)

NewFs constructs an FsLocal from the path

Types

type FsLocal

type FsLocal struct {
	// contains filtered or unexported fields
}

FsLocal represents a local filesystem rooted at root

func (*FsLocal) DirMove

func (dstFs *FsLocal) DirMove(src fs.Fs) error

Move src to this remote using server side move operations.

Will only be called if src.Fs().Name() == f.Name()

If it isn't possible then return fs.ErrorCantDirMove

If destination exists then return fs.ErrorDirExists

func (*FsLocal) List

func (f *FsLocal) List() fs.ObjectsChan

List the path returning a channel of FsObjects

Ignores everything which isn't Storable, eg links etc

func (*FsLocal) ListDir

func (f *FsLocal) ListDir() fs.DirChan

Walk the path returning a channel of FsObjects

func (*FsLocal) Mkdir

func (f *FsLocal) Mkdir() error

Mkdir creates the directory if it doesn't exist

func (*FsLocal) Move

func (dstFs *FsLocal) Move(src fs.Object, remote string) (fs.Object, error)

Move src to this remote using server side move operations.

This is stored with the remote path given

It returns the destination Object and a possible error

Will only be called if src.Fs().Name() == f.Name()

If it isn't possible then return fs.ErrorCantMove

func (*FsLocal) Name

func (f *FsLocal) Name() string

The name of the remote (as passed into NewFs)

func (*FsLocal) NewFsObject

func (f *FsLocal) NewFsObject(remote string) fs.Object

Return an FsObject from a path

May return nil if an error occurred

func (*FsLocal) Precision

func (f *FsLocal) Precision() (precision time.Duration)

Return the precision

func (*FsLocal) Purge

func (f *FsLocal) Purge() error

Purge deletes all the files and directories

Optional interface: Only implement this if you have a way of deleting all the files quicker than just running Remove() on the result of List()

func (*FsLocal) Put

func (f *FsLocal) Put(in io.Reader, remote string, modTime time.Time, size int64) (fs.Object, error)

Puts the FsObject to the local filesystem

func (*FsLocal) Rmdir

func (f *FsLocal) Rmdir() error

Rmdir removes the directory

If it isn't empty it will return an error

func (*FsLocal) Root

func (f *FsLocal) Root() string

The root of the remote (as passed into NewFs)

func (*FsLocal) String

func (f *FsLocal) String() string

String converts this FsLocal to a string

type FsObjectLocal

type FsObjectLocal struct {
	// contains filtered or unexported fields
}

FsObjectLocal represents a local filesystem object

func (*FsObjectLocal) Fs

func (o *FsObjectLocal) Fs() fs.Fs

Return the parent Fs

func (*FsObjectLocal) Md5sum

func (o *FsObjectLocal) Md5sum() (string, error)

Md5sum calculates the Md5sum of a file returning a lowercase hex string

func (*FsObjectLocal) ModTime

func (o *FsObjectLocal) ModTime() time.Time

ModTime returns the modification time of the object

func (*FsObjectLocal) Open

func (o *FsObjectLocal) Open() (in io.ReadCloser, err error)

Open an object for read

func (*FsObjectLocal) Remote

func (o *FsObjectLocal) Remote() string

Return the remote path

func (*FsObjectLocal) Remove

func (o *FsObjectLocal) Remove() error

Remove an object

func (*FsObjectLocal) SetModTime

func (o *FsObjectLocal) SetModTime(modTime time.Time)

Sets the modification time of the local fs object

func (*FsObjectLocal) Size

func (o *FsObjectLocal) Size() int64

Size returns the size of an object in bytes

func (*FsObjectLocal) Storable

func (o *FsObjectLocal) Storable() bool

Is this object storable

func (*FsObjectLocal) String

func (o *FsObjectLocal) String() string

Return a string version

func (*FsObjectLocal) Update

func (o *FsObjectLocal) Update(in io.Reader, modTime time.Time, size int64) error

Update the object from in with modTime and size

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL