Documentation ¶
Index ¶
- Variables
- func Download(ctx context.Context, sourcePkg *client.DatasetRef, sourcePath string, ...) error
- func FormatRate(bytes int64, d time.Duration) string
- func InterruptContext() context.Context
- func Upload(ctx context.Context, sourcePath string, targetPkg *client.DatasetRef, ...) error
- func UploadStats(directory string) (files, bytes int64, err error)
- type ProgressTracker
- type ProgressTrackerWithStatus
- type ProgressUpdate
Constants ¶
This section is empty.
Variables ¶
var NoTracker = &nopTracker{}
NoTracker implements the ProgressTracker interface but does nothing.
Functions ¶
func Download ¶
func Download( ctx context.Context, sourcePkg *client.DatasetRef, sourcePath string, targetPath string, tracker ProgressTracker, concurrency int, ) error
Download all files under the sourcePath in the sourcePkg to the targetPath.
func FormatRate ¶
FormatRate returns a string showing transfer rate in bytes-per-second.
func InterruptContext ¶
func Upload ¶
func Upload( ctx context.Context, sourcePath string, targetPkg *client.DatasetRef, targetPath string, tracker ProgressTracker, concurrency int, ) error
Upload the sourcePath to the targetPath in the targetPkg.
func UploadStats ¶
UploadStats finds the number of files and bytes that would be uploaded in a directory.
Types ¶
type ProgressTracker ¶
type ProgressTracker interface { Update(*ProgressUpdate) Close() error }
ProgressTracker tracks the status of an operation.
type ProgressTrackerWithStatus ¶
type ProgressTrackerWithStatus interface { ProgressTracker Status() *ProgressUpdate }
ProgressTrackerWithStatus tracks the status of an operation and exposes the current status of the operation.
func BoundedTracker ¶
func BoundedTracker(ctx context.Context, totalFiles, totalBytes int64) ProgressTrackerWithStatus
BoundedTracker shows the progress of an operation with a predefined size. Falls back to DefaultTracker if not in a terminal.
func DefaultTracker ¶
func DefaultTracker() ProgressTrackerWithStatus
DefaultTracker prints a message on each update and on close.
func UnboundedTracker ¶
func UnboundedTracker(ctx context.Context) ProgressTrackerWithStatus
UnboundedTracker shows the progress of an operation without a predefined size. Falls back to DefaultTracker if not in a terminal.
type ProgressUpdate ¶
ProgressUpdate contains deltas for each tracked value.