rclone: github.com/ncw/rclone/fstest/mockfs Index | Files

package mockfs

import "github.com/ncw/rclone/fstest/mockfs"


Package Files



var ErrNotImplemented = errors.New("not implemented")

ErrNotImplemented is returned by unimplemented methods

type Fs Uses

type Fs struct {
    // contains filtered or unexported fields

Fs is a minimal mock Fs

func NewFs Uses

func NewFs(name, root string) *Fs

NewFs returns a new mock Fs

func (*Fs) AddObject Uses

func (f *Fs) AddObject(o fs.Object)

AddObject adds an Object for List to return Only works for the root for the moment

func (*Fs) Features Uses

func (f *Fs) Features() *fs.Features

Features returns the optional features of this Fs

func (*Fs) Hashes Uses

func (f *Fs) Hashes() hash.Set

Hashes returns the supported hash types of the filesystem

func (*Fs) List Uses

func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error)

List the objects and directories in dir into entries. The entries can be returned in any order but should be for a complete directory.

dir should be "" to list the root, and should not have trailing slashes.

This should return ErrDirNotFound if the directory isn't found.

func (*Fs) Mkdir Uses

func (f *Fs) Mkdir(ctx context.Context, dir string) error

Mkdir makes the directory (container, bucket)

Shouldn't return an error if it already exists

func (*Fs) Name Uses

func (f *Fs) Name() string

Name of the remote (as passed into NewFs)

func (*Fs) NewObject Uses

func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error)

NewObject finds the Object at remote. If it can't be found it returns the error ErrorObjectNotFound.

func (*Fs) Precision Uses

func (f *Fs) Precision() time.Duration

Precision of the ModTimes in this Fs

func (*Fs) Put Uses

func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)

Put in to the remote path with the modTime given of the given size

May create the object even if it returns an error - if so will return the object and the error, otherwise will return nil and the error

func (*Fs) Rmdir Uses

func (f *Fs) Rmdir(ctx context.Context, dir string) error

Rmdir removes the directory (container, bucket) if empty

Return an error if it doesn't exist or isn't empty

func (*Fs) Root Uses

func (f *Fs) Root() string

Root of the remote (as passed into NewFs)

func (*Fs) SetHashes Uses

func (f *Fs) SetHashes(hashes hash.Set)

SetHashes sets the hashes that this supports

func (*Fs) String Uses

func (f *Fs) String() string

String returns a description of the FS

Package mockfs imports 8 packages (graph). Updated 2020-07-11. Refresh now. Tools for package owners.