storage

package
v0.0.0-...-dfdb652 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileNotFound  = xerrors.New("file not found")
	ErrFileCorrupted = xerrors.New("file corrupted")
	ErrFileExpired   = xerrors.New("file expired")
)

Functions

This section is empty.

Types

type Meta

type Meta struct {
	// URL of target site
	URL *url.URL

	// Hash of options
	Opts string

	// Format of file
	Format internal.ImageFormat
}

Meta contains metadata about screenshot

type S3

type S3 struct {
	// contains filtered or unexported fields
}

func NewS3

func NewS3(s *session.Session, bucket string, subdir string) *S3

func (*S3) Get

func (s *S3) Get(ctx context.Context, in Meta) (io.Reader, error)

func (*S3) Upload

func (s *S3) Upload(ctx context.Context, in Upload) error

type Storage

type Storage interface {
	// Get returns URL of file in storage if it exists
	Get(ctx context.Context, meta Meta) (io.Reader, error)

	// Put image to storage
	Upload(ctx context.Context, upload Upload) error
}

type Upload

type Upload struct {
	Meta
	TTL  time.Duration
	Body io.Reader
}

Upload define object to upload to s3.

Jump to

Keyboard shortcuts

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