upstream

package
v1.66.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package upstream provides utility functionality to union.

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

func Prepare added in v1.62.1

func Prepare(fses []*Fs) error

Prepare the configured upstreams as a group

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 wrapped fs.DirEntry interface with the information of upstream Fs

type Fs

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

Fs is a wrap of any fs and its configs

func New

func New(ctx context.Context, remote, root string, opt *common.Options) (*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

This is returned as 0..math.MaxInt64-1 leaving math.MaxInt64 as a sentinel

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

This is returned as 0..math.MaxInt64-1 leaving math.MaxInt64 as a sentinel

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) GetTier added in v1.59.1

func (o *Object) GetTier() string

GetTier returns storage tier or class of the Object

func (*Object) ID added in v1.59.1

func (o *Object) ID() string

ID returns the ID of the Object if known, or "" if not

func (*Object) Metadata added in v1.59.1

func (o *Object) Metadata(ctx context.Context) (fs.Metadata, error)

Metadata returns metadata for an object

It should return nil if there is no Metadata

func (*Object) MimeType added in v1.59.1

func (o *Object) MimeType(ctx context.Context) (mimeType string)

MimeType returns the content type of the Object if known

func (*Object) SetTier added in v1.59.1

func (o *Object) SetTier(tier string) error

SetTier performs changing storage tier of the Object if multiple storage classes supported

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

func (*Object) Writeback added in v1.62.1

func (o *Object) Writeback(ctx context.Context) (*Object, error)

Writeback writes the object back and returns a new object

If it returns nil, nil then the original object is OK

Jump to

Keyboard shortcuts

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