progress

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithProgress

func WithProgress(ctx context.Context, pw Writer) context.Context

Types

type MultiReader

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

func NewMultiReader

func NewMultiReader(pr Reader) *MultiReader

func (*MultiReader) Reader

func (mr *MultiReader) Reader(ctx context.Context) Reader

type MultiWriter

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

func NewMultiWriter

func NewMultiWriter(opts ...WriterOption) *MultiWriter

func (*MultiWriter) Add

func (ps *MultiWriter) Add(pw Writer)

func (*MultiWriter) Close

func (ps *MultiWriter) Close() error

func (*MultiWriter) Delete

func (ps *MultiWriter) Delete(pw Writer)

func (*MultiWriter) Write

func (ps *MultiWriter) Write(id string, v interface{}) error

func (*MultiWriter) WriteRawProgress

func (ps *MultiWriter) WriteRawProgress(p *Progress) error

type Progress

type Progress struct {
	ID        string
	Timestamp time.Time
	Sys       interface{}
	// contains filtered or unexported fields
}

func (*Progress) Meta

func (p *Progress) Meta(key string) (interface{}, bool)

type Reader

type Reader interface {
	Read(context.Context) ([]*Progress, error)
}

func NewContext

func NewContext(ctx context.Context) (Reader, context.Context, func())

NewContext returns a new context and a progress reader that captures all progress items writtern to this context. Last returned parameter is a closer function to signal that no new writes will happen to this context.

type Status

type Status struct {
	Action    string
	Current   int
	Total     int
	Started   *time.Time
	Completed *time.Time
}

type Writer

type Writer interface {
	Write(id string, value interface{}) error
	Close() error
}

func FromContext

func FromContext(ctx context.Context, opts ...WriterOption) (Writer, bool, context.Context)

FromContext returns a progress writer from a context.

type WriterOption

type WriterOption func(Writer)

func WithMetadata

func WithMetadata(key string, val interface{}) WriterOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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