filen

package
v1.8.1 Latest Latest
Warning

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

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

Documentation

Overview

Package filen provides an interface to Filen cloud storage.

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 a Fs at the path root

Types

type Directory

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

Directory is Filen's directory type

func (*Directory) Fs

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

Fs returns read only access to the Fs that this object is part of

func (*Directory) ID

func (dir *Directory) ID() string

ID returns the internal ID of this directory if known, or "" otherwise

func (*Directory) Items

func (dir *Directory) Items() int64

Items returns the count of items in this directory or this directory and subdirectories if known, -1 for unknown

func (*Directory) ModTime

func (dir *Directory) ModTime(ctx context.Context) time.Time

ModTime returns the modification date of the file It should return a best guess if one isn't available

func (*Directory) Remote

func (dir *Directory) Remote() string

Remote returns the remote path

func (*Directory) Size

func (dir *Directory) Size() int64

Size returns the size of the file

filen doesn't have an efficient way to find the size of a directory

func (*Directory) String

func (dir *Directory) String() string

String returns a description of the Object

type Fs

type Fs struct {
	Enc encoder.MultiEncoder
	// contains filtered or unexported fields
}

Fs represents a virtual filesystem mounted on a specific root folder

func (*Fs) About

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

About gets quota information from the Fs

func (*Fs) CleanUp

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

CleanUp the trash in the Fs

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 sets.

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

func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (err error)

ListR lists the objects and directories of the Fs starting from dir recursively into out.

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

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

It should call callback for each tranche of entries read. These need not be returned in any particular order. If callback returns an error then the listing will stop immediately.

Don't implement this unless you have a more efficient way of listing recursively that doing a directory traversal.

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) 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. 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) 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 return the precision of 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) 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) 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 converts this Fs to a string

type Object

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

Object is Filen's normal file

func (*Object) Fs

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

Fs returns read only access to the Fs that this object is part of

func (*Object) Hash

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

Hash returns the selected checksum of the file If no checksum is available it returns ""

func (*Object) ID

func (o *Object) ID() string

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

func (*Object) MimeType

func (o *Object) MimeType(_ context.Context) string

MimeType returns the content type of the Object if known, or "" if not

func (*Object) ModTime

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

ModTime returns the modification date of the file It should return a best guess if one isn't available

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

func (o *Object) ParentID() string

ParentID returns the ID of the parent directory if known or nil if not

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 this object

func (*Object) SetModTime

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

SetModTime sets the metadata on the object to set the modification date

func (*Object) Size

func (o *Object) Size() int64

Size returns the size of the file

func (*Object) Storable

func (o *Object) Storable() bool

Storable says whether this object can be stored

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 {
	Email             string               `config:"email"`
	Password          string               `config:"password"`
	APIKey            string               `config:"api_key"`
	Encoder           encoder.MultiEncoder `config:"encoding"`
	MasterKeys        string               `config:"master_keys"`
	PrivateKey        string               `config:"private_key"`
	PublicKey         string               `config:"public_key"`
	AuthVersion       int                  `config:"auth_version"`
	BaseFolderUUID    string               `config:"base_folder_uuid"`
	UploadConcurrency int                  `config:"upload_concurrency"`
}

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