Documentation
¶
Index ¶
- Variables
- func DoUpload(ctx context.Context, client request.HTTPDoer, urlStr string, body io.Reader, ...) (string, error)
- func GenericDownload(ctx context.Context, client request.HTTPDoer, signedURL string, ...) (*http.Response, error)
- func NonRetryable(err error) error
- func RetryAction(ctx context.Context, logger TransferLogger, strategy RetryStrategy, ...) error
- type ExponentialBackoff
- type MultipartBackend
- type MultipartPart
- type MultipartPartURL
- type MultipartPartURLBackend
- type MultipartPartURLBatch
- type NoOpLogger
- type ObjectMetadata
- type ReadBackend
- type RetryStrategy
- type TransferLogger
- type TransferRequest
Constants ¶
This section is empty.
Variables ¶
var ErrRangeIgnored = fmt.Errorf("server ignored range request and returned full body")
Functions ¶
func DoUpload ¶
func DoUpload(ctx context.Context, client request.HTTPDoer, urlStr string, body io.Reader, size int64) (string, error)
DoUpload performs a presigned PUT request and returns ETag when available.
func GenericDownload ¶
func GenericDownload(ctx context.Context, client request.HTTPDoer, signedURL string, rangeStart, rangeEnd *int64) (*http.Response, error)
GenericDownload performs GET (optionally ranged) against a signed URL.
func NonRetryable ¶ added in v0.2.8
func RetryAction ¶
func RetryAction(ctx context.Context, logger TransferLogger, strategy RetryStrategy, maxRetries int, action func() error) error
RetryAction is a helper that executes an action with retries according to a strategy.
Types ¶
type ExponentialBackoff ¶
type ExponentialBackoff struct {
MaxWaitSeconds int64
}
ExponentialBackoff implements a standard exponential backoff.
type MultipartBackend ¶ added in v0.2.7
type MultipartBackend interface {
Logger() TransferLogger
Upload(ctx context.Context, guid string, body io.Reader, size int64) error
MultipartInit(ctx context.Context, guid string) (string, error)
MultipartPart(ctx context.Context, guid string, uploadID string, partNum int, body io.Reader) (string, error)
MultipartComplete(ctx context.Context, guid string, uploadID string, parts []MultipartPart) error
}
type MultipartPart ¶
type MultipartPartURL ¶ added in v0.3.10
type MultipartPartURLBackend ¶ added in v0.3.10
type MultipartPartURLBatch ¶ added in v0.3.10
type MultipartPartURLBatch struct {
Parts []MultipartPartURL
BatchSupported bool
}
type NoOpLogger ¶
type NoOpLogger struct{}
NoOpLogger satisfies TransferLogger without emitting output.
func (NoOpLogger) Error ¶
func (NoOpLogger) Error(string, ...any)
func (NoOpLogger) Printf ¶
func (NoOpLogger) Printf(string, ...any)
type ObjectMetadata ¶
type ObjectMetadata struct {
Size int64
// SizeKnown marks Size as authoritative when it is zero. Positive sizes are
// treated as known for compatibility with existing callers.
SizeKnown bool
AcceptRanges bool
Provider string
Identity string
}
ObjectMetadata carries provider-agnostic information about a storage target.
type ReadBackend ¶ added in v0.2.7
type ReadBackend interface {
Logger() TransferLogger
Stat(ctx context.Context, guid string) (*ObjectMetadata, error)
GetReader(ctx context.Context, guid string) (io.ReadCloser, error)
GetRangeReader(ctx context.Context, guid string, offset, length int64) (io.ReadCloser, error)
}
ReadBackend provides metadata, single-stream reads, and ranged reads.
type RetryStrategy ¶
RetryStrategy defines how to wait between retries.
func DefaultBackoff ¶
func DefaultBackoff() RetryStrategy
DefaultBackoff returns the standard syfon backoff strategy.
type TransferLogger ¶
type TransferRequest ¶
type TransferRequest struct {
SourcePath string
ObjectKey string
GUID string
Bucket string
Metadata common.FileMetadata
ForceMultipart bool
}
TransferRequest represents a request to move a single file.