perf(sync): parallel blob upload + progress bar for initial import

The initial import was latency-bound: the push loop uploaded blobs strictly
serially, doing an Exists round-trip then a Put per blob (~2-3N sequential
round-trips against the hub).

- Upload unique blobs in parallel (errgroup, 16 in flight) — the main win.
- Drop the separate Exists round-trip: the backend's Put is idempotent and
  the hub already skips content it has (reported during signing), so the
  check was redundant.
- Session.OnProgress emits upload progress (done/total files + bytes) from
  the push phase; the CLI renders an in-place bar on a TTY and periodic
  percentage lines otherwise, wired into `bdrive init`'s initial cycle and
  `bdrive sync`. The daemon stays silent.

Multi-device convergence tests pass with -race; new TestPushProgress covers
the progress emission.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7Q9ZKSZRTdvrSJkYLUmYs
This commit is contained in:
Snow Lee
2026-07-10 10:11:54 -07:00
co-authored by Claude Opus 4.8
parent 9e710a2540
commit 64fa269e52
6 changed files with 160 additions and 12 deletions
+1 -1
View File
@@ -14,6 +14,7 @@ require (
github.com/spf13/cobra v1.10.2
github.com/yuin/goldmark v1.8.2
golang.org/x/crypto v0.51.0
golang.org/x/sync v0.21.0
google.golang.org/api v0.284.0
modernc.org/sqlite v1.53.0
)
@@ -79,7 +80,6 @@ require (
go.opentelemetry.io/otel/trace v1.43.0 // indirect
golang.org/x/net v0.55.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.21.0 // indirect
golang.org/x/sys v0.45.0 // indirect
golang.org/x/term v0.43.0 // indirect
golang.org/x/text v0.37.0 // indirect