s3

package module
v0.0.0-...-50c133a Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2020 License: MPL-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Persist

type Persist struct {
	EndpointURL string
	BucketName  string
	Prefix      string
	// contains filtered or unexported fields
}

Persist implements the mast.Persist interface for storing and loading nodes from files.

func NewPersist

func NewPersist(client S3Interface, endpointURL, bucketName, prefix string) Persist

NewPersist returns a Persist that loads and stores nodes as objects with the given S3 client and bucket name.

func (*Persist) Load

func (p *Persist) Load(ctx context.Context, name string) ([]byte, error)

Load loads the bytes persisted in the named object.

func (Persist) NodeURLPrefix

func (p Persist) NodeURLPrefix() string

func (Persist) Store

func (p Persist) Store(ctx context.Context, name string, b []byte) error

Store persists the given bytes in a file of the given name, if it doesn't exist already.

type S3Interface

type S3Interface interface {
	DeleteObjectWithContext(ctx aws.Context, input *s3.DeleteObjectInput, opts ...request.Option) (*s3.DeleteObjectOutput, error)
	GetObjectWithContext(ctx aws.Context, input *s3.GetObjectInput, opts ...request.Option) (*s3.GetObjectOutput, error)
	PutObjectWithContext(ctx aws.Context, input *s3.PutObjectInput, opts ...request.Option) (*s3.PutObjectOutput, error)
}

Jump to

Keyboard shortcuts

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