s3interfaces

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteKeysError added in v0.19.0

type DeleteKeysError struct {
	Failed        []string
	Total         int
	RequestFailed bool
	Unplaced      bool
	Err           error
}

DeleteKeysError is the error DeleteKeys returns when keys are left.

  • Failed: the keys still in storage, input keys only, each once, in input order per batch.
  • Total: the distinct keys asked for.
  • RequestFailed: a whole request failed, or storage reported a transient error on a key (SlowDown, InternalError, ServiceUnavailable, RequestTimeout, OperationAborted, and MinIO/Garage's SlowDownRead, SlowDownWrite, XMinioServerNotInitialized) — storage failing, or the caller's ctx ending: a caller that cares checks its own ctx.
  • Unplaced: storage refused a key it did not name; that key's whole batch is in Failed (never under-reported), and only a key-by-key retry can place it.
  • Err: the first request failure, else the first refusal.

func (*DeleteKeysError) Error added in v0.19.0

func (e *DeleteKeysError) Error() string

func (*DeleteKeysError) Unwrap added in v0.19.0

func (e *DeleteKeysError) Unwrap() error

type ObjectInfo added in v0.18.0

type ObjectInfo struct {
	Key      string
	Size     int64
	Modified time.Time
}

ObjectInfo describes one stored object. Modified is zero when storage did not report it: treat that as unknown, never as old. Size is 0 when storage did not report it, so it is not proof of an empty object.

type S3ServiceInterface

type S3ServiceInterface interface {
	// ListObjects calls page with each page of the objects under prefix, which
	// must be non-empty and end with "/"; it stops at the first error page returns.
	ListObjects(ctx context.Context, prefix string, page func([]ObjectInfo) error) error
	GenerateUploadPayload(ctx context.Context, data []byte, s3Path, filename string, metadata map[string]string) (*s3.PutObjectInput, error)
	BulkUploadFiles(ctx context.Context, payloads []*s3.PutObjectInput) ([]string, error)
	// BulkDeleteFiles returns how many deletes failed.
	BulkDeleteFiles(ctx context.Context, uploadedKeys []string) int
	// DeleteKeys deletes every key (missing keys count as deleted); an error means some are left
	// and is a *DeleteKeysError naming them.
	DeleteKeys(ctx context.Context, keys []string) error
	// DeletePrefix deletes every object under prefix, which must end with "/".
	DeletePrefix(ctx context.Context, prefix string) error
	// GeneratePresignedURL generates a short-lived GET URL for a given S3 key.
	// s3Key is the full object key (path + filename already joined).
	GeneratePresignedURL(ctx context.Context, s3Key string, expiry time.Duration) (string, error)
}

S3ServiceInterface defines the interface for S3 operations

Jump to

Keyboard shortcuts

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