pool

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package pool provides compressing pipeline implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo interface {
	Size() uint64
	Type() string
}

type Pool

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

func NewPool

func NewPool(ctx context.Context, worker Worker) Pool

func (*Pool) Run

func (p *Pool) Run(filePaths []string, workersCount uint8) <-chan Result

type PreRunner

type PreRunner interface {
	PreTaskRun(task Task)
}

type Result

type Result struct {
	Task Task

	FileType       string
	FilePath       string
	OriginalSize   uint64 // in bytes
	CompressedSize uint64 // in bytes

	Err error // if Err is not nil - some error occurred during task processing
}

type Task

type Task struct {
	FilePath   string
	TaskNumber uint // from 1 to TasksCount
	TasksCount uint // summary task count
}

type Worker

type Worker interface {
	Upload(ctx context.Context, filePath string) (url string, info FileInfo, err error)
	Download(ctx context.Context, url, toFilePath string) (info FileInfo, err error)
	CopyContent(fromFilePath, toFilePath string) error
	RemoveFile(filePath string) error
}

Jump to

Keyboard shortcuts

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