transfer

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 NonRetryable(err error) error

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.

func (*ExponentialBackoff) WaitTime

func (e *ExponentialBackoff) WaitTime(retryCount int) time.Duration

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 MultipartPart struct {
	PartNumber int32
	ETag       string
}

type MultipartPartURL added in v0.3.10

type MultipartPartURL struct {
	PartNumber int32
	URL        string
	ExpiresAt  time.Time
}

type MultipartPartURLBackend added in v0.3.10

type MultipartPartURLBackend interface {
	MultipartPartURLs(context.Context, string, string, []int32) (MultipartPartURLBatch, error)
	UploadPart(context.Context, string, io.Reader, int64) (string, error)
}

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

type RetryStrategy interface {
	WaitTime(retryCount int) time.Duration
}

RetryStrategy defines how to wait between retries.

func DefaultBackoff

func DefaultBackoff() RetryStrategy

DefaultBackoff returns the standard syfon backoff strategy.

type TransferLogger

type TransferLogger interface {
	Error(msg string, args ...any)
	Printf(format string, v ...any)
}

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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