storage

package
v0.0.0-...-aa82ca8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalStorage

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

LocalStorage 提供本地持久化服务

func NewLocalStorage

func NewLocalStorage(path string) *LocalStorage

NewLocalStorage 返回本地持久化服务实例. For Unix system, path should meet unix naming rules, like "/path/to/a/b/c".

func (*LocalStorage) Abort

func (p *LocalStorage) Abort(ctx context.Context, file *common.File) error

Abort 放弃当前文件的持久化工作.

func (*LocalStorage) Delete

func (p *LocalStorage) Delete(ctx context.Context, file *common.File) error

Delete 从本地磁盘上删除当前文件.

func (*LocalStorage) Destroy

func (p *LocalStorage) Destroy() error

Destroy 清除本地持久化服务的资源.

func (*LocalStorage) Get

func (p *LocalStorage) Get(ctx context.Context, file *common.File) (string, error)

Get 从本地磁盘上读取当前文件.

func (*LocalStorage) Init

func (p *LocalStorage) Init() error

Init 初始化用于本地持久化服务的资源.

func (*LocalStorage) LocalPath

func (p *LocalStorage) LocalPath(file *common.File) string

LocalPath 本地文件持久化路径.

func (*LocalStorage) Put

func (p *LocalStorage) Put(ctx context.Context, file *common.File) (string, error)

Put 将当前文件写入本地磁盘.

func (*LocalStorage) Readable

func (p *LocalStorage) Readable(ctx context.Context, file *common.File) (string, error)

Readable 检查当前文件是否可读, 可以就返回待读取的持久化路径.

func (*LocalStorage) Writable

func (p *LocalStorage) Writable(ctx context.Context, file *common.File) (string, error)

Writable 检查当前文件是否可写, 可以就返回待写入的持久化路径.

type Persister

type Persister interface {
	Init() (err error)
	Destroy() (err error)
	Writable(ctx context.Context, file *common.File) (path string, err error)
	Put(ctx context.Context, file *common.File) (string, error)
	Readable(ctx context.Context, file *common.File) (path string, err error)
	Get(ctx context.Context, file *common.File) (string, error)
	Abort(ctx context.Context, file *common.File) error
	Delete(ctx context.Context, file *common.File) error
}

Persister 持久化接口定义

type S3Storage

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

S3Storage 提供s3持久化服务

func NewS3Storage

func NewS3Storage(cfg *conf.MinioConfig) (*S3Storage, error)

NewS3Storage 返回s3持久化服务实例. For Unix system, path should meet unix naming rules, like "/path/to/a/b/c".

func (*S3Storage) Abort

func (p *S3Storage) Abort(ctx context.Context, file *common.File) error

Abort 从本地暂存磁盘上删除当前文件.

func (*S3Storage) Delete

func (p *S3Storage) Delete(ctx context.Context, file *common.File) error

Delete 从s3集群上删除当前文件.

func (*S3Storage) Destroy

func (p *S3Storage) Destroy() error

Destroy 清除s3持久化服务的资源.

func (*S3Storage) Get

func (p *S3Storage) Get(ctx context.Context, file *common.File) (string, error)

Get 从本地暂存磁盘上读取当前文件.

func (*S3Storage) Init

func (p *S3Storage) Init() error

Init 初始化用于s3持久化服务的资源.

func (*S3Storage) LocalPath

func (p *S3Storage) LocalPath(file *common.File) string

LocalPath 本地文件暂存路径.

func (*S3Storage) Put

func (p *S3Storage) Put(ctx context.Context, file *common.File) (string, error)

Put 将本地暂存磁盘上的文件写入s3集群.

func (*S3Storage) Readable

func (p *S3Storage) Readable(ctx context.Context, file *common.File) (string, error)

Readable 检查当前文件是否可读, 可以就将s3集群上的文件写入本地暂存磁盘, 并返回写入的本地暂存路径.

func (*S3Storage) RemotePath

func (p *S3Storage) RemotePath(file *common.File) string

RemotePath 服务端文件持久化路径.

func (*S3Storage) Writable

func (p *S3Storage) Writable(ctx context.Context, file *common.File) (string, error)

Writable 检查当前文件是否可写, 可以就写入本地暂存磁盘, 并返回写入的本地暂存路径.

Jump to

Keyboard shortcuts

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