better_chunk

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxSliceSize    = 1024 * 1024 * 29
	CanUseSliceSize = 30408704
)

Variables

View Source
var BmpHead = []byte{66, 77, 66, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

BmpHead 定义了位图的头部

Functions

func Lock

func Lock(key string)

Lock 对给定键加锁

func NewFs

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

func ToBmpReader

func ToBmpReader(in io.Reader, realDataSize int64) (io.Reader, int64, int64)

func Unlock

func Unlock(key string)

Unlock 对给定键解锁

Types

type ChunkFileInfo

type ChunkFileInfo struct {
	Name     string             `json:"name"`
	FileSize int64              `json:"fileSize"`
	List     []*fs.FileFragInfo `json:"list"`
}

type Fs

type Fs struct {
	FileStructure fs.Fs
	FileStore     fs.Fs

	ChunkInfoCache *patrickmnCache.Cache
	// contains filtered or unexported fields
}

Fs represents a wrapped fs.Fs

func (*Fs) About

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

About gets quota information from the Fs

func (*Fs) Copy

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

Copy src to this remote using server-side copy 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.ErrorCantCopy

func (*Fs) DirMove

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

func (Fs) Features

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

func (Fs) Hashes

func (f Fs) Hashes() hash.Set

func (Fs) List

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

func (Fs) Mkdir

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

func (*Fs) Move

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

func (Fs) Name

func (f Fs) Name() string

func (Fs) NewObject

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

func (Fs) Precision

func (f Fs) Precision() time.Duration

func (*Fs) Purge

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

func (Fs) Put

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

func (Fs) PutStream

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

src.Size()可能为-1

func (Fs) Rmdir

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

只删除文件夹,不用删除文件夹内的文件

func (Fs) Root

func (f Fs) Root() string

func (Fs) String

func (f Fs) String() string

type Object

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

Object represents a composite file wrapping one or more data chunks

func NewObject

func NewObject(o fs.Object, fs Fs) (*Object, error)

func (Object) Fs

func (o Object) Fs() fs.Info

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

func (Object) Remove

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

Remove Removes this object

func (Object) Size

func (o Object) Size() int64

func (Object) String

func (o Object) String() string

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 ObjectInfoWrapper

type ObjectInfoWrapper struct {
	fs.ObjectInfo
	// contains filtered or unexported fields
}

func NewObjectInfoWrapper

func NewObjectInfoWrapper(objectInfo fs.ObjectInfo, remote string, size int64) *ObjectInfoWrapper

func (ObjectInfoWrapper) Remote

func (ow ObjectInfoWrapper) Remote() string

func (ObjectInfoWrapper) Size

func (ow ObjectInfoWrapper) Size() int64

Size returns the size of the file

type Options

type Options struct {
	FileStructureRemote string `config:"file_structure_remote"`
	FileStoreRemote     string `config:"file_store_remote"`
}

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