backupprogress

package
v0.4.95 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package backupprogress carries where a running copy is, from the engine that copies to whoever follows it.

The callback rides on the context so the copy interfaces stay as they are: an engine that finds one reports to it, and one that does not costs nothing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Report

func Report(ctx context.Context, stats Stats)

Report hands stats to the context's callback, if it has one.

func Wanted

func Wanted(ctx context.Context) bool

Wanted says whether anybody follows this copy, so an engine asks for figures only then.

func With

func With(ctx context.Context, report func(Stats)) context.Context

With returns a context whose copies report to report.

Types

type Stats

type Stats struct {
	Bytes int64 `json:"bytes"`
	// TotalBytes zero means the engine is still taking stock.
	TotalBytes int64 `json:"total_bytes,omitempty"`
	Files      int64 `json:"files"`
	TotalFiles int64 `json:"total_files,omitempty"`
	// Speed is in bytes a second.
	Speed int64 `json:"speed,omitempty"`
	// ETA is in seconds; nil when the engine cannot tell.
	ETA     *int64 `json:"eta,omitempty"`
	Current string `json:"current,omitempty"`
}

Stats is how far one copy has got, as its engine counts.

Jump to

Keyboard shortcuts

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