storage

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
}

type S3Backend

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

S3Backend represents a backend that stores and retrieves files from Amazon S3.

func (*S3Backend) Delete

func (b *S3Backend) Delete(key string) error

Delete deletes a file from S3 with the specified key.

func (*S3Backend) Initialize

func (b *S3Backend) Initialize(cfg Config, encryptionBackend encryption.EncryptionBackend) error

Initialize initializes the S3 backend with the configuration and encryption backend.

func (*S3Backend) Retrieve

func (b *S3Backend) Retrieve(key string) ([]byte, error)

Retrieve retrieves a file from S3 with the specified key and returns its decrypted data.

func (*S3Backend) Store

func (b *S3Backend) Store(key string, data []byte) error

Store stores a file in S3 with the specified key and encrypted data.

type S3Config

type S3Config struct {
	StorageClass string
	Prepend      string
	Bucket       string
	Config       *aws.Config
}

S3Config represents the configuration for the S3 backend.

type StorageBackend

type StorageBackend interface {
	// Initialize the backend with any necessary configuration.
	Initialize(config Config, encryptionBackend encryption.EncryptionBackend) error

	// Store a file with the specified key and encrypted data.
	Store(key string, data []byte) error

	// Retrieve a file with the specified key and return its decrypted data.
	Retrieve(key string) ([]byte, error)

	// Delete a file with the specified key.
	Delete(key string) error
}

func NewS3Backend

func NewS3Backend(config *S3Config, encryptionBackend encryption.EncryptionBackend) (StorageBackend, error)

NewS3Backend creates a new instance of the S3Backend.

Jump to

Keyboard shortcuts

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