contents

package
v0.0.0-...-042a1d3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filesystem

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

Filesystem saves/reads content to/from filesystem.

func NewFilesystem

func NewFilesystem(dir string) *Filesystem

NewFilesystem returns new Filesystem instance. Empty dir defaulted to os.TempDir().

func (*Filesystem) FindContent

func (fs *Filesystem) FindContent(_ context.Context, key string) ([]byte, error)

FindContent reads the file and returns the contents.

func (*Filesystem) SaveContent

func (fs *Filesystem) SaveContent(ctx context.Context, key string, content []byte) error

SaveContent writes content to the file.

type S3

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

S3 uploads/downloads content to S3 bucket.

func NewS3

func NewS3(ctx context.Context) *S3

NewS3 returns new S3 instance. Uses config.LoadDefaultConfig to initialize s3 client.

func (*S3) FindContent

func (st *S3) FindContent(ctx context.Context, key string) ([]byte, error)

FindContent reads object from bucket and returns its content.

func (*S3) SaveContent

func (st *S3) SaveContent(ctx context.Context, key string, content []byte) error

SaveContent creates object with the given content with 1 week expiration time.

Jump to

Keyboard shortcuts

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