storage

package
v0.0.0-...-9243632 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PresignedURLExpiry = 24 * time.Hour
)

Variables

This section is empty.

Functions

func WithMetadata

func WithMetadata(metadata map[string]string) func(*minio.PutObjectOptions) error

Types

type Bucket

type Bucket string
const (
	ResultsBucket    Bucket = "results"
	IngestionsBucket Bucket = "ingestions"
)

type MinioStorage

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

func (*MinioStorage) CreateObject

func (s *MinioStorage) CreateObject(ctx context.Context, bucket Bucket, name string,
	opts ...func(*minio.PutObjectOptions) error,
) (*Object, error)

func (*MinioStorage) GetObject

func (s *MinioStorage) GetObject(ctx context.Context, bucket Bucket, name string) (*Object, error)

func (*MinioStorage) ListObjects

func (s *MinioStorage) ListObjects(ctx context.Context, bucket Bucket) (*[]Object, error)

type MockStorage

type MockStorage struct {
	mock.Mock
}

MockStorage is an autogenerated mock type for the Storage type

func NewMockStorage

func NewMockStorage(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockStorage

NewMockStorage creates a new instance of MockStorage. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockStorage) CreateObject

func (_m *MockStorage) CreateObject(ctx context.Context, bucket Bucket, name string, opts ...func(*minio.PutObjectOptions) error) (*Object, error)

CreateObject provides a mock function with given fields: ctx, bucket, name, opts

func (*MockStorage) GetObject

func (_m *MockStorage) GetObject(ctx context.Context, bucket Bucket, name string) (*Object, error)

GetObject provides a mock function with given fields: ctx, bucket, name

func (*MockStorage) ListObjects

func (_m *MockStorage) ListObjects(ctx context.Context, bucket Bucket) (*[]Object, error)

ListObjects provides a mock function with given fields: ctx, bucket

type Object

type Object struct {
	Bucket       Bucket
	Name         string
	Size         int64
	LastModified time.Time
	Metadata     map[string]string
	// contains filtered or unexported fields
}

func (*Object) PresignedGetURL

func (o *Object) PresignedGetURL() (string, error)

func (*Object) PresignedPutURL

func (o *Object) PresignedPutURL() (string, error)

func (*Object) Refresh

func (o *Object) Refresh() error

func (*Object) SetMetadata

func (o *Object) SetMetadata(ctx context.Context, metadata map[string]string) error

type Storage

type Storage interface {
	ListObjects(ctx context.Context, bucket Bucket) (*[]Object, error)
	GetObject(ctx context.Context, bucket Bucket, name string) (*Object, error)
	CreateObject(ctx context.Context, bucket Bucket, name string,
		opts ...func(*minio.PutObjectOptions) error) (*Object, error)
}

func NewMinioStorage

func NewMinioStorage(ctx context.Context) (Storage, error)

Jump to

Keyboard shortcuts

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