upstream

package
v1.52.1-0...-9b21a15 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUsageFieldNotSupported stats the usage field is not supported by the backend
	ErrUsageFieldNotSupported = errors.New("this usage field is not supported")
)

Functions

This section is empty.

Types

type Directory

type Directory struct {
	fs.Directory
	// contains filtered or unexported fields
}

Directory describes a wrapped Directory

This is a wrapped Directory which contains the upstream Fs

func (*Directory) UpstreamFs

func (e *Directory) UpstreamFs() *Fs

UpstreamFs get the upstream Fs the entry is stored in

type Entry

type Entry interface {
	fs.DirEntry
	UpstreamFs() *Fs
}

Entry describe a warpped fs.DirEntry interface with the information of upstream Fs

type Fs

type Fs struct {
	fs.Fs
	RootFs   fs.Fs
	RootPath string
	// contains filtered or unexported fields
}

Fs is a wrap of any fs and its configs

func New

func New(remote, root string, cacheTime time.Duration) (*Fs, error)

New creates a new Fs based on the string formatted `type:root_path(:ro/:nc)`

func (*Fs) About

func (f *Fs) About(ctx context.Context) (*fs.Usage, error)

About gets quota information from the Fs

func (*Fs) GetFreeSpace

func (f *Fs) GetFreeSpace() (int64, error)

GetFreeSpace get the free space of the fs

func (*Fs) GetNumObjects

func (f *Fs) GetNumObjects() (int64, error)

GetNumObjects get the number of objects of the fs

func (*Fs) GetUsedSpace

func (f *Fs) GetUsedSpace() (int64, error)

GetUsedSpace get the used space of the fs

func (*Fs) IsCreatable

func (f *Fs) IsCreatable() bool

IsCreatable return if the fs is allowed to create new objects

func (*Fs) IsWritable

func (f *Fs) IsWritable() bool

IsWritable return if the fs is allowed to write

func (*Fs) Put

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) PutStream

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

PutStream uploads to the remote path with the modTime given of indeterminate 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) WrapDirectory

func (f *Fs) WrapDirectory(e fs.Directory) *Directory

WrapDirectory wraps an fs.Directory to include the info of the upstream Fs

func (*Fs) WrapEntry

func (f *Fs) WrapEntry(e fs.DirEntry) (Entry, error)

WrapEntry wraps an fs.DirEntry to include the info of the upstream Fs

func (*Fs) WrapObject

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

WrapObject wraps an fs.Object to include the info of the upstream Fs

type Object

type Object struct {
	fs.Object
	// contains filtered or unexported fields
}

Object describes a wrapped Object

This is a wrapped Object which contains the upstream Fs

func (*Object) UnWrap

func (o *Object) UnWrap() fs.Object

UnWrap returns the Object that this Object is wrapping or nil if it isn't wrapping anything

func (*Object) Update

func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error

Update in to the object with the modTime given of the given size

When called from outside an Fs by rclone, src.Size() will always be >= 0. But for unknown-sized objects (indicated by src.Size() == -1), Upload should either return an error or update the object properly (rather than e.g. calling panic).

func (*Object) UpstreamFs

func (o *Object) UpstreamFs() *Fs

UpstreamFs get the upstream Fs the entry is stored in

Jump to

Keyboard shortcuts

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