storage

package
v1.7.8-0...-a935b97 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockObjectStorage

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

MockObjectStorage will implement ObjectStorage interface.

func NewMockObjectStorage

func NewMockObjectStorage() *MockObjectStorage

NewMockObjectStorage will create a new mock object storage.

func (*MockObjectStorage) CompleteMultipartUpload

func (m *MockObjectStorage) CompleteMultipartUpload(objectKey, uploadID string, totalNumber int) (err error)

CompleteMultipartUpload implements ObjectStorage.CompleteMultipartUpload

func (*MockObjectStorage) DeleteObject

func (m *MockObjectStorage) DeleteObject(objectKey string) (err error)

DeleteObject implements ObjectStorage.DeleteObject

func (*MockObjectStorage) GetObject

func (m *MockObjectStorage) GetObject(objectKey string) (r io.Reader, err error)

GetObject implements ObjectStorage.GetObject

func (*MockObjectStorage) HeadObject

func (m *MockObjectStorage) HeadObject(objectKey string) (om *ObjectMeta, err error)

HeadObject implements ObjectStorage.HeadObject

func (*MockObjectStorage) InitiateMultipartUpload

func (m *MockObjectStorage) InitiateMultipartUpload(objectKey string) (uploadID string, err error)

InitiateMultipartUpload implements ObjectStorage.InitiateMultipartUpload

func (*MockObjectStorage) PutBucket

func (m *MockObjectStorage) PutBucket() error

PutBucket implements ObjectStorage.PutBucket

func (*MockObjectStorage) SetupBucket

func (m *MockObjectStorage) SetupBucket(bucketName, zone string) error

SetupBucket implements ObjectStorage.SetupBucket

func (*MockObjectStorage) UploadMultipart

func (m *MockObjectStorage) UploadMultipart(objectKey, uploadID string, size int64, partNumber int, md5sum []byte, r io.Reader) (err error)

UploadMultipart implements ObjectStorage.UploadMultipart

type ObjectMeta

type ObjectMeta struct {
	Key string

	ContentLength int64
	ContentType   string
	ETag          string
	LastModified  time.Time
	StorageClass  string
}

ObjectMeta is the metadata for an object.

type ObjectStorage

type ObjectStorage interface {
	SetupBucket(name, zone string) (err error)
	PutBucket() error

	DeleteObject(objectKey string) (err error)
	HeadObject(objectKey string) (om *ObjectMeta, err error)
	GetObject(objectKey string) (r io.Reader, err error)

	InitiateMultipartUpload(objectKey string) (uploadID string, err error)
	UploadMultipart(objectKey, uploadID string, size int64, partNumber int, md5sum []byte, r io.Reader) (err error)
	CompleteMultipartUpload(objectKey, uploadID string, totalNumber int) (err error)
}

ObjectStorage is the interface to communicate with object storage service.

type QingStorObjectStorage

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

QingStorObjectStorage will implement ObjectStorage interface.

func NewQingStorObjectStorage

func NewQingStorObjectStorage() (q *QingStorObjectStorage, err error)

NewQingStorObjectStorage will create a new qingstor object storage.

func (*QingStorObjectStorage) CompleteMultipartUpload

func (q *QingStorObjectStorage) CompleteMultipartUpload(objectKey, uploadID string, totalNumber int) (err error)

CompleteMultipartUpload will complete a multipart upload.

func (*QingStorObjectStorage) DeleteObject

func (q *QingStorObjectStorage) DeleteObject(objectKey string) (err error)

DeleteObject will delete an object with specific key.

func (*QingStorObjectStorage) GetObject

func (q *QingStorObjectStorage) GetObject(objectKey string) (r io.Reader, err error)

GetObject will get an object.

func (*QingStorObjectStorage) HeadObject

func (q *QingStorObjectStorage) HeadObject(objectKey string) (om *ObjectMeta, err error)

HeadObject will head object.

func (*QingStorObjectStorage) InitiateMultipartUpload

func (q *QingStorObjectStorage) InitiateMultipartUpload(objectKey string) (uploadID string, err error)

InitiateMultipartUpload will initiate a multipart upload.

func (*QingStorObjectStorage) PutBucket

func (q *QingStorObjectStorage) PutBucket() error

PutBucket will make a bucket with specific name.

func (*QingStorObjectStorage) SetupBucket

func (q *QingStorObjectStorage) SetupBucket(name, zone string) (err error)

SetupBucket implements ObjectStorage.SetupBucket

func (*QingStorObjectStorage) UploadMultipart

func (q *QingStorObjectStorage) UploadMultipart(
	objectKey, uploadID string, size int64, partNumber int, md5sum []byte, r io.Reader,
) (err error)

UploadMultipart will upload a multipart.

Jump to

Keyboard shortcuts

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