storage

package
v0.0.0-...-9896d2c Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmazonS3Backend

type AmazonS3Backend struct {
	Bucket     string
	Client     *s3.S3
	Downloader *s3manager.Downloader
	Prefix     string
	Uploader   *s3manager.Uploader
}

AmazonS3Backend is a storage backend for Amazon S3

func NewAmazonS3Backend

func NewAmazonS3Backend(bucket string, prefix string, region string, endpoint string) *AmazonS3Backend

NewAmazonS3Backend creates a new instance of AmazonS3Backend

func (AmazonS3Backend) DeleteObject

func (b AmazonS3Backend) DeleteObject(path string) error

DeleteObject removes an object from Amazon S3 bucket, at prefix

func (AmazonS3Backend) GetObject

func (b AmazonS3Backend) GetObject(path string) (Object, error)

GetObject retrieves an object from Amazon S3 bucket, at prefix

func (AmazonS3Backend) ListObjects

func (b AmazonS3Backend) ListObjects() ([]Object, error)

ListObjects lists all objects in Amazon S3 bucket, at prefix

func (AmazonS3Backend) PutObject

func (b AmazonS3Backend) PutObject(path string, content []byte) error

PutObject uploads an object to Amazon S3 bucket, at prefix

type Backend

type Backend interface {
	ListObjects() ([]Object, error)
	GetObject(path string) (Object, error)
	PutObject(path string, connect []byte) error
	DeleteObject(path string) error
}

generic interface for storage backends

type FilesystemBackend

type FilesystemBackend struct {
	RootDirectory string
}

FilesystemBackend is a storage backend for local filesystem storage

func NewFilesystemBackend

func NewFilesystemBackend(rootDirectory string) *FilesystemBackend

NewLocalFilesystemBackend creates a new instance of LocalFilesystemBackend

func (FilesystemBackend) DeleteObject

func (fs FilesystemBackend) DeleteObject(path string) error

Delet removes an object from root directory

func (FilesystemBackend) GetObject

func (fs FilesystemBackend) GetObject(path string) (Object, error)

func (FilesystemBackend) ListObjects

func (fs FilesystemBackend) ListObjects() ([]Object, error)

Lists all objects in root directory only, without recursive

func (FilesystemBackend) PutObject

func (fs FilesystemBackend) PutObject(path string, content []byte) error

type Object

type Object struct {
	Path         string
	Artifact     []byte
	LastModified time.Time
}

type ObjectDiff

type ObjectDiff struct {
	Change  bool
	Removed []Object
	Added   []Object
	Updated []Object
}

Provides what has changed since the last time when ListObject was called

Jump to

Keyboard shortcuts

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