storage

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = storage.ErrAlreadyExists

ErrAlreadyExists is a ptr to underlying storage.ErrAlreadyExists, to put the related errors in the same package as our storage wrapper.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	// Underlying storage
	*kv.KVStore
	Storage storage.Storage

	// S3-only parameters
	Proxy          bool
	Bucket         string
	PresignedCache *ttl.Cache[string, PresignedURL]
}

Driver wraps a kv.KVStore to also provide S3 presigned GET URLs.

func AutoConfig

func AutoConfig() (*Driver, error)

func NewFileStorage added in v0.6.0

func NewFileStorage() (*Driver, error)

func NewS3Storage added in v0.6.0

func NewS3Storage() (*Driver, error)

func (*Driver) URL

func (d *Driver) URL(ctx context.Context, key string) *PresignedURL

URL will return a presigned GET object URL, but only if running on S3 storage with proxying disabled.

type PresignedURL added in v0.7.0

type PresignedURL struct {
	*url.URL
	Expiry time.Time // link expires at this time
}

PresignedURL represents a pre signed S3 URL with an expiry time.

Jump to

Keyboard shortcuts

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