shade

package
v1.74.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package shade provides an interface to the Shade storage system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFS

func NewFS(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error)

NewFS constructs an FS from the path, container:path

Types

type Directory

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

Directory describes a ShadeFS directory

func (*Directory) Fs

func (d *Directory) Fs() fs.Info

Fs returns the filesystem info

func (*Directory) Hash

func (d *Directory) Hash(context.Context, hash.Type) (string, error)

Hash is unsupported for directories

func (*Directory) ID

func (d *Directory) ID() string

ID returns the directory ID (empty if not applicable)

func (*Directory) Items

func (d *Directory) Items() int64

Items returns the number of items in the directory (-1 if unknown)

func (*Directory) ModTime

func (d *Directory) ModTime(context.Context) time.Time

ModTime returns the modification time

func (*Directory) Open

func (d *Directory) Open() (io.ReadCloser, error)

Open returns an error for directories

func (*Directory) Remote

func (d *Directory) Remote() string

Remote returns the remote path

func (*Directory) SetModTime

func (d *Directory) SetModTime(context.Context, time.Time) error

SetModTime is unsupported for directories

func (*Directory) Size

func (d *Directory) Size() int64

Size returns the size (0 for directories)

func (*Directory) Storable

func (d *Directory) Storable() bool

Storable indicates directories aren’t storable as files

func (*Directory) String

func (d *Directory) String() string

type Fs

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

Fs represents a shade remote

func (*Fs) DirMove

func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string) error

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

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

Features returns the optional features of this Fs

func (*Fs) Hashes

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

Hashes returns the supported hash types

func (*Fs) List

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

List the objects and directories in dir into entries

func (*Fs) Mkdir

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

Mkdir creates the container if it doesn't exist

func (*Fs) Move

func (f *Fs) Move(ctx context.Context, 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 (*Fs) Name

func (f *Fs) Name() string

Name of the remote (as passed into NewFs)

func (*Fs) NewObject

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

NewObject finds the Object at remote

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

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

Precision returns the precision of the ModTimes

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

func (*Fs) Rmdir

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

Rmdir deletes the root folder

Returns an error if it isn't empty

func (*Fs) Root

func (f *Fs) Root() string

Root of the remote (as passed into NewFs)

func (*Fs) String

func (f *Fs) String() string

String returns a description of the FS

type Object

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

Object describes a ShadeFS object

func (*Object) Fs

func (o *Object) Fs() fs.Info

Fs returns the parent Fs

func (*Object) Hash

func (o *Object) Hash(ctx context.Context, t hash.Type) (string, error)

Hash returns the requested hash of the object content

func (*Object) ModTime

func (o *Object) ModTime(context.Context) time.Time

ModTime returns the modification date of the object

func (*Object) Open

func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)

Open an object for read

func (*Object) Remote

func (o *Object) Remote() string

Remote returns the remote path

func (*Object) Remove

func (o *Object) Remove(ctx context.Context) error

Remove removes the object

func (*Object) SetModTime

func (o *Object) SetModTime(context.Context, time.Time) error

SetModTime sets the modification time of the object

func (*Object) Size

func (o *Object) Size() int64

Size returns the size of the object

func (*Object) Storable

func (o *Object) Storable() bool

Storable returns whether this object is storable

func (*Object) String

func (o *Object) String() string

String returns a description 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

Directories

Path Synopsis
Package api has type definitions for shade
Package api has type definitions for shade

Jump to

Keyboard shortcuts

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