Documentation ¶
Index ¶
- Constants
- Variables
- func CopyBucket(srcBucketName, dstBucketName string, srcS3Client *s3.S3, dstS3Client *s3.S3, ...) (srcError, dstError error)
- func DeleteObject(bucket *s3.Bucket, object string) error
- func GetHTTPStatusCodeFromError(err error) int
- func GetS3Client(s3Auth *MigrationAuth) *s3.S3
- type CompletePart
- type MigrationAuth
- type MigrationTaskData
- type MigrationTaskResult
- type MultipartUploader
- func (uploader *MultipartUploader) Complete() error
- func (uploader *MultipartUploader) Init(contType string, perm goamzS3.ACL, options goamzS3.Options) error
- func (uploader *MultipartUploader) ListParts() error
- func (uploader *MultipartUploader) URL() (*url.URL, error)
- func (uploader *MultipartUploader) UnmarshalResp(resp *http.Response, value interface{}) error
- func (uploader *MultipartUploader) UploadPart(n int, r io.ReadSeeker) (CompletePart, error)
- func (uploader *MultipartUploader) UploadParts(size int64) error
- type Part
- type TaskMigrator
- type TextErr
Constants ¶
const ( // ErrMsgNotFound issued if object does not exist ErrMsgNotFound = "404 Not Found" // AmzMetadataPrefix is constant for s3 specific header prefix AmzMetadataPrefix = "x-amz-meta-" )
Variables ¶
var ( // ErrZeroContentLenthValue is the error returned when object in SRC has no content ErrZeroContentLenthValue = TextErr{errors.New("Content has zero length or hasn't size header")} // ErrContentLengthMaxValue is the error returned when object in SRC has no content ErrContentLengthMaxValue = TextErr{errors.New("Object size is to big")} // ErrEmptyContentType is the error returned when object hasn't Content-Type header ErrEmptyContentType = TextErr{errors.New("No Content-Type header")} // ErrDatabaseIntegrity is the error returned for all abnormal database cases ErrDatabaseIntegrity = TextErr{errors.New("Database integrity error")} )
Functions ¶
func CopyBucket ¶
func CopyBucket(srcBucketName, dstBucketName string, srcS3Client *s3.S3, dstS3Client *s3.S3, shouldUseSrcBucketACL bool) (srcError, dstError error)
CopyBucket creates copy of source bucket on destination cluster
func DeleteObject ¶
DeleteObject deletes object from cluster
func GetHTTPStatusCodeFromError ¶
GetHTTPStatusCodeFromError extracts http code from s3.Error value
func GetS3Client ¶
func GetS3Client(s3Auth *MigrationAuth) *s3.S3
GetS3Client returns s3 client for given MigrationAuth
Types ¶
type CompletePart ¶
type MigrationAuth ¶
MigrationAuth keeps auth data
type MigrationTaskData ¶
type MigrationTaskData struct {
// contains filtered or unexported fields
}
MigrationTaskData validates and extracts object location data
func NewMigrationTaskData ¶
func NewMigrationTaskData(action string, aclMode model.ACLMode, hostFrom, hostTo string, srcBucket, srcKey, dstBucket, dstKey string) MigrationTaskData
NewMigrationTaskData constructs an instance of MigrationTaskData
type MigrationTaskResult ¶
type MigrationTaskResult struct { Tid uint64 Pid uint64 ErrorType model.ErrorType Error error NowToCreatedAtDiff int64 Retryable bool Success bool IsPermanent bool }
MigrationTaskResult keeps track on migration task
func NewMigrationTaskResult ¶
func NewMigrationTaskResult(task model.MigrationTaskItem) MigrationTaskResult
NewMigrationTaskResult creates MigrationTaskResult
func (*MigrationTaskResult) ApplyDefaultErrorStrategy ¶
func (mtr *MigrationTaskResult) ApplyDefaultErrorStrategy(errType model.ErrorType, err error)
ApplyDefaultErrorStrategy prepares states for MigrationTaskResult and calls MarkRetry for error
type MultipartUploader ¶
type MultipartUploader struct {
Bucket, Key, AccessKey, SecretKey, HostPort string
PartSize int64
ObjectBody io.Reader
UploadId string
// contains filtered or unexported fields
}
func (*MultipartUploader) Complete ¶
func (uploader *MultipartUploader) Complete() error
func (*MultipartUploader) ListParts ¶
func (uploader *MultipartUploader) ListParts() error
func (*MultipartUploader) UnmarshalResp ¶
func (uploader *MultipartUploader) UnmarshalResp(resp *http.Response, value interface{}) error
func (*MultipartUploader) UploadPart ¶
func (uploader *MultipartUploader) UploadPart(n int, r io.ReadSeeker) (CompletePart, error)
func (*MultipartUploader) UploadParts ¶
func (uploader *MultipartUploader) UploadParts(size int64) error
type TaskMigrator ¶
type TaskMigrator struct { Task MigrationTaskData SrcS3Client, DstS3Client *s3.S3 Multipart bool // contains filtered or unexported fields }
TaskMigrator encapsulates all necessary routines to execute task
func (*TaskMigrator) Run ¶
func (migrator *TaskMigrator) Run() (srcError, dstError error)
Run performs task migration actions
type TextErr ¶
type TextErr struct {
Err error
}
TextErr is an error that also implements the TextMarshaller interface for serializing out to various plain text encodings. Packages creating their own custom errors should use TextErr if they're intending to use serializing formats like json, msgpack etc.
func (TextErr) MarshalText ¶
MarshalText implements the TextMarshaller