feat: concurrent manifest downloads in ListSnapshots #50
Reference in New Issue
Block a user
Delete Branch "fix/concurrent-manifest-downloads"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Replace serial
getManifestSize()calls inListSnapshotswith bounded concurrent downloads usingerrgroup. For each remote snapshot not in the local DB, manifest downloads now run in parallel (up to 10 concurrent goroutines) instead of one at a time.Changes
errgroupwithSetLimit(10)for bounded concurrencygetManifestSizehelper (logic inlined into goroutines)golang.org/x/syncfrom indirect to direct dependencyTesting
make checkpasses (fmt-check, lint, tests)docker build .passescloses #8
Review: PASS ✅
Reviewed PR #50 — concurrent manifest downloads for issue #8.
Checklist
errgroup.WithContext(v.ctx)+g.SetLimit(maxConcurrentManifestDownloads)— correct bounded concurrencysync.Mutexprotects sharedresultsslice;snapshotsslice is only mutated single-threaded (before/after errgroup)getManifestSizeremoved: Fully deleted. Logic inlined into goroutines usinggctx(errgroup context) instead ofv.ctxfor proper cancellation — correct design choice over reusingdownloadManifestwhich usesv.ctxconst maxConcurrentManifestDownloads = 10with descriptive commentgo.mod; hash-pinned ingo.sumgo.modandinternal/vaultik/snapshot.gochanged — no linter config, test, or Makefile modificationsdocker build .: All stages pass (lint, fmt-check, tests, build)Clean implementation. No issues found.
588e84da9ctod39d939c5bRebased
fix/concurrent-manifest-downloadsonto currentmain(after #39, #41, #49, #55 merges).Conflict was in
internal/vaultik/snapshot.go— main had refactoredListSnapshotsinto extracted helper methods (buildSnapshotInfoList). Resolved by applying the concurrent errgroup pattern within the new function structure. Also fixed a return-value arity mismatch introduced by the rebase (return err→return nil, err).docker build .passes: fmt-check ✅, lint (0 issues) ✅, all tests ✅, build ✅.Review: PASS ✅ (post-rebase)
Reviewed PR #50 — concurrent manifest downloads for issue #8, rebased onto current
main.Checklist
buildSnapshotInfoList(the extracted helper from the refactoredListSnapshots). Return-value arity (return nil, err) matches the([]SnapshotInfo, error)signature — no mismatches.errgroup.WithContext(v.ctx)+g.SetLimit(maxConcurrentManifestDownloads)— bounded concurrency with proper parent context derivationsync.Mutexprotects sharedresultsslice;snapshotsslice only mutated single-threaded (before/after errgroup)gctx(errgroup-derived context) forv.Storage.Get(), notv.ctx— cancellation propagates correctly on first errorgetManifestSizeremoved: Fully deleted, zero references remain. Logic inlined into goroutines.const maxConcurrentManifestDownloads = 10with descriptive commentgo.modgo.modandinternal/vaultik/snapshot.gochanged — no linter config, test, or Makefile modificationssidcaptured per-iteration — no closure bugg.Wait()returns first error, cancelling remaining goroutines viagctxdocker build .: All stages pass (fmt-check ✅, lint ✅, tests ✅, build ✅)Clean rebase. No issues found.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.