storage

package module
v0.0.0-...-5b39d27 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOKEN       = ""
	XDT         = "XDT"
	S3          = "S3"
	ELASTICACHE = "ELASTICACHE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	AWS_ACCESS_KEY string
	AWS_SECRET_KEY string
	AWS_REGION     string
	// contains filtered or unexported fields
}

func New

func New(transferType string, bucketName string) Storage

New initialises the storage module. This function is used to provide information about which service to use. If s3 is used, "bucket" is the bucket used for storage, and in the case when elasticache is used "bucket" should be the redis URL and port. Note that one must be on an AWS VPC (e.g. using EC2) to access elasticache.

func (Storage) Get

func (s Storage) Get(ctx context.Context, key string) []byte

Get retrieves a payload corresponding to the provided key from the storage service. An error will occur if the key is not prescent on the service.

func (Storage) Put

func (s Storage) Put(ctx context.Context, key string, payloadData []byte) string

Put uploads the payload to the storage service using the provided key

func (Storage) PutFile

func (s Storage) PutFile(key string, file *os.File) string

PutFile uploads the payload to the storage service using the provided key

Jump to

Keyboard shortcuts

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