bucket

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultPartSize = 128 << 20

DefaultPartSize is the default part size used for Bucket.Put method.

Variables

This section is empty.

Functions

func WithCredentials

func WithCredentials(cred aws.CredentialsProvider) func(*s3.Options)

WithCredentials specifies a credential provider.

func WithEndpointURL

func WithEndpointURL(u string) func(*s3.Options)

WithEndpointURL specifies the endpoint of S3 API.

func WithHTTPClient

func WithHTTPClient(c *http.Client) func(*s3.Options)

WithHTTPClient specifies the http.Client to be used.

func WithPathStyle

func WithPathStyle() func(*s3.Options)

WithPathStyle specifies to use the path-style API request.

func WithRegion

func WithRegion(region string) func(*s3.Options)

WithRegion specifies the region of the bucket.

Types

type Bucket

type Bucket interface {
	// Put puts an object with `key`.  The data is read from `data`.
	Put(ctx context.Context, key string, data io.Reader) error

	// Get gets an object by `key`.
	Get(ctx context.Context, key string) (io.ReadCloser, error)

	// List lists the matching object keys that have `prefix`.
	List(ctx context.Context, prefix string) ([]string, error)
}

Bucket represents the interface to access an object storage bucket.

func NewS3Bucket

func NewS3Bucket(name string, partSize int64, optFns ...func(*s3.Options)) (Bucket, error)

NewS3Bucket creates a Bucket that manage object in S3. PartSize is used to put objects with the upload manager. If the size is less than the minimum (5 MiB), DefaultPartSize will be used.

Jump to

Keyboard shortcuts

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