uploader

package
v0.0.0-...-affaa53 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Origin

func Origin(uploadEndpoint string, secure bool) string

Types

type FileUpload

type FileUpload struct {
	Bucket    string
	File      fileheader.FileHeader
	Directory string
}

type MinioClient

type MinioClient interface {
	PutObjectWithContext(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64,
		opts minio.PutObjectOptions) (n int64, err error)
}

type UploadError

type UploadError struct {
	FileName string
	Error    error
}

type UploadResult

type UploadResult struct {
	FileName   string `json:"fileName"`
	RemotePath string `json:"remotePath"`
	Bucket     string `json:"bucket"`
	Size       int64  `json:"size"`
}

type Uploader

type Uploader struct {
	UploadTimeout    time.Duration
	MaxUploadWorkers int
	// contains filtered or unexported fields
}

Uploader is an abstraction layer for Minio client

func New

func New(client MinioClient, uploadOrigin string, uploadTimeout time.Duration, maxUploadWorkers int) *Uploader

New returns a new instance of Uploader

func (*Uploader) UploadFiles

func (u *Uploader) UploadFiles(ctx context.Context, filesChannel chan FileUpload, filesCount int) ([]UploadResult, []UploadError)

UploadFiles uploads multiple files (Files struct) to particular bucket

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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