bucket

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// PartSizeUnit is the unit of part size used for Bucket.Put method.
	PartSizeUnit = 128 << 20

	// UploadParts is the number of parts in a multi-part upload on Amazon S3.
	UploadParts = 4 << 10
)

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, objectSize int64) 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, optFns ...func(*s3.Options)) (Bucket, error)

NewS3Bucket creates a Bucket that manage object in S3.

Jump to

Keyboard shortcuts

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