compress

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cli.Command

NewCommand creates `compress` command.

Types

type CompressionStat

type CompressionStat struct {
	FilePath, FileType           string
	CompressedSize, OriginalSize uint64
}

CompressionStat represents a single compression stat.

type ErrorsWatcher

type ErrorsWatcher chan error

func (ErrorsWatcher) Push

func (w ErrorsWatcher) Push(ctx context.Context, err error)

func (ErrorsWatcher) Watch

func (w ErrorsWatcher) Watch(ctx context.Context, errorsLimit uint, options ...ErrorsWatcherOption)

type ErrorsWatcherOption

type ErrorsWatcherOption func(*errorsWatcherOptions)

func WithLimitExceededHandler

func WithLimitExceededHandler(h func()) ErrorsWatcherOption

func WithOnErrorHandler

func WithOnErrorHandler(h func(error)) ErrorsWatcherOption

type StatsCollector

type StatsCollector interface {
	Watch(context.Context)                 // starts collecting stats
	Push(context.Context, CompressionStat) // pushes a new stat
	Close()                                // stops collecting stats

	History() []CompressionStat  // returns all collected stats
	TotalOriginalSize() uint64   // returns total original size of all files
	TotalCompressedSize() uint64 // returns total compressed size of all files
	TotalSavedBytes() int64      // returns total saved bytes of all files
	TotalFiles() uint32          // returns total number of files
}

type StatsStorage

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

StatsStorage is a storage for compression stats.

func NewStatsStorage

func NewStatsStorage(expectedHistoryLen int) *StatsStorage

NewStatsStorage creates a new StatsStorage.

func (*StatsStorage) Close

func (s *StatsStorage) Close()

func (*StatsStorage) History

func (s *StatsStorage) History() []CompressionStat

func (*StatsStorage) Push

func (s *StatsStorage) Push(ctx context.Context, stat CompressionStat)

func (*StatsStorage) TotalCompressedSize

func (s *StatsStorage) TotalCompressedSize() (total uint64)

func (*StatsStorage) TotalFiles

func (s *StatsStorage) TotalFiles() (total uint32)

func (*StatsStorage) TotalOriginalSize

func (s *StatsStorage) TotalOriginalSize() (total uint64)

func (*StatsStorage) TotalSavedBytes

func (s *StatsStorage) TotalSavedBytes() (total int64)

func (*StatsStorage) Watch

func (s *StatsStorage) Watch(ctx context.Context)

Jump to

Keyboard shortcuts

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