uploader

package
v0.0.0-...-5348dab Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const UPLOAD_BUFFER_SIZE = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorNotifierHarness

type ErrorNotifierHarness interface {
	SendError(error)
}

type Factory

type Factory interface {
	NewUploader() Uploader
}

Factory is an interface to an object that makes new Uploader instances

func NewFactory

func NewFactory(bucket string, keynameGenerator S3KeyNameGenerator, s3Uploader s3manageriface.UploaderAPI) Factory

type FileTypeHeader

type FileTypeHeader string
const (
	Gzip FileTypeHeader = "application/x-gzip"
	Text FileTypeHeader = "text/plain"
)

type NotifierHarness

type NotifierHarness interface {
	SendMessage(*UploadReceipt) error
}

type S3KeyNameGenerator

type S3KeyNameGenerator interface {
	GetKeyName(string) string
}

type UploadReceipt

type UploadReceipt struct {
	Path    string
	KeyName string
	// contains filtered or unexported fields
}

type UploadRequest

type UploadRequest struct {
	Filename string
	FileType FileTypeHeader
	// contains filtered or unexported fields
}

type Uploader

type Uploader interface {
	Upload(*UploadRequest) (*UploadReceipt, error)
}

Uploader is an interface for uploading files

type UploaderPool

type UploaderPool struct {
	Pool          []Uploader
	Notifier      NotifierHarness
	ErrorNotifier ErrorNotifierHarness
	// contains filtered or unexported fields
}

func StartUploaderPool

func StartUploaderPool(
	numWorkers int,
	errorNotifier ErrorNotifierHarness,
	notifier NotifierHarness,
	builder Factory,
) *UploaderPool

func (*UploaderPool) Close

func (p *UploaderPool) Close()

func (*UploaderPool) Crank

func (p *UploaderPool) Crank()

func (*UploaderPool) Upload

func (p *UploaderPool) Upload(req *UploadRequest)

Jump to

Keyboard shortcuts

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