Documentation ¶
Overview ¶
Package utils contains command functionality which is reused across multiple other packages.
Index ¶
Constants ¶
const MaxAttempts = 3
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileStream ¶ added in v1.0.64
type FileStream struct {
// contains filtered or unexported fields
}
The FileStream implements the stream interface for files on disk.
It provides the stream length by reading the file stats. The file name is used for the stream name.
func NewFileStream ¶ added in v1.0.64
func NewFileStream(path string) *FileStream
func (FileStream) Data ¶ added in v1.0.64
func (s FileStream) Data() (io.ReadCloser, int64, error)
func (FileStream) Name ¶ added in v1.0.64
func (s FileStream) Name() string
type MemoryStream ¶ added in v1.0.64
type MemoryStream struct {
// contains filtered or unexported fields
}
The MemoryStream implements the stream interface using a simple byte array.
The byte array length is used as the stream length. The name needs to be provided when initializing a new MemoryStream instance.
func NewMemoryStream ¶ added in v1.0.64
func NewMemoryStream(name string, data []byte) *MemoryStream
func (MemoryStream) Data ¶ added in v1.0.64
func (s MemoryStream) Data() (io.ReadCloser, int64, error)
func (MemoryStream) Name ¶ added in v1.0.64
func (s MemoryStream) Name() string
type Progress ¶ added in v1.0.23
The Progress structure contains statistics about how many bytes have been read from the underlying reader.
type ProgressBar ¶ added in v1.0.23
type ProgressBar struct {
// contains filtered or unexported fields
}
The ProgressBar helps rendering a text-based progress indicator on the command-line. It uses the standard error output interface of the logger for writing progress.
func NewProgressBar ¶ added in v1.0.23
func NewProgressBar(logger log.Logger) *ProgressBar
func (*ProgressBar) Remove ¶ added in v1.0.23
func (b *ProgressBar) Remove()
type ProgressReader ¶ added in v1.0.23
The ProgressReader is a wrapper over the io.Reader interface which computes statistics while the data is read. This is used to show progress for file uploads and downloads.
The ProgressReader emits a Progress event whenever data is read from the reader. The event is debounced to avoid too many events.
func NewProgressReader ¶ added in v1.0.23
func NewProgressReader(reader io.Reader, progressFunc func(progress Progress)) *ProgressReader
type ReaderStream ¶ added in v1.0.64
type ReaderStream struct {
// contains filtered or unexported fields
}
The ReaderStream implements the stream interface by wrapping the generic io.ReadCloser interface.
It does not provide any stream length information due to performance reasons. The reader does not have a name, so it needs to be provided when initializing a new ReaderStream instance.
func NewReaderStream ¶ added in v1.0.64
func NewReaderStream(name string, reader io.ReadCloser) *ReaderStream
func (ReaderStream) Data ¶ added in v1.0.64
func (s ReaderStream) Data() (io.ReadCloser, int64, error)
func (ReaderStream) Name ¶ added in v1.0.64
func (s ReaderStream) Name() string
type RetryableError ¶ added in v1.0.49
type RetryableError struct {
// contains filtered or unexported fields
}
RetryableError can be returned inside of the Retry() block to indicate that the function failed and should be retried.
func Retryable ¶ added in v1.0.49
func Retryable(err error) *RetryableError
func (RetryableError) Error ¶ added in v1.0.49
func (e RetryableError) Error() string