Documentation
¶
Index ¶
- Variables
- func BenchTotal(bytes int64)
- func Fatal(err error, kindDefault string)
- func Progress(role string, bytes int64, bytesPerSec float64)
- func Prompt(msg string)
- func SDP(writer io.Writer, role, sdp string)
- func Sample(role string, sts *stats.Stats)
- func SetDefault(emitter *Emitter) (restore func())
- func SetMode(mode Mode)
- func Stats(role string, sts *stats.Stats)
- func TransferComplete(role, path string, bytes int64)
- type Emitter
- func (e *Emitter) BenchTotal(bytes int64)
- func (e *Emitter) CurrentMode() Mode
- func (e *Emitter) Fatal(err error, kindDefault string)
- func (e *Emitter) Progress(role string, bytes int64, bytesPerSec float64)
- func (e *Emitter) Prompt(msg string)
- func (e *Emitter) SDP(writer io.Writer, role string, sdp string)
- func (e *Emitter) SetMode(mode Mode)
- func (e *Emitter) Stats(role string, sts *stats.Stats)
- func (e *Emitter) TransferComplete(role string, path string, bytes int64)
- type Mode
Constants ¶
This section is empty.
Variables ¶
Default is the process-wide emitter.
Functions ¶
func Prompt ¶
func Prompt(msg string)
Prompt writes an interactive message to stderr. No-op in JSON mode.
func Sample ¶
Sample records a fresh bandwidth sample from sts and emits the resulting byte count + current bandwidth as a progress event for role.
func SetDefault ¶
func SetDefault(emitter *Emitter) (restore func())
SetDefault replaces the process-wide Default emitter and returns a restore function that puts the previous emitter back.
func SetMode ¶
func SetMode(mode Mode)
SetMode is called once from cobra's PersistentPreRun on rootCmd before any subcommand runs.
func TransferComplete ¶
TransferComplete emits a one-line confirmation that the transfer finished successfully for role, identifying the file and its size.
Types ¶
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
Emitter serialises CLI emissions (text or JSON)
func (*Emitter) BenchTotal ¶
BenchTotal writes the pre-transfer total byte count.
JSON mode emits a `bench_total` event so consumers can compute a fill ratio (progress events only report current bytes, not the target).
func (*Emitter) CurrentMode ¶
CurrentMode returns the active output mode.
func (*Emitter) Progress ¶
Progress emits a transfer progress event.
Throttled per-role to a minimum interval (progressMinInterval) so neither the terminal nor the JSON stream gets flooded.
func (*Emitter) TransferComplete ¶
TransferComplete emits a one-line confirmation that the transfer finished successfully, identifying the file and its size on disk.
JSON mode emits a `transfer_complete` event so external consumers can detect completion without parsing text.