oss

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxKeys         = 1000
	MinBigFile      = 500 << 20
	MaxParts        = 10000
	MinParts        = 1000
	DefaultPartSize = 500 << 10
)

Variables

This section is empty.

Functions

func WithProgressListenerDist

func WithProgressListenerDist(dist string) listenerOpt

func WithProgressListenerSrc

func WithProgressListenerSrc(src string) listenerOpt

func WithProgressOp

func WithProgressOp(op Op) listenerOpt

Types

type Client

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

func NewClient

func NewClient(
	bucketName string,
	endpoint string,
	accessID string,
	accessSecret string,
) (*Client, error)

type DirEntry

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

DirEntry implements fs.DirEntry.

func NewDirEntry

func NewDirEntry(info *FileInfo) *DirEntry

func (DirEntry) Dir

func (d DirEntry) Dir() string

func (DirEntry) ETag added in v1.0.5

func (d DirEntry) ETag() string

func (DirEntry) Info

func (d DirEntry) Info() (fs.FileInfo, error)

func (DirEntry) IsDir

func (d DirEntry) IsDir() bool

func (DirEntry) Name

func (d DirEntry) Name() string

func (DirEntry) Path

func (d DirEntry) Path() string

func (*DirEntry) SetETag added in v1.0.5

func (d *DirEntry) SetETag(etag string)

func (*DirEntry) SetInfo added in v1.0.5

func (d *DirEntry) SetInfo(info *FileInfo)

func (*DirEntry) SetModTime added in v1.0.5

func (d *DirEntry) SetModTime(t time.Time)

func (*DirEntry) SetPath added in v1.0.5

func (d *DirEntry) SetPath(path string)

func (*DirEntry) SetSize added in v1.0.5

func (d *DirEntry) SetSize(size int64)

func (DirEntry) Type

func (d DirEntry) Type() fs.FileMode

type FS

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

func NewFS

func NewFS(clt *Client, opts ...Option) *FS

func (*FS) Close

func (f *FS) Close()

func (*FS) Copy

func (f *FS) Copy(ctx context.Context, src string, dist string) error

func (*FS) Download

func (f *FS) Download(ctx context.Context, remotePath string, localPath string) error

func (*FS) Events

func (f *FS) Events() <-chan ProgressEvent

func (*FS) Exists

func (f *FS) Exists(ctx context.Context, key string, etag string) bool

func (*FS) Open

func (f *FS) Open(ctx context.Context, name string) (fs.File, error)

func (*FS) OpenWithEtag added in v1.0.5

func (f *FS) OpenWithEtag(ctx context.Context, name string, etag string) (fs.File, error)

func (*FS) PathAddPrefix added in v1.0.4

func (f *FS) PathAddPrefix(name string) string

func (*FS) PathRemovePrefix added in v1.0.4

func (f *FS) PathRemovePrefix(name string) string

func (*FS) ReadAt added in v1.0.4

func (f *FS) ReadAt(ctx context.Context, name string, size int64, offset int64) ([]byte, error)

func (*FS) ReadDirFile added in v1.0.4

func (fs *FS) ReadDirFile(name string) *ReadDirFile

func (*FS) ReadFile

func (f *FS) ReadFile(ctx context.Context, name string) ([]byte, error)

func (*FS) RemotePathFromLocalFile

func (f *FS) RemotePathFromLocalFile(localFile *local.FileInfo) (string, error)

func (*FS) Remove

func (f *FS) Remove(ctx context.Context, keys ...string) ([]string, error)

func (*FS) RemoveAll

func (f *FS) RemoveAll(ctx context.Context, dir string) ([]string, error)

func (*FS) Rename

func (f *FS) Rename(ctx context.Context, src string, dist string) error

func (*FS) RenameDir added in v1.0.4

func (f *FS) RenameDir(ctx context.Context, src string, dist string) error

func (*FS) Root added in v1.0.4

func (f *FS) Root() string

func (*FS) RootEntry added in v1.0.4

func (f *FS) RootEntry() *DirEntry

func (*FS) Stat

func (f *FS) Stat(ctx context.Context, name string) (fs.FileInfo, error)

func (*FS) Upload

func (f *FS) Upload(ctx context.Context, key string, r io.Reader) error

func (*FS) UploadFile added in v1.0.4

func (f *FS) UploadFile(ctx context.Context, localFile *local.FileInfo) error

type File

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

func NewFile

func NewFile(bucket *oss.Bucket, info *FileInfo) *File

func (File) Close

func (f File) Close() error

func (*File) Info added in v1.0.4

func (f *File) Info() *FileInfo

func (File) Read

func (f File) Read(b []byte) (int, error)

