linkbox

package
v0.0.0-...-1dc401f Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package linkbox provides an interface to the linkbox.to Cloud storage system.

API docs: https://www.linkbox.to/api-docs

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 creates a new Fs object from the name and root. It connects to the host specified in the config file.

Types

type Fs

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

Fs stores the interface to the remote Linkbox files

func (*Fs) CreateDir

func (f *Fs) CreateDir(ctx context.Context, dirID, leaf string) (newID string, err error)

CreateDir makes a directory with dirID as parent and name leaf

func (*Fs) DirCacheFlush

func (f *Fs) DirCacheFlush()

DirCacheFlush resets the directory cache - used in testing as an optional interface

func (*Fs) Features

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

Features returns the optional features of this Fs Info provides a read only interface to information about a filesystem.

func (*Fs) FindLeaf

func (f *Fs) FindLeaf(ctx context.Context, directoryID, leaf string) (directoryIDOut string, found bool, err error)

FindLeaf finds a directory of name leaf in the folder with ID directoryID

func (*Fs) Hashes

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

Hashes returns hash.HashNone to indicate remote hashing is unavailable Returns the supported hash types of the filesystem

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. The entries can be returned in any order but should be for a complete directory.

dir should be "" to list the root, and should not have trailing slashes.

This should return ErrDirNotFound if the directory isn't found.

func (*Fs) Mkdir

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

Mkdir makes the directory (container, bucket)

Shouldn't return an error if it already exists

func (*Fs) Name

func (f *Fs) Name() string

Name of the remote (as passed into NewFs) Name returns the configured name of the file system

func (*Fs) NewObject

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

NewObject finds the Object at remote. If it can't be found it returns the error ErrorObjectNotFound.

If remote points to a directory then it should return ErrorIsDir if possible without doing any extra work, otherwise ErrorObjectNotFound.

func (*Fs) Precision

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

Precision of the ModTimes in this Fs

func (*Fs) Purge

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

Purge all files in the directory specified

Implement this if you have a way of deleting all the files quicker than just running Remove() on the result of List()

Return an error if it doesn't exist

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

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

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

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

Rmdir removes the directory (container, bucket) if empty

Return an error if it doesn't exist or 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 is a remote object that has been stat'd (so it exists, but is not necessarily open for reading)

func (*Object) Fs

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

Fs is the filesystem this remote http file object is located within

func (*Object) Hash

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

Hash returns "" since HTTP (in Go or OpenSSH) doesn't support remote calculation of hashes

func (*Object) ModTime

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

ModTime returns the modification time of the remote http file

func (*Object) Open

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

Open opens the file for read. Call Close() on the returned io.ReadCloser

func (*Object) Remote

func (o *Object) Remote() string

Remote the name of the remote HTTP file, relative to the fs root

func (*Object) Remove

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

Remove this object

func (*Object) SetModTime

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

SetModTime sets modTime on a particular file

func (*Object) Size

func (o *Object) Size() int64

Size returns the size in bytes of the remote http file

func (*Object) Storable

func (o *Object) Storable() bool

Storable returns whether the remote http file is a regular file (not a directory, symbolic link, block device, character device, named pipe, etc.)

func (*Object) String

func (o *Object) String() string

String returns the URL to the remote HTTP file

func (*Object) Update

func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err 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 {
	Token string `config:"token"`
}

Options defines the configuration for this backend

Jump to

Keyboard shortcuts

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