Documentation
¶
Overview ¶
Package shade provides an interface to the Shade storage system.
Index ¶
- func NewFS(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error)
- type Directory
- func (d *Directory) Fs() fs.Info
- func (d *Directory) Hash(context.Context, hash.Type) (string, error)
- func (d *Directory) ID() string
- func (d *Directory) Items() int64
- func (d *Directory) ModTime(context.Context) time.Time
- func (d *Directory) Open() (io.ReadCloser, error)
- func (d *Directory) Remote() string
- func (d *Directory) SetModTime(context.Context, time.Time) error
- func (d *Directory) Size() int64
- func (d *Directory) Storable() bool
- func (d *Directory) String() string
- type Fs
- func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string) error
- func (f *Fs) Features() *fs.Features
- func (f *Fs) Hashes() hash.Set
- func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error)
- func (f *Fs) Mkdir(ctx context.Context, dir string) error
- func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, error)
- func (f *Fs) Name() string
- func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error)
- func (f *Fs) OpenChunkWriter(ctx context.Context, remote string, src fs.ObjectInfo, ...) (info fs.ChunkWriterInfo, writer fs.ChunkWriter, err error)
- func (f *Fs) Precision() time.Duration
- func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
- func (f *Fs) Rmdir(ctx context.Context, dir string) error
- func (f *Fs) Root() string
- func (f *Fs) String() string
- type Object
- func (o *Object) Fs() fs.Info
- func (o *Object) Hash(ctx context.Context, t hash.Type) (string, error)
- func (o *Object) ModTime(context.Context) time.Time
- func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)
- func (o *Object) Remote() string
- func (o *Object) Remove(ctx context.Context) error
- func (o *Object) SetModTime(context.Context, time.Time) error
- func (o *Object) Size() int64
- func (o *Object) Storable() bool
- func (o *Object) String() string
- func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
Directory describes a ShadeFS directory
func (*Directory) Open ¶
func (d *Directory) Open() (io.ReadCloser, error)
Open returns an error for directories
func (*Directory) SetModTime ¶
SetModTime is unsupported for directories
type Fs ¶
type Fs struct {
// contains filtered or unexported fields
}
Fs represents a shade remote
func (*Fs) DirMove ¶
DirMove moves src, srcRemote to this remote at dstRemote 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 (*Fs) Move ¶
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 (*Fs) OpenChunkWriter ¶
func (f *Fs) OpenChunkWriter(ctx context.Context, remote string, src fs.ObjectInfo, options ...fs.OpenOption) (info fs.ChunkWriterInfo, writer fs.ChunkWriter, err error)
OpenChunkWriter returns the chunk size and a ChunkWriter
Pass in the remote and the src object You can also use options to hint at the desired chunk size
func (*Fs) Put ¶
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
Put uploads a file
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object describes a ShadeFS object
func (*Object) Open ¶
func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)
Open an object for read
func (*Object) SetModTime ¶
SetModTime sets the modification time of the object
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).
type Options ¶
type Options struct {
Drive string `config:"drive_id"`
APIKey string `config:"api_key"`
Endpoint string `config:"endpoint"`
ChunkSize fs.SizeSuffix `config:"chunk_size"`
MaxUploadParts int `config:"max_upload_parts"`
Concurrency int `config:"upload_concurrency"`
Token string `config:"token"`
TokenExpiry string `config:"token_expiry"`
Encoding encoder.MultiEncoder
}
Options defines the configuration for this backend