Documentation
¶
Index ¶
- type Client
- func (c *Client) DeleteFile(ctx context.Context, key string) error
- func (c *Client) DownloadFile(ctx context.Context, key string) ([]byte, error)
- func (c *Client) DownloadFileTo(ctx context.Context, key string, w io.Writer) (int64, error)
- func (c *Client) FileExists(ctx context.Context, key string) (bool, error)
- func (c *Client) GetBucketPath() string
- func (c *Client) RelativeKey(fullKey string) string
- func (c *Client) UploadFile(ctx context.Context, key string, content io.Reader) error
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 ¶
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) DownloadFile ¶
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 ¶
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 (*Client) GetBucketPath ¶
func (*Client) RelativeKey ¶
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.