s3

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, settings *offsite.OffsiteSettings) (*Client, error)

NewClient builds the single S3 client used by every offsite code path (upload, download, delete, offsite test, cron cleanup). Settings must already be decrypted (GetActiveOffsiteSettingsDecrypted); the secret is empty in EC2 IAM-role mode.

func (*Client) DeleteFile

func (c *Client) DeleteFile(ctx context.Context, key string) error

func (*Client) DownloadFile

func (c *Client) DownloadFile(ctx context.Context, key string) ([]byte, error)

DownloadFile loads an object fully into memory. Only use for small objects (e.g. the offsite test file); stream backups with DownloadFileTo instead.

func (*Client) DownloadFileTo

func (c *Client) DownloadFileTo(ctx context.Context, key string, w io.Writer) (int64, error)

DownloadFileTo streams an object into w without buffering it in memory and returns the number of bytes written. When the response carries a ContentLength it is verified against the byte count.

func (*Client) FileExists

func (c *Client) FileExists(ctx context.Context, key string) (bool, error)

func (*Client) GetBucketPath

func (c *Client) GetBucketPath() string

func (*Client) RelativeKey

func (c *Client) RelativeKey(fullKey string) string

RelativeKey strips the configured bucket-path prefix from a key taken out of a stored s3://bucket/<key> location, yielding the key to pass to this client's methods (which re-add the prefix). Keys recorded under a different bucket path pass through unchanged.

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, key string, content io.Reader) error

Jump to

Keyboard shortcuts

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