s3

package
v0.0.0-...-0f4c570 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package s3 implements an S3-backed repository. Objects are stored within a prefix in a bucket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(u *url.URL) (reflow.Repository, error)

Dial dials an s3 repository. The URL must have the form:

s3r://bucket/prefix

TODO(marius): we should support shipping authentication information in the URL also.

func SetClient

func SetClient(client s3iface.S3API)

SetClient sets the default s3 client to use for dialling repositories. If non-nil, it is used when there is not a more specific per-bucket client.

Types

type Repository

type Repository struct {
	Client s3iface.S3API
	Bucket string
	Prefix string
}

Repository implements an S3-backed Repository. Objects are stored in the given bucket under the given prefix, followed by "objects":

s3://bucket/<prefix>/objects/sha256:<hex>...

In-progress uploads are stored under "uploads":

s3://bucket/<prefix>/uploads/<hex>

func (*Repository) Collect

func (r *Repository) Collect(ctx context.Context, live reflow.Liveset) error

Collect is not supported on S3.

func (*Repository) Get

Get retrieves an object from the repository.

func (*Repository) GetFile

func (r *Repository) GetFile(ctx context.Context, id digest.Digest, w io.WriterAt) (int64, error)

GetFile retrieves an object from the repository directly to the a io.WriterAt. This uses the S3 download manager to download chunks concurrently.

func (*Repository) Put

func (r *Repository) Put(ctx context.Context, body io.Reader) (digest.Digest, error)

Put installs an object into the repository; its digest ID is returned.

func (*Repository) PutFile

func (r *Repository) PutFile(ctx context.Context, file reflow.File, body io.Reader) error

PutFile installs a file into the repository. PutFile uses the S3 upload manager directly.

func (*Repository) ReadFrom

func (r *Repository) ReadFrom(_ context.Context, id digest.Digest, u *url.URL) error

ReadFrom is unsupported by the S3 repository.

TODO(marius): we can support other s3r here by performing CopyObjects.

func (*Repository) ShortString

func (r *Repository) ShortString() string

func (*Repository) Stat

func (r *Repository) Stat(ctx context.Context, id digest.Digest) (reflow.File, error)

Stat queries the repository for object metadata.

func (*Repository) String

func (r *Repository) String() string

String returns the repository URL.

func (*Repository) URL

func (r *Repository) URL() *url.URL

URL returns the URL for this repository. It is of the form:

s3r://bucket/prefix

func (*Repository) WriteTo

func (r *Repository) WriteTo(_ context.Context, id digest.Digest, u *url.URL) error

WriteTo is unsupported by the S3 repository.

TODO(marius): we can support other s3r here by performing CopyObjects.

Jump to

Keyboard shortcuts

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