storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(cfg Config) (fs.Repository, error)

func Register

func Register(manager *filesystem.Manager)

Register向当前应用的文件系统管理器添加云存储驱动。

Types

type Config

type Config struct {
	Driver    string `json:"driver"`
	Root      string `json:"root,omitempty"`
	Bucket    string `json:"bucket,omitempty"`
	Endpoint  string `json:"endpoint,omitempty"`
	Region    string `json:"region,omitempty"`
	Prefix    string `json:"prefix,omitempty"`
	URL       string `json:"url,omitempty"`
	PathStyle bool   `json:"path_style,omitempty"`
	ACL       string `json:"acl,omitempty"`
	AccessKey string `json:"-"`
	SecretKey string `json:"-"`
}

Config中的位置随文件保存,密钥只在请求中从保密配置读取。

type S3

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

S3 适配AWS、七牛和COS的兼容接口;签名、重试和流式传输由SDK处理。

func NewS3

func NewS3(cfg Config) *S3

func (*S3) Close

func (d *S3) Close() error

func (*S3) Copy

func (d *S3) Copy(ctx context.Context, src, dst string) error

func (*S3) Delete

func (d *S3) Delete(ctx context.Context, key string) error

func (*S3) DeleteDirectory

func (d *S3) DeleteDirectory(ctx context.Context, dir string) error

func (*S3) Exists

func (d *S3) Exists(ctx context.Context, key string) (bool, error)

func (*S3) GetVisibility

func (d *S3) GetVisibility(ctx context.Context, key string) (string, error)

func (*S3) List

func (d *S3) List(ctx context.Context, prefix string, recursive bool) ([]filesystem.FileInfo, error)

func (*S3) MakeDirectory

func (d *S3) MakeDirectory(context.Context, string) error

func (*S3) Move

func (d *S3) Move(ctx context.Context, src, dst string) error

func (*S3) Open

func (d *S3) Open(ctx context.Context, key string) (io.ReadCloser, filesystem.FileInfo, error)

func (*S3) Path

func (d *S3) Path(key string) string

func (*S3) ReadAll

func (d *S3) ReadAll(ctx context.Context, key string) ([]byte, error)

func (*S3) SetVisibility

func (d *S3) SetVisibility(ctx context.Context, key, visibility string) error

func (*S3) Stat

func (d *S3) Stat(ctx context.Context, key string) (filesystem.FileInfo, error)

func (*S3) TemporaryURL

func (d *S3) TemporaryURL(ctx context.Context, key string, expiry time.Time) (string, error)

func (*S3) URL

func (d *S3) URL(key string) (string, error)

func (*S3) Write

func (d *S3) Write(ctx context.Context, key string, reader io.Reader, opts filesystem.PutOptions) error

Jump to

Keyboard shortcuts

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