mio

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogOff

func LogOff()

func LogOn

func LogOn()

func LogSet

func LogSet(l *hlog.Logger)

Types

type Bucket

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

Bucket is a wrapper for Minio bucket.

func (*Bucket) Create

func (b *Bucket) Create() error

Create creates the bucket with preset name if it doesn't exist.

func (*Bucket) Destroy

func (b *Bucket) Destroy() error

Destroy deletes the bucket if it exists.

func (*Bucket) ListObject

func (b *Bucket) ListObject() []*Object

ListObject lists all objects in the bucket.

func (*Bucket) NewObject

func (b *Bucket) NewObject(name string) (*Object, error)

NewObject creates an instance for the object with given name.

func (*Bucket) String

func (b *Bucket) String() string

type Object

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

Object is a wrapper for Minio object.

func (*Object) DownloadContent

func (o *Object) DownloadContent(ctx context.Context) ([]byte, error)

DownloadContent downloads the content of the object and returns in a slice of bytes.

func (*Object) DownloadFile

func (o *Object) DownloadFile(ctx context.Context, fileName string) error

DownloadFile downloads the object and saves as a file in the given path.

func (*Object) DownloadFileIfNewer

func (o *Object) DownloadFileIfNewer(ctx context.Context, fileName string) error

DownloadFileIfNewer downloads the object and saves as a file in the given path if the file doesn't exist or has a different hash.

func (*Object) DownloadStream

func (o *Object) DownloadStream(handler func(io.ReadCloser) error) error

func (*Object) Exist

func (o *Object) Exist() error

Exist checks if the object exists, or return an error if it doesn't.

func (*Object) SetContentType

func (o *Object) SetContentType(contentType string)

SetContentType sets ContentType of the object.

func (*Object) SetDisableMultipart

func (o *Object) SetDisableMultipart(disableMultipart bool)

SetDisableMultipart sets DisableMultipart of the object for uploading.

func (*Object) SetProgressReporter

func (o *Object) SetProgressReporter(report ProgressReporter)

SetProgressReporter sets ProgressReporter of the object for downloading and uploading.

func (*Object) String

func (o *Object) String() string

func (*Object) UploadContent

func (o *Object) UploadContent(ctx context.Context, data []byte) error

UploadContent uploads the given data to the object.

func (*Object) UploadFile

func (o *Object) UploadFile(ctx context.Context, fileName string) error

UploadFile uploads the given file to the object.

func (*Object) UploadFileWithMD5

func (o *Object) UploadFileWithMD5(ctx context.Context, fileName string, md5 string) error

type ProgressReporter

type ProgressReporter func(bytesTransferred int64)

ProgressReporter defines the signature of a callback function invoked as progress is reported.

type Service

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

Service is a wrapper for Minio client.

func NewService

func NewService(url, id, secret string) (*Service, error)

NewService creates an instance for a minio client connected to a given minio server.

func (*Service) ListBucket

func (s *Service) ListBucket() ([]*Bucket, error)

ListBucket lists all buckets under the service.

func (*Service) Name

func (s *Service) Name() string

Name returns the name of the service.

func (*Service) NewBucket

func (s *Service) NewBucket(name string) (*Bucket, error)

NewBucket creates an instance for the bucket with given name.

func (Service) String

func (s Service) String() string

type UploadProgress

type UploadProgress struct {
	sync.Mutex
	// contains filtered or unexported fields
}

UploadProgress helps accumulate the progress of MinIO file upload

func NewUploadProgress

func NewUploadProgress(reporter ProgressReporter) *UploadProgress

NewUploadProgress creates an instance for a minio upload progress fetcher

func (*UploadProgress) Read

func (p *UploadProgress) Read(b []byte) (int, error)

Jump to

Keyboard shortcuts

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