objectstore

package
v8.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotEnoughParts = errors.New("Not enough Parts")

ErrNotEnoughParts will be used when writing more than size * len(partURLs)

Functions

This section is empty.

Types

type CompleteMultipartUpload

type CompleteMultipartUpload struct {
	Part []*completeMultipartUploadPart
}

CompleteMultipartUpload is the S3 CompleteMultipartUpload body

func (*CompleteMultipartUpload) BuildMultipartUploadETag

func (cmu *CompleteMultipartUpload) BuildMultipartUploadETag() (string, error)

BuildMultipartUploadETag creates an S3 compatible ETag for MultipartUpload Given the MD5 hash for each uploaded part of the file, concatenate the hashes into a single binary string and calculate the MD5 hash of that result, the append "-len(etags)" http://permalink.gmane.org/gmane.comp.file-systems.s3.s3tools/583

type CompleteMultipartUploadError

type CompleteMultipartUploadError struct {
	XMLName xml.Name `xml:"Error"`
	Code    string
	Message string
}

CompleteMultipartUploadError is the in-body error structure https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadComplete.html#mpUploadComplete-examples the answer contains other fields we are not using

func (*CompleteMultipartUploadError) Error

type CompleteMultipartUploadResult

type CompleteMultipartUploadResult struct {
	Location string
	Bucket   string
	Key      string
	ETag     string
}

CompleteMultipartUploadResult is the S3 answer to CompleteMultipartUpload request

type Multipart

type Multipart struct {
	// CompleteURL is a presigned URL for CompleteMultipartUpload
	CompleteURL string
	// AbortURL is a presigned URL for AbortMultipartUpload
	AbortURL string
	// DeleteURL is a presigned URL for RemoveObject
	DeleteURL string
	// contains filtered or unexported fields
}

Multipart represents a MultipartUpload on a S3 compatible Object Store service. It can be used as io.WriteCloser for uploading an object

func NewMultipart

func NewMultipart(ctx context.Context, partURLs []string, completeURL, abortURL, deleteURL string, putHeaders map[string]string, deadline time.Time, partSize int64) (*Multipart, error)

NewMultipart provides Multipart pointer that can be used for uploading. Data written will be split buffered on disk up to size bytes then uploaded with S3 Upload Part. Once Multipart is Closed a final call to CompleteMultipartUpload will be sent. In case of any error a call to AbortMultipartUpload will be made to cleanup all the resources

func (*Multipart) Close

func (u *Multipart) Close() error

Close implements the standard io.Closer interface: it closes the http client request. This method will also wait for the connection to terminate and return any error occurred during the upload

func (*Multipart) ETag

func (u *Multipart) ETag() string

ETag returns the checksum of the uploaded object returned by the ObjectStorage provider via ETag Header. This method will wait until upload context is done before returning.

func (*Multipart) Write

func (u *Multipart) Write(p []byte) (int, error)

type Object

type Object struct {
	// PutURL is a presigned URL for PutObject
	PutURL string
	// DeleteURL is a presigned URL for RemoveObject
	DeleteURL string
	// contains filtered or unexported fields
}

Object represents an object on a S3 compatible Object Store service. It can be used as io.WriteCloser for uploading an object

func NewObject

func NewObject(ctx context.Context, putURL, deleteURL string, putHeaders map[string]string, deadline time.Time, size int64) (*Object, error)

NewObject opens an HTTP connection to Object Store and returns an Object pointer that can be used for uploading.

func (*Object) Close

func (u *Object) Close() error

Close implements the standard io.Closer interface: it closes the http client request. This method will also wait for the connection to terminate and return any error occurred during the upload

func (*Object) ETag

func (u *Object) ETag() string

ETag returns the checksum of the uploaded object returned by the ObjectStorage provider via ETag Header. This method will wait until upload context is done before returning.

func (*Object) Write

func (u *Object) Write(p []byte) (int, error)

type StatusCodeError

type StatusCodeError error

type Upload

type Upload interface {
	io.WriteCloser
	ETag() string
}

Upload represents an upload to an ObjectStorage provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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