storage

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 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 Azure added in v1.12.0

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

Azure is a type for working with Azure Blob storages

func NewAzure added in v1.12.0

func NewAzure(storageAccount, accessKey, endpoint, container, prefix string) (*Azure, error)

func (*Azure) GetObject added in v1.12.0

func (a *Azure) GetObject(ctx context.Context, name string) (io.ReadCloser, error)

func (*Azure) GetPrefix added in v1.12.0

func (a *Azure) GetPrefix() string

func (*Azure) ListObjects added in v1.12.0

func (a *Azure) ListObjects(ctx context.Context, prefix string) ([]string, error)

func (*Azure) PutObject added in v1.12.0

func (a *Azure) PutObject(ctx context.Context, name string, data io.Reader, _ int64) error

func (*Azure) SetPrefix added in v1.12.0

func (a *Azure) SetPrefix(prefix string)

type S3

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

S3 is a type for working with S3 storages

func NewS3

func NewS3(endpoint, accessKeyID, secretAccessKey, bucketName, prefix, region string, verifyTLS bool) (*S3, error)

NewS3 return new Manager, useSSL using ssl for connection with storage

func (*S3) GetObject

func (s *S3) GetObject(ctx context.Context, objectName string) (io.ReadCloser, error)

GetObject return content by given object name

func (*S3) GetPrefix added in v1.12.0

func (s *S3) GetPrefix() string

func (*S3) ListObjects

func (s *S3) ListObjects(ctx context.Context, prefix string) ([]string, error)

func (*S3) PutObject

func (s *S3) PutObject(ctx context.Context, name string, data io.Reader, size int64) error

PutObject puts new object to storage with given name and content

func (*S3) SetPrefix added in v1.8.0

func (s *S3) SetPrefix(prefix string)

type Storage

type Storage interface {
	GetObject(ctx context.Context, objectName string) (io.ReadCloser, error)
	PutObject(ctx context.Context, name string, data io.Reader, size int64) error
	ListObjects(ctx context.Context, prefix string) ([]string, error)
	SetPrefix(prefix string)
	GetPrefix() string
}

Jump to

Keyboard shortcuts

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