object

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BosName = "bos"
)
View Source
const S3Name = "s3"

Variables

This section is empty.

Functions

func StsSessionToken

func StsSessionToken(ak string, sk string, duration int, acl string) (*sts_api.GetSessionTokenResult, error)

Types

type Bos

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

func NewBosClient

func NewBosClient(bucket string, bos *bos.Client) Bos

func (Bos) AbortUpload

func (storage Bos) AbortUpload(key string, uploadID string) error

func (Bos) CompleteUpload

func (storage Bos) CompleteUpload(key string, uploadID string, parts []*Part) error

func (Bos) Copy

func (storage Bos) Copy(newKey, copySource string) error

func (Bos) CreateMultipartUpload

func (storage Bos) CreateMultipartUpload(key string) (*MultipartCommitOutPut, error)

func (Bos) Deletes

func (storage Bos) Deletes(keys []string) error

func (Bos) Get

func (storage Bos) Get(key string, off, limit int64) (io.ReadCloser, error)

func (Bos) Head

func (storage Bos) Head(key string) (*HeadObjectOutput, error)

func (Bos) List

func (storage Bos) List(input *ListInput) (*ListBlobsOutput, error)

func (Bos) Put

func (storage Bos) Put(key string, in io.Reader) error

func (Bos) String

func (storage Bos) String() string

func (Bos) UploadPart

func (storage Bos) UploadPart(key string, uploadID string, num int64, body []byte) (*Part, error)

type HeadObjectOutput

type HeadObjectOutput struct {
	ItemOutput

	ContentType string
	Metadata    map[string]*string
	IsDir       bool
}

type ItemOutput

type ItemOutput struct {
	Key          string
	ETag         string
	LastModified time.Time
	Size         uint64
	StorageClass string
}

type ListBlobsOutput

type ListBlobsOutput struct {
	Prefixes              []PrefixOutput
	Items                 []ItemOutput
	NextContinuationToken string
	IsTruncated           bool

	RequestId string
}

type ListInput

type ListInput struct {
	Prefix            string
	Delimiter         string
	MaxKeys           int64
	ContinuationToken string
}

type MultipartCommitOutPut

type MultipartCommitOutPut struct {
	Key string

	Metadata map[string]string
	UploadId string
	Parts    []*string
	NumParts uint32
}

type ObjectStorage

type ObjectStorage interface {
	// Description of the object storage.
	String() string
	// Get the data for the given object specified by key.
	Get(key string, off, limit int64) (io.ReadCloser, error)
	// Put data read from a reader to an object specified by key.
	Put(key string, in io.Reader) error
	// Delete a object.
	Deletes(key []string) error
	// Copy Object
	Copy(key, copySource string) error

	// Head returns some information about the object or an error if not found.
	Head(key string) (*HeadObjectOutput, error)
	// List returns a list of objects.
	List(input *ListInput) (*ListBlobsOutput, error)
	// CreateMultipartUpload starts to upload a large object part by part.
	CreateMultipartUpload(key string) (*MultipartCommitOutPut, error)
	// UploadPart upload a part of an object.
	UploadPart(key string, uploadID string, num int64, body []byte) (*Part, error)
	// AbortUpload abort a multipart upload.
	AbortUpload(key string, uploadID string) error
	// CompleteUpload finish an multipart upload.
	CompleteUpload(key string, uploadID string, parts []*Part) error
}

ObjectStorage is the interface for object storage. all of these API should be idempotent.

type Part

type Part struct {
	Num  int64
	Size int
	ETag string
}

type PendingPart

type PendingPart struct {
	Key      string
	UploadID string
	Created  time.Time
}

type PrefixOutput

type PrefixOutput struct {
	Prefix string
}

type S3Storage

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

func NewS3Storage

func NewS3Storage(bucket string, s3 *s3.S3) S3Storage

func (S3Storage) AbortUpload

func (storage S3Storage) AbortUpload(key string, uploadID string) error

func (S3Storage) CompleteUpload

func (storage S3Storage) CompleteUpload(key string, uploadID string, parts []*Part) error

func (S3Storage) Copy

func (storage S3Storage) Copy(newKey, copySource string) error

func (S3Storage) CreateMultipartUpload

func (storage S3Storage) CreateMultipartUpload(key string) (*MultipartCommitOutPut, error)

func (S3Storage) Deletes

func (storage S3Storage) Deletes(keys []string) error

func (S3Storage) Get

func (storage S3Storage) Get(key string, off, limit int64) (io.ReadCloser, error)

func (S3Storage) Head

func (storage S3Storage) Head(key string) (*HeadObjectOutput, error)

func (S3Storage) List

func (storage S3Storage) List(input *ListInput) (*ListBlobsOutput, error)

func (S3Storage) Put

func (storage S3Storage) Put(key string, in io.Reader) error

func (S3Storage) String

func (storage S3Storage) String() string

func (S3Storage) UploadPart

func (storage S3Storage) UploadPart(key string, uploadID string, num int64, body []byte) (*Part, error)

Jump to

Keyboard shortcuts

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