util

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2016 License: Apache-2.0 Imports: 8 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyProgress

func CopyProgress(level capnslog.LogLevel, prefix string, writer io.Writer, reader io.Reader, total int64) (int64, error)

CopyProgress copies data from reader into writter, logging progress through level.

func LogFrom

func LogFrom(l capnslog.LogLevel, r io.Reader)

LogFrom reads lines from reader r and sends them to logger l.

func Retry

func Retry(attempts int, delay time.Duration, f func() error) error

Retry calls function f until it has been called attemps times, or succeeds. Retry delays for delay between calls of f. If f does not succeed after attempts calls, the error from the last call is returned.

Types

type CloserDestructor

type CloserDestructor struct {
	io.Closer
}

CloseDestructor wraps any Closer to provide the Destructor interface.

func (CloserDestructor) Destroy

func (c CloserDestructor) Destroy() error

type Destructor

type Destructor interface {
	Destroy() error
}

Destructor is a common interface for objects that need to be cleaned up.

type MultiDestructor

type MultiDestructor []Destructor

MultiDestructor wraps multiple Destructors for easy cleanup.

func (*MultiDestructor) AddCloser

func (m *MultiDestructor) AddCloser(closer io.Closer)

func (*MultiDestructor) AddDestructor

func (m *MultiDestructor) AddDestructor(destructor Destructor)

func (MultiDestructor) Destroy

func (m MultiDestructor) Destroy() error

Jump to

Keyboard shortcuts

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