s3manager

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFile

func NewFile(mgr *S3Manager, object *minio.Object, name string, memoryUploadMode bool, uploadTmpPath string) *file

func NewFileInfo

func NewFileInfo(objectInfo minio.ObjectInfo) os.FileInfo

func NewS3FileInfo

func NewS3FileInfo(object *s3.Object) os.FileInfo

func NewStrFileInfo

func NewStrFileInfo(prefix string) os.FileInfo

Types

type Connector

type Connector func(m *dbschema.NgingCloudStorage) (*minio.Client, error)

type S3

type S3 interface {
	GetObject(bucketName, objectName string, opts minio.GetObjectOptions) (*minio.Object, error)
	ListBuckets() ([]minio.BucketInfo, error)
	ListObjectsV2(bucketName, objectPrefix string, recursive bool, doneCh <-chan struct{}) <-chan minio.ObjectInfo
	MakeBucket(bucketName, location string) error
	PutObject(bucketName, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (int64, error)
	RemoveBucket(bucketName string) error
	RemoveObject(bucketName, objectName string) error
}

S3 is a client to interact with S3 storage.

type S3Manager

type S3Manager struct {
	EditableMaxSize int
	// contains filtered or unexported fields
}

func New

func New(connector Connector, config *dbschema.NgingCloudStorage, editableMaxSize int) *S3Manager

func (*S3Manager) BucketName

func (s *S3Manager) BucketName() string

func (*S3Manager) Chmod

func (s *S3Manager) Chmod(ppath string, mode os.FileMode) error

func (*S3Manager) Chown

func (s *S3Manager) Chown(ppath string, uid, gid int) error

func (*S3Manager) Clear

func (s *S3Manager) Clear(ctx context.Context) error

Clear 清空所有数据【慎用】

func (*S3Manager) Client

func (s *S3Manager) Client() *minio.Client

func (*S3Manager) ConnError

func (s *S3Manager) ConnError() error

func (*S3Manager) Connect

func (s *S3Manager) Connect() error

func (*S3Manager) Copy

func (s *S3Manager) Copy(ctx context.Context, from, to string) error

func (*S3Manager) Download

func (s *S3Manager) Download(ctx echo.Context, ppath string) error

func (*S3Manager) Edit

func (s *S3Manager) Edit(ctx echo.Context, ppath string, content string, encoding string) (interface{}, error)

func (*S3Manager) ErrIsNotExist

func (s *S3Manager) ErrIsNotExist(err error) bool

func (*S3Manager) Exists

func (s *S3Manager) Exists(ctx context.Context, ppath string) (bool, error)

Exists 对象是否存在

func (*S3Manager) FPutObject

func (s *S3Manager) FPutObject(ctx context.Context, filePath string, objectName string) (int64, error)

func (*S3Manager) Get

func (s *S3Manager) Get(ctx context.Context, ppath string) (*minio.Object, error)

Get 获取数据

func (*S3Manager) List

func (s *S3Manager) List(ctx echo.Context, ppath string, sortBy ...string) (dirs []os.FileInfo, exit bool, err error)

func (*S3Manager) ListTransfer

func (s *S3Manager) ListTransfer(dirs []os.FileInfo) (dirList []echo.H, fileList []echo.H)

func (*S3Manager) Mkbucket

func (s *S3Manager) Mkbucket(ctx context.Context, bucketName string, regions ...string) error

func (*S3Manager) Mkdir

func (s *S3Manager) Mkdir(ctx context.Context, ppath, newName string) error

func (*S3Manager) Move

func (s *S3Manager) Move(ctx context.Context, from, to string) error

func (*S3Manager) PresignedPutObject

func (s *S3Manager) PresignedPutObject(ctx context.Context, objectName string, expires time.Duration) (putURL *url.URL, err error)

PresignedPutObject 获取直链上传url

func (*S3Manager) Put

func (s *S3Manager) Put(ctx context.Context, reader io.Reader, objectName string, size int64) (err error)

Put 提交数据

func (*S3Manager) PutObject

func (s *S3Manager) PutObject(ctx context.Context, reader io.Reader, objectName string, size int64) (int64, error)

func (*S3Manager) Remove

func (s *S3Manager) Remove(ctx context.Context, ppath string) error

func (*S3Manager) RemoveDir

func (s *S3Manager) RemoveDir(ctx context.Context, ppath string) error

func (*S3Manager) Rename

func (s *S3Manager) Rename(ctx context.Context, ppath, newName string) error

func (*S3Manager) Search

func (s *S3Manager) Search(ctx context.Context, ppath string, prefix string, num int) []string

func (*S3Manager) SetBucketName

func (s *S3Manager) SetBucketName(bucketName string) *S3Manager

func (*S3Manager) Stat

func (s *S3Manager) Stat(ctx context.Context, ppath string) (minio.ObjectInfo, error)

Stat 获取对象信息

func (*S3Manager) StatIsExists

func (s *S3Manager) StatIsExists(f minio.ObjectInfo, err error) (bool, error)

StatIsExists 对象是否存在

func (*S3Manager) Upload

func (s *S3Manager) Upload(ctx echo.Context, ppath string,
	chunkUpload *uploadClient.ChunkUpload,
	chunkOpts ...uploadClient.ChunkInfoOpter) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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