aliyunstore

package
v2.0.0-rc9 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliyunAPI

type AliyunAPI interface {
	PutObject(objectKey string, reader io.Reader, options ...oss.Option) error
	ListUploadedParts(imur oss.InitiateMultipartUploadResult, options ...oss.Option) (oss.ListUploadedPartsResult, error)
	UploadPart(imur oss.InitiateMultipartUploadResult, reader io.Reader, partSize int64, partNumber int, options ...oss.Option) (oss.UploadPart, error)
	GetObject(objectKey string, options ...oss.Option) (io.ReadCloser, error)
	GetObjectMeta(objectKey string, options ...oss.Option) (http.Header, error)
	InitiateMultipartUpload(objectKey string, options ...oss.Option) (oss.InitiateMultipartUploadResult, error)
	AbortMultipartUpload(imur oss.InitiateMultipartUploadResult, options ...oss.Option) error
	DeleteObject(objectKey string, options ...oss.Option) error
	DeleteObjects(objectKeys []string, options ...oss.Option) (oss.DeleteObjectsResult, error)
	CompleteMultipartUpload(imur oss.InitiateMultipartUploadResult, parts []oss.UploadPart, options ...oss.Option) (oss.CompleteMultipartUploadResult, error)
	UploadPartCopy(imur oss.InitiateMultipartUploadResult, srcBucketName, srcObjectKey string, startPosition, partSize int64, partNumber int, options ...oss.Option) (oss.UploadPart, error)
}

type AliyunStore

type AliyunStore struct {
	// cdn
	CDN string
	// Bucket used to store the data in, e.g. "tusdstore.example.com"
	Bucket string
	// ObjectPrefix is prepended to the name of each Aliyun object that is created
	// to store uploaded files. It can be used to create a pseudo-directory
	// structure in the bucket, e.g. "path/to/my/uploads".
	ObjectPrefixFormat string
	// ObjectPrefix is prepended to the name of each Aliyun object that is created
	// to store uploaded files. It can be used to create a pseudo-directory
	// structure in the bucket, e.g. "path/to/my/uploads".
	ObjectPrefix string
	// MetadataObjectPrefix is prepended to the name of each .info and .part Aliyun
	// object that is created. If it is not set, then ObjectPrefix is used.
	MetadataObjectPrefix string
	// Service specifies an interface used to communicate with the Aliyun backend.
	Service AliyunAPI
	// MaxPartSize specifies the maximum size of a single part uploaded to Aliyun
	// in bytes. This value must be bigger than MinPartSize! In order to
	// choose the correct number, two things have to be kept in mind:
	//
	// If this value is too big and uploading the part to Aliyun is interrupted
	// expectedly, the entire part is discarded and the end user is required
	// to resume the upload and re-upload the entire big part. In addition, the
	// entire part must be written to disk before submitting to Aliyun.
	//
	// If this value is too low, a lot of requests to Aliyun may be made, depending
	// on how fast data is coming in. This may result in an eventual overhead.
	MaxPartSize int64
	// MinPartSize specifies the minimum size of a single part uploaded to Aliyun
	// in bytes. This number needs to match with the underlying Aliyun backend or else
	// uploaded parts will be reject. Aliyun, for example, uses 5MB for this value.
	MinPartSize int64
	// PreferredPartSize specifies the preferred size of a single part uploaded to
	// Aliyun. AliyunStore will attempt to slice the incoming data into parts with this
	// size whenever possible. In some cases, smaller parts are necessary, so
	// not every part may reach this value. The PreferredPartSize must be inside the
	// range of MinPartSize to MaxPartSize.
	PreferredPartSize int64
	// MaxMultipartParts is the maximum number of parts an Aliyun multipart upload is
	// allowed to have according to AWS Aliyun API specifications.
	MaxMultipartParts int64
	// MaxObjectSize is the maximum size an Aliyun Object can have according to Aliyun
	// API specifications. See link above.
	MaxObjectSize int64
	// MaxBufferedParts is the number of additional parts that can be received from
	// the client and stored on disk while a part is being uploaded to Aliyun. This
	// can help improve throughput by not blocking the client while tusd is
	// communicating with the Aliyun API, which can have unpredictable latency.
	MaxBufferedParts int64
	// TemporaryDirectory is the path where AliyunStore will create temporary files
	// on disk during the upload. An empty string ("", the default value) will
	// cause AliyunStore to use the operating system's default temporary directory.
	TemporaryDirectory string
	// DisableContentHashes instructs the AliyunStore to not calculate the MD5 and SHA256
	// hashes when uploading data to Aliyun. These hashes are used for file integrity checks
	// and for authentication. However, these hashes also consume a significant amount of
	// CPU, so it might be desirable to disable them.
	// Note that this property is experimental and might be removed in the future!
	DisableContentHashes bool
}

func New

func New(bucket string, service AliyunAPI) AliyunStore

func (AliyunStore) AsConcatableUpload

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

func (AliyunStore) AsLengthDeclarableUpload

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

func (AliyunStore) AsTerminatableUpload

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

func (AliyunStore) GetUpload

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

func (AliyunStore) NewUpload

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

func (AliyunStore) UseIn

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

Jump to

Keyboard shortcuts

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