storage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalS3Storage added in v0.3.0

func MarshalS3Storage(s3Storage *S3Storage) ([]byte, error)

Types

type BaseStorage

type BaseStorage struct {
	Name string      `json:"name" db:"name"`
	Type StorageType `json:"type" db:"type"`
	Data string      `json:"data" db:"data"`
}

type S3Storage

type S3Storage struct {
	Session    *session.Session `json:"-"`
	S3Client   s3iface.S3API    `json:"-"`
	Name       string           `json:"name"`
	Endpoint   string           `json:"endpoint"`
	Region     string           `json:"region"`
	AccessKey  string           `json:"access_key"`
	SecretKey  string           `json:"secret_key"`
	BucketName string           `json:"bucket_name"`
}

func NewS3StorageFromBase added in v0.3.0

func NewS3StorageFromBase(baseStorage BaseStorage) (*S3Storage, error)

func (*S3Storage) DecryptKeys

func (s *S3Storage) DecryptKeys() error

func (*S3Storage) DownloadDirectory

func (s *S3Storage) DownloadDirectory(remotePath, localPath string) error

func (*S3Storage) GetName added in v0.3.0

func (s *S3Storage) GetName() string

func (*S3Storage) GetType added in v0.3.0

func (s *S3Storage) GetType() StorageType

func (*S3Storage) InitializeS3Storage

func (s *S3Storage) InitializeS3Storage() error

func (*S3Storage) UploadDirectory

func (s *S3Storage) UploadDirectory(directoryPath string) error

UploadDirectory uploads the files in the specified directory (including subdirectories) to an S3 storage bucket. If a file already exists in the remote storage, it will be overwritten.

type Storage

type Storage interface {
	UploadDirectory(directoryPath string) error
	DownloadDirectory(remotePath, localPath string) error
	GetName() string
	GetType() StorageType
}

func CreateStorage added in v0.3.0

func CreateStorage(baseStorage BaseStorage) (Storage, error)

type StorageManager added in v0.3.0

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

func NewStorageManager added in v0.3.0

func NewStorageManager() *StorageManager

func (*StorageManager) AddStorage added in v0.3.0

func (sm *StorageManager) AddStorage(stor Storage)

func (*StorageManager) DeleteStorage added in v0.3.0

func (sm *StorageManager) DeleteStorage(name string)

func (*StorageManager) GetAllStorages added in v0.3.0

func (sm *StorageManager) GetAllStorages() []Storage

func (*StorageManager) GetStorage added in v0.3.0

func (sm *StorageManager) GetStorage(name string) Storage

type StorageType added in v0.3.0

type StorageType string
const S3StorageType StorageType = "s3"

Jump to

Keyboard shortcuts

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