Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BufferSize = 1024 * 1024
BufferSize is the buffered reader size
Functions ¶
Types ¶
type ActionReader ¶
type ActionReader struct {
// contains filtered or unexported fields
}
ActionReader wraps an io.SectionReader and also implements io.Closer by closing the embedded io.Closer.
func NewActionReader ¶
func NewActionReader(action dmplugin.Action) (*ActionReader, int64, error)
NewActionReader returns an *ActionReader for the supplied action.
func (*ActionReader) Close ¶
func (ar *ActionReader) Close() error
Close calls the embedded io.Closer's Close()
type ActionWriter ¶
type ActionWriter struct {
// contains filtered or unexported fields
}
ActionWriter wraps an io.WriterAt but imposes a base offset determined by the action's extent.
func NewActionWriter ¶
func NewActionWriter(action dmplugin.Action) (*ActionWriter, error)
NewActionWriter returns an *ActionWriter for the supplied action.
func (*ActionWriter) Close ¶
func (aw *ActionWriter) Close() error
Close calls the embedded io.Closer's Close()
func (*ActionWriter) Stat ¶
func (aw *ActionWriter) Stat() (os.FileInfo, error)
Stat calls the embedded statter's Stat().
type BufferedActionReader ¶
type BufferedActionReader struct {
// contains filtered or unexported fields
}
BufferedActionReader wraps a buffered ActionReader and also implements io.Closer by closing the embedded io.Closer.
func NewBufferedActionReader ¶
func NewBufferedActionReader(action dmplugin.Action) (*BufferedActionReader, int64, error)
NewBufferedActionReader returns a *BufferedActionReader for the supplied action.
func (*BufferedActionReader) Close ¶
func (bar *BufferedActionReader) Close() error
Close calls the embedded io.Closer's Close()
type ProgressReader ¶
type ProgressReader struct {
// contains filtered or unexported fields
}
ProgressReader wraps an io.ReaderAt and periodically invokes the supplied callback to provide progress updates.
func NewProgressReader ¶
func NewProgressReader(src io.ReadSeeker, updateEvery time.Duration, f progressFunc) *ProgressReader
NewProgressReader returns a new *ProgressReader
func (*ProgressReader) Read ¶
func (r *ProgressReader) Read(p []byte) (n int, err error)
Read calls internal Read and tracks how many bytes were read.
func (*ProgressReader) Seek ¶
func (r *ProgressReader) Seek(offset int64, whence int) (int64, error)
Seek calls the wrapped Seeker's Seek
func (*ProgressReader) StopUpdates ¶
func (p *ProgressReader) StopUpdates()
StopUpdates kills the updater goroutine
type ProgressWriter ¶
type ProgressWriter struct {
// contains filtered or unexported fields
}
ProgressWriter wraps an io.Writer and periodically invokes the supplied callback to provide progress updates.
func NewProgressWriter ¶
func NewProgressWriter(dst io.Writer, updateEvery time.Duration, f progressFunc) *ProgressWriter
NewProgressWriter returns a new *ProgressWriter
func (*ProgressWriter) StopUpdates ¶
func (p *ProgressWriter) StopUpdates()
StopUpdates kills the updater goroutine
func (*ProgressWriter) Write ¶
func (w *ProgressWriter) Write(p []byte) (int, error)
Write writes len(p) bytes from p to the underlying data stream at offset off. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. WriteAt must return a non-nil error if it returns n < len(p).
type ProgressWriterAt ¶
type ProgressWriterAt struct {
// contains filtered or unexported fields
}
ProgressWriterAt wraps an io.WriterAt and periodically invokes the supplied callback to provide progress updates.
func NewProgressWriterAt ¶
func NewProgressWriterAt(dst io.WriterAt, updateEvery time.Duration, f progressFunc) *ProgressWriterAt
NewProgressWriterAt returns a new *ProgressWriterAt
func (*ProgressWriterAt) StopUpdates ¶
func (p *ProgressWriterAt) StopUpdates()
StopUpdates kills the updater goroutine
func (*ProgressWriterAt) WriteAt ¶
func (w *ProgressWriterAt) WriteAt(p []byte, off int64) (int, error)
WriteAt writes len(p) bytes from p to the underlying data stream at offset off. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. WriteAt must return a non-nil error if it returns n < len(p).