s3Storage

package
v0.0.0-...-9e59589 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CHUNK_SIZE int = 15

basically all copied from: https://github.com/gabrielhora/s3md5

Variables

This section is empty.

Functions

func GetEtagFromFile

func GetEtagFromFile(fileName *string) string

TODO: normie md5 files

Types

type R2ConfigData

type R2ConfigData struct {
	Type            string `validate:"required,oneof='R2'"`
	BucketName      string `validate:"required"`
	Url             string `validate:"required"`
	AccountId       string `validate:"required"`
	AccessKeyId     string `validate:"required"`
	AccessKeySecret string `validate:"required"`
}

Currently only supports Cloudflare's R2

type S3Object

type S3Object struct {
	BucketName string
	Url        string
	// contains filtered or unexported fields
}

func ConfigS3

func ConfigS3(storageConfig *R2ConfigData) *S3Object

TODO: generalize this configuration to any S3 source

func (*S3Object) DeleteFile

func (s3Obj *S3Object) DeleteFile(bucketFilePath string) error

func (*S3Object) ListObjects

func (s3Obj *S3Object) ListObjects() []types.Object

func (*S3Object) UploadFile

func (s3Obj *S3Object) UploadFile(localFilePath string, bucketPath string) error

type S3Storage

type S3Storage interface {
	ListObjects() []types.Object
	UploadFile(localFilePath string, bucketPath string) error
	DeleteFile(bucketFilePath string) error
}

Jump to

Keyboard shortcuts

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