From 1c8c0f52cff40465fca79d177c1a62f77b6d58c4 Mon Sep 17 00:00:00 2001 From: Sydonian <794346190@qq.com> Date: Fri, 15 Aug 2025 11:16:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=B0=83=E5=BA=A6EC=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E6=97=B6=E6=96=87=E4=BB=B6=E5=86=85=E5=AE=B9=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/internal/downloader/strategy/selector.go | 4 ++-- client/internal/services/user_space.go | 4 ++-- client/internal/ticktock/redundancy_shrink.go | 1 + common/pkgs/ioswitch/exec/executor.go | 6 +++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/internal/downloader/strategy/selector.go b/client/internal/downloader/strategy/selector.go index 98f81c5..c315bb0 100644 --- a/client/internal/downloader/strategy/selector.go +++ b/client/internal/downloader/strategy/selector.go @@ -39,7 +39,7 @@ type ECReconstructStrategy struct { Detail jcstypes.ObjectDetail Redundancy jcstypes.ECRedundancy Blocks []jcstypes.ObjectBlock - UserSpaces []jcstypes.UserSpaceDetail + UserSpaces []jcstypes.UserSpaceDetail // 与Blocks一一对应,表示每个Block应该从哪个UserSpace下载 } func (s *ECReconstructStrategy) GetDetail() jcstypes.ObjectDetail { @@ -50,7 +50,7 @@ type LRCReconstructStrategy struct { Detail jcstypes.ObjectDetail Redundancy jcstypes.LRCRedundancy Blocks []jcstypes.ObjectBlock - Spaces []jcstypes.UserSpaceDetail + Spaces []jcstypes.UserSpaceDetail // 与Blocks一一对应,表示每个Block应该从哪个UserSpace下载 } func (s *LRCReconstructStrategy) GetDetail() jcstypes.ObjectDetail { diff --git a/client/internal/services/user_space.go b/client/internal/services/user_space.go index 9e76238..2ff3b09 100644 --- a/client/internal/services/user_space.go +++ b/client/internal/services/user_space.go @@ -245,9 +245,9 @@ func (svc *UserSpaceService) DownloadPackage(req cliapi.UserSpaceDownloadPackage if shouldAtClient && strg.UserSpaces[i].RecommendHub != nil { newSpace := strg.UserSpaces[i] newSpace.RecommendHub = nil - ft.AddFrom(ioswitch2.NewFromShardstore(b.FileHash, newSpace, ioswitch2.RawStream())) + ft.AddFrom(ioswitch2.NewFromShardstore(b.FileHash, newSpace, ioswitch2.ECStream(b.Index))) } else { - ft.AddFrom(ioswitch2.NewFromShardstore(b.FileHash, strg.UserSpaces[i], ioswitch2.RawStream())) + ft.AddFrom(ioswitch2.NewFromShardstore(b.FileHash, strg.UserSpaces[i], ioswitch2.ECStream(b.Index))) } ft.ECParam = &strg.Redundancy diff --git a/client/internal/ticktock/redundancy_shrink.go b/client/internal/ticktock/redundancy_shrink.go index 50f115f..aeb9b1e 100644 --- a/client/internal/ticktock/redundancy_shrink.go +++ b/client/internal/ticktock/redundancy_shrink.go @@ -509,6 +509,7 @@ func (t *ChangeRedundancy) initBlockList(ctx *annealingState) { if blocks[i].Index == b.Index { blocks[i].HasEntity = true blocks[i].FileHash = b.FileHash + blocks[i].Size = b.Size has = true break } diff --git a/common/pkgs/ioswitch/exec/executor.go b/common/pkgs/ioswitch/exec/executor.go index 13fb7b5..7db9801 100644 --- a/common/pkgs/ioswitch/exec/executor.go +++ b/common/pkgs/ioswitch/exec/executor.go @@ -85,7 +85,11 @@ func (s *Executor) runOps(ops []Op, ctx *ExecContext, cancel context.CancelFunc) err = context.Canceled } } else { - err = multierror.Append(err, fmt.Errorf("%T: %w", op, e)) + if err == context.Canceled { + err = e + } else { + err = multierror.Append(err, fmt.Errorf("%T: %w", op, e)) + } } lock.Unlock()