Stream forever with eviction-based per-stream loss detection

This commit is contained in:
flamingcow
2026-07-25 18:33:36 -07:00
parent 2516d908b9
commit 7c09c34564
4 changed files with 117 additions and 151 deletions
+6 -14
View File
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"strings"
"time"
)
const (
@@ -56,6 +57,11 @@ func pad(s string, w int, right bool) string {
return s + strings.Repeat(" ", gap)
}
func uptime(d time.Duration) string {
total := int(d.Seconds())
return fmt.Sprintf("%d:%02d:%02d", total/3600, (total/60)%60, total%60)
}
func commas(v uint64) string {
s := fmt.Sprintf("%d", v)
if len(s) <= 3 {
@@ -182,20 +188,6 @@ func statusCell(v uint64) string {
return paint(s, cRed)
}
func gapCell(v int64) string {
if v <= 0 {
return paint("0", cGreen)
}
return paint(commas(uint64(v)), cYellow)
}
func lostCell(v int64) string {
if v <= 0 {
return paint("0", cGreen)
}
return paint(commas(uint64(v)), cRed)
}
func rateCell(gb float64, target float64) string {
s := fmt.Sprintf("%.2f", gb)
switch {