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 ¶
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 ¶
func NewFileStream(path string) *FileStream
func (FileStream) Data ¶
func (s FileStream) Data() (io.ReadCloser, error)
func (FileStream) Name ¶
func (s FileStream) Name() string
func (FileStream) Size ¶
func (s FileStream) Size() (int64, error)
type MemoryStream ¶
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 ¶
func NewMemoryStream(name string, data []byte) *MemoryStream
func (MemoryStream) Data ¶
func (s MemoryStream) Data() (io.ReadCloser, error)
func (MemoryStream) Name ¶
func (s MemoryStream) Name() string
func (MemoryStream) Size ¶
func (s MemoryStream) Size() (int64, error)
type Progress ¶
The Progress structure contains statistics about how many bytes have been read from the underlying reader.
type ProgressBar ¶
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 ¶
func NewProgressBar(logger log.Logger) *ProgressBar
func (*ProgressBar) Remove ¶
func (b *ProgressBar) Remove()
type ProgressReader ¶
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 ¶
func NewProgressReader(reader io.Reader, progressFunc func(progress Progress)) *ProgressReader
type ReaderStream ¶
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 ¶
func NewReaderStream(name string, reader io.ReadCloser) *ReaderStream
func (ReaderStream) Data ¶
func (s ReaderStream) Data() (io.ReadCloser, error)
func (ReaderStream) Name ¶
func (s ReaderStream) Name() string
func (ReaderStream) Size ¶
func (s ReaderStream) Size() (int64, error)
type RetryableError ¶
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 ¶
func Retryable(err error) *RetryableError
func (RetryableError) Error ¶
func (e RetryableError) Error() string