koofr

package
v1.66.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 19 Imported by: 13

Documentation

Overview

Package koofr provides an interface to the Koofr 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) (ff fs.Fs, err error)

NewFs constructs a new filesystem given a root path and rclone configuration options

func NewFsFromOptions added in v1.58.0

func NewFsFromOptions(ctx context.Context, name, root string, opt *Options) (ff fs.Fs, err error)

NewFsFromOptions constructs a new filesystem given a root path and internal configuration options

Types

type Fs

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

An Fs is a representation of a remote Koofr Fs

func (*Fs) About

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

About reports space usage (with a MiB precision)

func (*Fs) Copy

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

Copy copies a remote Object to the given path

func (*Fs) DirMove

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

DirMove moves a remote directory to the given path

func (*Fs) Features

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

Features returns the optional features supported by this Fs

func (*Fs) Hashes

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

Hashes returns a set of hashes are Provided by the Fs

func (*Fs) List

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

List returns a list of items in a directory

func (*Fs) Mkdir

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

Mkdir creates a directory at the given remote path. Creates ancestors if necessary

func (*Fs) Move

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

Move moves a remote Object to the given path

func (*Fs) Name

func (f *Fs) Name() string

Name returns the name of the Fs

func (*Fs) NewObject

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

NewObject creates a new remote Object for a given remote path

func (*Fs) Precision

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

Precision denotes that setting modification times is not supported

func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration, unlink bool) (string, error)

PublicLink creates a public link to the remote path

func (*Fs) Purge

func (f *Fs) Purge(ctx context.Context) error

Purge purges the complete Fs

func (*Fs) Put

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

Put updates a remote Object

func (*Fs) PutStream

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

PutStream updates a remote Object with a stream of unknown size

func (*Fs) Rmdir

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

Rmdir removes an (empty) directory at the given remote path

func (*Fs) Root

func (f *Fs) Root() string

Root returns the root path of the Fs

func (*Fs) String

func (f *Fs) String() string

String returns a string representation of the Fs

type Object

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

An Object on the remote Koofr Fs

func (*Object) Fs

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

Fs returns a reference to the Koofr Fs containing the Object

func (*Object) Hash

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

Hash returns an MD5 hash of the Object

func (*Object) ModTime

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

ModTime returns the modification time of the Object

func (*Object) Open

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

Open opens the Object for reading

func (*Object) Remote

func (o *Object) Remote() string

Remote returns the remote path of the Object, relative to Fs root

func (*Object) Remove

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

Remove deletes the remote Object

func (*Object) SetModTime

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

SetModTime is not supported

func (*Object) Size

func (o *Object) Size() int64

Size return the size of the Object in bytes

func (*Object) Storable

func (o *Object) Storable() bool

Storable returns true if the Object is storable

func (*Object) String

func (o *Object) String() string

String returns a string representation of the remote Object

func (*Object) Update

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

Update updates the Object contents

type Options

type Options struct {
	Provider string               `config:"provider"`
	Endpoint string               `config:"endpoint"`
	MountID  string               `config:"mountid"`
	User     string               `config:"user"`
	Password string               `config:"password"`
	SetMTime bool                 `config:"setmtime"`
	Enc      encoder.MultiEncoder `config:"encoding"`
}

Options represent the configuration of the Koofr backend

Jump to

Keyboard shortcuts

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