minio

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MsgFailedCreateBucket   string = "failed to create bucket: %w"
	MsgFailedGetInfo        string = "failed to get info for object: %w"
	MsgFailedInitiateClient string = "failed to initiate MinIO client: %w"
	MsgFailedLoad           string = "failed to load object: %w"
	MsgFailedRemove         string = "failed to remove object: %w"
	MsgFailedUpload         string = "failed to upload object: %w"
)

Error messages

View Source
const DefaultBucketName = "integrity"

Variables

This section is empty.

Functions

func BuildObjectName added in v0.1.1

func BuildObjectName(namespace, image, alg string) string

BuildObjectName returns the object name for the given @namespace and @image.

An @image has the following format: imageName:imageTag Returns: namespace/imageName/imageTag.alg

func NewMinIOClient

func NewMinIOClient(host string) (*minio.Client, error)

NewMinIOClient returns the MinIO client

Types

type Storage

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

Storage represents instance for MinIO storage

func Instance

func Instance() *Storage

Instance returns the current storage instance

func NewStorage

func NewStorage(log *logrus.Logger) (*Storage, error)

NewStorage creates new storage instance and return it

func (*Storage) CreateBucketIfNotExists

func (s *Storage) CreateBucketIfNotExists(ctx context.Context, bucketName string) error

CreateBucketIfNotExists creates a new bucket with the given @bucketName if it does not exist

func (*Storage) ListBuckets

func (s *Storage) ListBuckets(ctx context.Context) ([]minio.BucketInfo, error)

ListBuckets returns a list of all buckets in the MinIO server

func (*Storage) Load

func (s *Storage) Load(ctx context.Context, bucketName, objectName string) ([]byte, error)

Load loads and returns data from the @bucketName for the @objectName

func (*Storage) Remove added in v0.1.1

func (s *Storage) Remove(ctx context.Context, bucketName string, objName string) error

Remove removes the @objName from the @bucketName

func (*Storage) Save

func (s *Storage) Save(ctx context.Context, bucketName, objectName string, data []byte) error

Save stores @data into the @bucketName with the given @objectName

Jump to

Keyboard shortcuts

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