ossstore

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OSSAPI

type OSSAPI interface {
	// GetObject
	//
	// download object by a object key
	//
	// io.ReadCloser	reader instance for reading data from response.
	// It must be called close() after the usage and only valid when error is nil.
	//
	// error 	it's nil if no error, otherwise it's an error object.
	//
	ReadObject(ctx context.Context, objectKey string) (io.ReadCloser, error)

	// GetObjectSize
	//
	// get the object size by a object key
	// get size from metadata
	//
	// error 	it's nil if no error, otherwise it's an error object.
	//
	GetObjectSize(ctx context.Context, objectKey string) (int64, error)

	// DeleteObject
	//
	// remove the object by object keys
	//
	// error 	it's nil if no error, otherwise it's an error object.
	//
	DeleteObject(ctx context.Context, objectKey ...string) error

	// WriteObject
	// creates a new object and it will overwrite the original one if it exists already.
	//
	// objectKey	the object key in UTF-8 encoding. The length must be between 1 and 1023, and cannot start with "/" or "\".
	// reader 	io.Reader instance for reading the data for uploading
	//
	// error 	it's nil if no error, otherwise it's an error object.
	//
	WriteObject(ctx context.Context, objectKey string, r io.Reader) error

	// AppendObject
	//
	// uploads the data in the way of appending an existing or new object.
	//
	// reader	io.Reader. The read instance for reading the data to append.
	// offset	the start position to append.
	//
	// int64	the next append position, it's valid when error is nil.
	// error	it's nil if no error, otherwise it's an error object.
	//
	AppendObject(ctx context.Context, objectKey string, r io.Reader, offset int64) (int64, error)
}

OSSAPI aliyun oss sdk API

func NewOSSService

func NewOSSService(endpoint, accessKeyId, accessKeySecret, bucketName string) (OSSAPI, error)

NewOSSService aliyun OSS(Object Storage Service) https://www.aliyun.com/product/oss

type OSSStore

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

func New

func New(service OSSAPI) OSSStore

aliyun OSS(Object Storage Service) https://www.aliyun.com/product/oss

func (OSSStore) AsConcatableUpload

func (store OSSStore) AsConcatableUpload(upload handler.Upload) handler.ConcatableUpload

func (OSSStore) AsLengthDeclarableUpload

func (store OSSStore) AsLengthDeclarableUpload(upload handler.Upload) handler.LengthDeclarableUpload

func (OSSStore) AsTerminatableUpload

func (store OSSStore) AsTerminatableUpload(upload handler.Upload) handler.TerminatableUpload

func (OSSStore) GetUpload

func (store OSSStore) GetUpload(ctx context.Context, id string) (handler.Upload, error)

func (OSSStore) NewUpload

func (store OSSStore) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error)

func (OSSStore) UseIn

func (store OSSStore) UseIn(composer *handler.StoreComposer)

Jump to

Keyboard shortcuts

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