func (File) Stat

func (f File) Stat() (fs.FileInfo, error)

type FileInfo

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

func NewFileInfo

func NewFileInfo(obj *oss.ObjectProperties) *FileInfo

func NewFileInfoWithDir

func NewFileInfoWithDir(dir string) *FileInfo

func NewFileInfoWithHeader

func NewFileInfoWithHeader(name string, header http.Header) *FileInfo

func (FileInfo) Dir

func (fi FileInfo) Dir() string

func (FileInfo) ETag added in v1.0.5

func (fi FileInfo) ETag() string

func (FileInfo) IsDir

func (fi FileInfo) IsDir() bool

func (FileInfo) ModTime

func (fi FileInfo) ModTime() time.Time

func (FileInfo) Mode

func (fi FileInfo) Mode() os.FileMode

func (FileInfo) Name

func (fi FileInfo) Name() string

func (FileInfo) Path

func (fi FileInfo) Path() string

func (*FileInfo) SetETag added in v1.0.5

func (fi *FileInfo) SetETag(etag string)

func (*FileInfo) SetModTime added in v1.0.5

func (fi *FileInfo) SetModTime(t time.Time)

func (*FileInfo) SetPath added in v1.0.4

func (fi *FileInfo) SetPath(path string)

func (*FileInfo) SetSize added in v1.0.5

func (fi *FileInfo) SetSize(size int64)

func (FileInfo) Size

func (fi FileInfo) Size() int64

func (FileInfo) String

func (fi FileInfo) String() string

func (FileInfo) Sys

func (fi FileInfo) Sys() any

type MultiProgressListener

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

func NewMultiProgressListener

func NewMultiProgressListener() *MultiProgressListener

func (*MultiProgressListener) Close

func (listener *MultiProgressListener) Close()

func (*MultiProgressListener) CopyListener

func (listener *MultiProgressListener) CopyListener(src string, dist string) oss.ProgressListener

func (*MultiProgressListener) DownloadListener

func (listener *MultiProgressListener) DownloadListener(remote string, local string) oss.ProgressListener

func (*MultiProgressListener) Events

func (listener *MultiProgressListener) Events() <-chan ProgressEvent

func (*MultiProgressListener) RemoveListener

func (listener *MultiProgressListener) RemoveListener(src string) oss.ProgressListener

func (*MultiProgressListener) UploadListener

func (listener *MultiProgressListener) UploadListener(local string, remote string) oss.ProgressListener

type Op

type Op int
const (
	Upload Op = iota
	Download
	Remove
	Copy
)

func (Op) String

func (op Op) String() string

type Option

type Option func(fs *FS)

func WithIgnoreHidden added in v1.0.5

func WithIgnoreHidden(ignore bool) Option

func WithLocal

func WithLocal(local string) Option

func WithPrefix

func WithPrefix(prefix string) Option

type ProgressEvent

type ProgressEvent struct {
	Src  string
	Dist string
	oss.ProgressEvent
	Op Op
}

func (ProgressEvent) Progress

func (e ProgressEvent) Progress() float64

func (ProgressEvent) Status

func (e ProgressEvent) Status() string

func (ProgressEvent) String

func (e ProgressEvent) String() string

type ProgressListener

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

定义进度条监听器。

func NewProgressListener

func NewProgressListener(ch chan<- ProgressEvent, opts ...listenerOpt) *ProgressListener

func (*ProgressListener) ProgressChanged

func (listener *ProgressListener) ProgressChanged(event *oss.ProgressEvent)

定义进度变更事件处理函数。

type ReadDirFS

type ReadDirFS struct {
	FS
}

func NewReadDirFS

func NewReadDirFS(fs *FS) *ReadDirFS

func (*ReadDirFS) ReadDir

func (f *ReadDirFS) ReadDir(ctx context.Context, name string) ([]fs.DirEntry, error)

type ReadDirFile

type ReadDirFile struct {
	FS
	// contains filtered or unexported fields
}

func NewReadDirFile

func NewReadDirFile(fs *FS, name string) *ReadDirFile

func (*ReadDirFile) Completed

func (f *ReadDirFile) Completed() bool

func (*ReadDirFile) Dir added in v1.0.4

func (f *ReadDirFile) Dir() string

func (*ReadDirFile) DirEntry added in v1.0.4

func (f *ReadDirFile) DirEntry() *DirEntry

func (*ReadDirFile) ReadDir

func (f *ReadDirFile) ReadDir(ctx context.Context, n int) ([]fs.DirEntry, error)

func (*ReadDirFile) Reset

func (f *ReadDirFile) Reset()

Jump to

Keyboard shortcuts

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