s3

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
}

Client reads and writes objects in one bucket.

func Default

func Default(bucket string) (*Client, error)

Default builds a client with a 5 second timeout and 3 total attempts.

func New

func New(bucket string, timeout time.Duration, maxRetryAttempts int) (*Client, error)

New builds a client for bucket. timeout is the deadline for each call. maxRetryAttempts is passed to the SDK as MaxAttempts, which counts the first attempt.

func (*Client) Get

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

Get returns the object at key. A missing key wraps ErrNotFound. The caller closes Body. Closing it ends the Get deadline.

func (*Client) List

func (c *Client) List(ctx context.Context, prefix, continuationToken string) (*ListResult, error)

List returns one page of objects under prefix. An empty prefix lists the bucket. Pass the previous NextContinuationToken to read the next page. An empty page is success.

func (*Client) Put

func (c *Client) Put(ctx context.Context, key string, body io.Reader, contentType string) error

Put writes body to key, replacing any existing object. A seekable body lets the SDK set the content length.

type GetResult

type GetResult struct {
	Body         io.ReadCloser
	ContentType  string
	Size         int64
	LastModified time.Time
}

GetResult is the body and metadata for one key. The caller closes Body. The Get deadline stays in effect until Body is closed.

type ListResult

type ListResult struct {
	Objects               []ObjectInfo
	NextContinuationToken string
}

ListResult is one page of objects. NextContinuationToken is empty on the last page.

type ObjectInfo

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

ObjectInfo is one key returned by List.

Jump to

Keyboard shortcuts

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