objstore

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MinioObjStore

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

MinioObjectStore is an implementation of ObjectStore using Minio

func NewMinioObjectStore

func NewMinioObjectStore(client *minio.Client) *MinioObjStore

NewMinioObjectStore creates a new instance of MinioObjectStore with the provided Minio client

func (*MinioObjStore) Delete added in v0.12.0

func (s *MinioObjStore) Delete(ctx context.Context, bucket, obj string) error

Delete removes an object from Minio

func (*MinioObjStore) Get

func (s *MinioObjStore) Get(ctx context.Context, bucket, obj string) (io.ReadCloser, error)

Get retrieves an object from Minio

func (*MinioObjStore) Put

func (s *MinioObjStore) Put(ctx context.Context, bucket, obj string, reader io.Reader, size int64, contentType string) error

Put uploads an object to Minio

type ObjectStore

type ObjectStore interface {
	Put(ctx context.Context, bucket, obj string, reader io.Reader, size int64, contentType string) error
	Get(ctx context.Context, bucket, obj string) (io.ReadCloser, error)
	Delete(ctx context.Context, bucket, obj string) error
}

ObjectStore is a generic interface for object store operations

type ObjectStoreMock

type ObjectStoreMock struct {
	PutFunc    func(ctx context.Context, bucket, obj string, reader io.Reader, size int64, contentType string) error
	GetFunc    func(ctx context.Context, bucket, obj string) (io.ReadCloser, error)
	DeleteFunc func(ctx context.Context, bucket, obj string) error
}

ObjectStoreMock is a mock implementation of the ObjectStore interface.

func GenerateObjectStoreMock

func GenerateObjectStoreMock() *ObjectStoreMock

GenerateObjectStoreMock generates a new mock instance of the ObjectStore interface.

func (*ObjectStoreMock) Delete added in v0.13.0

func (m *ObjectStoreMock) Delete(ctx context.Context, bucket, obj string) error

Delete is a mock implementation of the Delete method.

func (*ObjectStoreMock) Get

func (m *ObjectStoreMock) Get(ctx context.Context, bucket, obj string) (io.ReadCloser, error)

Get is a mock implementation of the Get method.

func (*ObjectStoreMock) Put

func (m *ObjectStoreMock) Put(ctx context.Context, bucket, obj string, reader io.Reader, size int64, contentType string) error

Put is a mock implementation of the Put method.

Jump to

Keyboard shortcuts

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