2016-08-01 18:55:07 +02:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import (
|
2017-06-04 11:16:55 +02:00
|
|
|
"context"
|
2020-09-20 00:45:11 +02:00
|
|
|
"sync"
|
2016-08-29 19:18:57 +02:00
|
|
|
|
2017-07-23 14:21:03 +02:00
|
|
|
"github.com/restic/restic/internal/debug"
|
2022-04-23 11:28:18 +02:00
|
|
|
"github.com/restic/restic/internal/errors"
|
feat(backends/s3): add warmup support before repacks and restores (#5173)
* feat(backends/s3): add warmup support before repacks and restores
This commit introduces basic support for transitioning pack files stored
in cold storage to hot storage on S3 and S3-compatible providers.
To prevent unexpected behavior for existing users, the feature is gated
behind new flags:
- `s3.enable-restore`: opt-in flag (defaults to false)
- `s3.restore-days`: number of days for the restored objects to remain
in hot storage (defaults to `7`)
- `s3.restore-timeout`: maximum time to wait for a single restoration
(default to `1 day`)
- `s3.restore-tier`: retrieval tier at which the restore will be
processed. (default to `Standard`)
As restoration times can be lengthy, this implementation preemptively
restores selected packs to prevent incessant restore-delays during
downloads. This is slightly sub-optimal as we could process packs
out-of-order (as soon as they're transitioned), but this would really
add too much complexity for a marginal gain in speed.
To maintain simplicity and prevent resources exhautions with lots of
packs, no new concurrency mechanisms or goroutines were added. This just
hooks gracefully into the existing routines.
**Limitations:**
- Tests against the backend were not written due to the lack of cold
storage class support in MinIO. Testing was done manually on
Scaleway's S3-compatible object storage. If necessary, we could
explore testing with LocalStack or mocks, though this requires further
discussion.
- Currently, this feature only warms up before restores and repacks
(prune/copy), as those are the two main use-cases I came across.
Support for other commands may be added in future iterations, as long
as affected packs can be calculated in advance.
- The feature is gated behind a new alpha `s3-restore` feature flag to
make it explicit that the feature is still wet behind the ears.
- There is no explicit user notification for ongoing pack restorations.
While I think it is not necessary because of the opt-in flag, showing
some notice may improve usability (but would probably require major
refactoring in the progress bar which I didn't want to start). Another
possibility would be to add a flag to send restores requests and fail
early.
See https://github.com/restic/restic/issues/3202
* ui: warn user when files are warming up from cold storage
* refactor: remove the PacksWarmer struct
It's easier to handle multiple handles in the backend directly, and it
may open the door to reducing the number of requests made to the backend
in the future.
2025-02-01 19:26:27 +01:00
|
|
|
"github.com/restic/restic/internal/feature"
|
2017-07-24 17:42:25 +02:00
|
|
|
"github.com/restic/restic/internal/restic"
|
2020-11-04 14:11:29 +01:00
|
|
|
"github.com/restic/restic/internal/ui/progress"
|
|
|
|
|
2020-09-20 00:45:11 +02:00
|
|
|
"golang.org/x/sync/errgroup"
|
2016-08-01 18:55:07 +02:00
|
|
|
)
|
|
|
|
|
2022-08-28 12:17:20 +02:00
|
|
|
type repackBlobSet interface {
|
|
|
|
Has(bh restic.BlobHandle) bool
|
|
|
|
Delete(bh restic.BlobHandle)
|
|
|
|
Len() int
|
|
|
|
}
|
|
|
|
|
feat(backends/s3): add warmup support before repacks and restores (#5173)
* feat(backends/s3): add warmup support before repacks and restores
This commit introduces basic support for transitioning pack files stored
in cold storage to hot storage on S3 and S3-compatible providers.
To prevent unexpected behavior for existing users, the feature is gated
behind new flags:
- `s3.enable-restore`: opt-in flag (defaults to false)
- `s3.restore-days`: number of days for the restored objects to remain
in hot storage (defaults to `7`)
- `s3.restore-timeout`: maximum time to wait for a single restoration
(default to `1 day`)
- `s3.restore-tier`: retrieval tier at which the restore will be
processed. (default to `Standard`)
As restoration times can be lengthy, this implementation preemptively
restores selected packs to prevent incessant restore-delays during
downloads. This is slightly sub-optimal as we could process packs
out-of-order (as soon as they're transitioned), but this would really
add too much complexity for a marginal gain in speed.
To maintain simplicity and prevent resources exhautions with lots of
packs, no new concurrency mechanisms or goroutines were added. This just
hooks gracefully into the existing routines.
**Limitations:**
- Tests against the backend were not written due to the lack of cold
storage class support in MinIO. Testing was done manually on
Scaleway's S3-compatible object storage. If necessary, we could
explore testing with LocalStack or mocks, though this requires further
discussion.
- Currently, this feature only warms up before restores and repacks
(prune/copy), as those are the two main use-cases I came across.
Support for other commands may be added in future iterations, as long
as affected packs can be calculated in advance.
- The feature is gated behind a new alpha `s3-restore` feature flag to
make it explicit that the feature is still wet behind the ears.
- There is no explicit user notification for ongoing pack restorations.
While I think it is not necessary because of the opt-in flag, showing
some notice may improve usability (but would probably require major
refactoring in the progress bar which I didn't want to start). Another
possibility would be to add a flag to send restores requests and fail
early.
See https://github.com/restic/restic/issues/3202
* ui: warn user when files are warming up from cold storage
* refactor: remove the PacksWarmer struct
It's easier to handle multiple handles in the backend directly, and it
may open the door to reducing the number of requests made to the backend
in the future.
2025-02-01 19:26:27 +01:00
|
|
|
type LogFunc func(msg string, args ...interface{})
|
|
|
|
|
2016-08-01 18:55:07 +02:00
|
|
|
// Repack takes a list of packs together with a list of blobs contained in
|
|
|
|
// these packs. Each pack is loaded and the blobs listed in keepBlobs is saved
|
2017-06-15 14:40:34 +02:00
|
|
|
// into a new pack. Returned is the list of obsolete packs which can then
|
|
|
|
// be removed.
|
2020-11-05 10:33:38 +01:00
|
|
|
//
|
|
|
|
// The map keepBlobs is modified by Repack, it is used to keep track of which
|
|
|
|
// blobs have been processed.
|
feat(backends/s3): add warmup support before repacks and restores (#5173)
* feat(backends/s3): add warmup support before repacks and restores
This commit introduces basic support for transitioning pack files stored
in cold storage to hot storage on S3 and S3-compatible providers.
To prevent unexpected behavior for existing users, the feature is gated
behind new flags:
- `s3.enable-restore`: opt-in flag (defaults to false)
- `s3.restore-days`: number of days for the restored objects to remain
in hot storage (defaults to `7`)
- `s3.restore-timeout`: maximum time to wait for a single restoration
(default to `1 day`)
- `s3.restore-tier`: retrieval tier at which the restore will be
processed. (default to `Standard`)
As restoration times can be lengthy, this implementation preemptively
restores selected packs to prevent incessant restore-delays during
downloads. This is slightly sub-optimal as we could process packs
out-of-order (as soon as they're transitioned), but this would really
add too much complexity for a marginal gain in speed.
To maintain simplicity and prevent resources exhautions with lots of
packs, no new concurrency mechanisms or goroutines were added. This just
hooks gracefully into the existing routines.
**Limitations:**
- Tests against the backend were not written due to the lack of cold
storage class support in MinIO. Testing was done manually on
Scaleway's S3-compatible object storage. If necessary, we could
explore testing with LocalStack or mocks, though this requires further
discussion.
- Currently, this feature only warms up before restores and repacks
(prune/copy), as those are the two main use-cases I came across.
Support for other commands may be added in future iterations, as long
as affected packs can be calculated in advance.
- The feature is gated behind a new alpha `s3-restore` feature flag to
make it explicit that the feature is still wet behind the ears.
- There is no explicit user notification for ongoing pack restorations.
While I think it is not necessary because of the opt-in flag, showing
some notice may improve usability (but would probably require major
refactoring in the progress bar which I didn't want to start). Another
possibility would be to add a flag to send restores requests and fail
early.
See https://github.com/restic/restic/issues/3202
* ui: warn user when files are warming up from cold storage
* refactor: remove the PacksWarmer struct
It's easier to handle multiple handles in the backend directly, and it
may open the door to reducing the number of requests made to the backend
in the future.
2025-02-01 19:26:27 +01:00
|
|
|
func Repack(
|
|
|
|
ctx context.Context,
|
|
|
|
repo restic.Repository,
|
|
|
|
dstRepo restic.Repository,
|
|
|
|
packs restic.IDSet,
|
|
|
|
keepBlobs repackBlobSet,
|
|
|
|
p *progress.Counter,
|
|
|
|
logf LogFunc,
|
|
|
|
) (obsoletePacks restic.IDSet, err error) {
|
2022-08-28 12:17:20 +02:00
|
|
|
debug.Log("repacking %d packs while keeping %d blobs", len(packs), keepBlobs.Len())
|
2016-08-01 18:55:07 +02:00
|
|
|
|
feat(backends/s3): add warmup support before repacks and restores (#5173)
* feat(backends/s3): add warmup support before repacks and restores
This commit introduces basic support for transitioning pack files stored
in cold storage to hot storage on S3 and S3-compatible providers.
To prevent unexpected behavior for existing users, the feature is gated
behind new flags:
- `s3.enable-restore`: opt-in flag (defaults to false)
- `s3.restore-days`: number of days for the restored objects to remain
in hot storage (defaults to `7`)
- `s3.restore-timeout`: maximum time to wait for a single restoration
(default to `1 day`)
- `s3.restore-tier`: retrieval tier at which the restore will be
processed. (default to `Standard`)
As restoration times can be lengthy, this implementation preemptively
restores selected packs to prevent incessant restore-delays during
downloads. This is slightly sub-optimal as we could process packs
out-of-order (as soon as they're transitioned), but this would really
add too much complexity for a marginal gain in speed.
To maintain simplicity and prevent resources exhautions with lots of
packs, no new concurrency mechanisms or goroutines were added. This just
hooks gracefully into the existing routines.
**Limitations:**
- Tests against the backend were not written due to the lack of cold
storage class support in MinIO. Testing was done manually on
Scaleway's S3-compatible object storage. If necessary, we could
explore testing with LocalStack or mocks, though this requires further
discussion.
- Currently, this feature only warms up before restores and repacks
(prune/copy), as those are the two main use-cases I came across.
Support for other commands may be added in future iterations, as long
as affected packs can be calculated in advance.
- The feature is gated behind a new alpha `s3-restore` feature flag to
make it explicit that the feature is still wet behind the ears.
- There is no explicit user notification for ongoing pack restorations.
While I think it is not necessary because of the opt-in flag, showing
some notice may improve usability (but would probably require major
refactoring in the progress bar which I didn't want to start). Another
possibility would be to add a flag to send restores requests and fail
early.
See https://github.com/restic/restic/issues/3202
* ui: warn user when files are warming up from cold storage
* refactor: remove the PacksWarmer struct
It's easier to handle multiple handles in the backend directly, and it
may open the door to reducing the number of requests made to the backend
in the future.
2025-02-01 19:26:27 +01:00
|
|
|
if logf == nil {
|
|
|
|
logf = func(_ string, _ ...interface{}) {}
|
|
|
|
}
|
|
|
|
|
2022-08-28 11:40:56 +02:00
|
|
|
if repo == dstRepo && dstRepo.Connections() < 2 {
|
2023-05-13 22:43:42 +02:00
|
|
|
return nil, errors.New("repack step requires a backend connection limit of at least two")
|
2022-04-23 11:28:18 +02:00
|
|
|
}
|
|
|
|
|
2020-11-05 17:04:42 +01:00
|
|
|
wg, wgCtx := errgroup.WithContext(ctx)
|
2017-01-23 17:05:30 +01:00
|
|
|
|
2021-08-07 22:52:05 +02:00
|
|
|
dstRepo.StartPackUploader(wgCtx, wg)
|
|
|
|
wg.Go(func() error {
|
|
|
|
var err error
|
feat(backends/s3): add warmup support before repacks and restores (#5173)
* feat(backends/s3): add warmup support before repacks and restores
This commit introduces basic support for transitioning pack files stored
in cold storage to hot storage on S3 and S3-compatible providers.
To prevent unexpected behavior for existing users, the feature is gated
behind new flags:
- `s3.enable-restore`: opt-in flag (defaults to false)
- `s3.restore-days`: number of days for the restored objects to remain
in hot storage (defaults to `7`)
- `s3.restore-timeout`: maximum time to wait for a single restoration
(default to `1 day`)
- `s3.restore-tier`: retrieval tier at which the restore will be
processed. (default to `Standard`)
As restoration times can be lengthy, this implementation preemptively
restores selected packs to prevent incessant restore-delays during
downloads. This is slightly sub-optimal as we could process packs
out-of-order (as soon as they're transitioned), but this would really
add too much complexity for a marginal gain in speed.
To maintain simplicity and prevent resources exhautions with lots of
packs, no new concurrency mechanisms or goroutines were added. This just
hooks gracefully into the existing routines.
**Limitations:**
- Tests against the backend were not written due to the lack of cold
storage class support in MinIO. Testing was done manually on
Scaleway's S3-compatible object storage. If necessary, we could
explore testing with LocalStack or mocks, though this requires further
discussion.
- Currently, this feature only warms up before restores and repacks
(prune/copy), as those are the two main use-cases I came across.
Support for other commands may be added in future iterations, as long
as affected packs can be calculated in advance.
- The feature is gated behind a new alpha `s3-restore` feature flag to
make it explicit that the feature is still wet behind the ears.
- There is no explicit user notification for ongoing pack restorations.
While I think it is not necessary because of the opt-in flag, showing
some notice may improve usability (but would probably require major
refactoring in the progress bar which I didn't want to start). Another
possibility would be to add a flag to send restores requests and fail
early.
See https://github.com/restic/restic/issues/3202
* ui: warn user when files are warming up from cold storage
* refactor: remove the PacksWarmer struct
It's easier to handle multiple handles in the backend directly, and it
may open the door to reducing the number of requests made to the backend
in the future.
2025-02-01 19:26:27 +01:00
|
|
|
obsoletePacks, err = repack(wgCtx, repo, dstRepo, packs, keepBlobs, p, logf)
|
2021-08-07 22:52:05 +02:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
|
|
|
|
if err := wg.Wait(); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return obsoletePacks, nil
|
|
|
|
}
|
|
|
|
|
feat(backends/s3): add warmup support before repacks and restores (#5173)
* feat(backends/s3): add warmup support before repacks and restores
This commit introduces basic support for transitioning pack files stored
in cold storage to hot storage on S3 and S3-compatible providers.
To prevent unexpected behavior for existing users, the feature is gated
behind new flags:
- `s3.enable-restore`: opt-in flag (defaults to false)
- `s3.restore-days`: number of days for the restored objects to remain
in hot storage (defaults to `7`)
- `s3.restore-timeout`: maximum time to wait for a single restoration
(default to `1 day`)
- `s3.restore-tier`: retrieval tier at which the restore will be
processed. (default to `Standard`)
As restoration times can be lengthy, this implementation preemptively
restores selected packs to prevent incessant restore-delays during
downloads. This is slightly sub-optimal as we could process packs
out-of-order (as soon as they're transitioned), but this would really
add too much complexity for a marginal gain in speed.
To maintain simplicity and prevent resources exhautions with lots of
packs, no new concurrency mechanisms or goroutines were added. This just
hooks gracefully into the existing routines.
**Limitations:**
- Tests against the backend were not written due to the lack of cold
storage class support in MinIO. Testing was done manually on
Scaleway's S3-compatible object storage. If necessary, we could
explore testing with LocalStack or mocks, though this requires further
discussion.
- Currently, this feature only warms up before restores and repacks
(prune/copy), as those are the two main use-cases I came across.
Support for other commands may be added in future iterations, as long
as affected packs can be calculated in advance.
- The feature is gated behind a new alpha `s3-restore` feature flag to
make it explicit that the feature is still wet behind the ears.
- There is no explicit user notification for ongoing pack restorations.
While I think it is not necessary because of the opt-in flag, showing
some notice may improve usability (but would probably require major
refactoring in the progress bar which I didn't want to start). Another
possibility would be to add a flag to send restores requests and fail
early.
See https://github.com/restic/restic/issues/3202
* ui: warn user when files are warming up from cold storage
* refactor: remove the PacksWarmer struct
It's easier to handle multiple handles in the backend directly, and it
may open the door to reducing the number of requests made to the backend
in the future.
2025-02-01 19:26:27 +01:00
|
|
|
func repack(
|
|
|
|
ctx context.Context,
|
|
|
|
repo restic.Repository,
|
|
|
|
dstRepo restic.Repository,
|
|
|
|
packs restic.IDSet,
|
|
|
|
keepBlobs repackBlobSet,
|
|
|
|
p *progress.Counter,
|
|
|
|
logf LogFunc,
|
|
|
|
) (obsoletePacks restic.IDSet, err error) {
|
2021-08-07 22:52:05 +02:00
|
|
|
wg, wgCtx := errgroup.WithContext(ctx)
|
|
|
|
|
feat(backends/s3): add warmup support before repacks and restores (#5173)
* feat(backends/s3): add warmup support before repacks and restores
This commit introduces basic support for transitioning pack files stored
in cold storage to hot storage on S3 and S3-compatible providers.
To prevent unexpected behavior for existing users, the feature is gated
behind new flags:
- `s3.enable-restore`: opt-in flag (defaults to false)
- `s3.restore-days`: number of days for the restored objects to remain
in hot storage (defaults to `7`)
- `s3.restore-timeout`: maximum time to wait for a single restoration
(default to `1 day`)
- `s3.restore-tier`: retrieval tier at which the restore will be
processed. (default to `Standard`)
As restoration times can be lengthy, this implementation preemptively
restores selected packs to prevent incessant restore-delays during
downloads. This is slightly sub-optimal as we could process packs
out-of-order (as soon as they're transitioned), but this would really
add too much complexity for a marginal gain in speed.
To maintain simplicity and prevent resources exhautions with lots of
packs, no new concurrency mechanisms or goroutines were added. This just
hooks gracefully into the existing routines.
**Limitations:**
- Tests against the backend were not written due to the lack of cold
storage class support in MinIO. Testing was done manually on
Scaleway's S3-compatible object storage. If necessary, we could
explore testing with LocalStack or mocks, though this requires further
discussion.
- Currently, this feature only warms up before restores and repacks
(prune/copy), as those are the two main use-cases I came across.
Support for other commands may be added in future iterations, as long
as affected packs can be calculated in advance.
- The feature is gated behind a new alpha `s3-restore` feature flag to
make it explicit that the feature is still wet behind the ears.
- There is no explicit user notification for ongoing pack restorations.
While I think it is not necessary because of the opt-in flag, showing
some notice may improve usability (but would probably require major
refactoring in the progress bar which I didn't want to start). Another
possibility would be to add a flag to send restores requests and fail
early.
See https://github.com/restic/restic/issues/3202
* ui: warn user when files are warming up from cold storage
* refactor: remove the PacksWarmer struct
It's easier to handle multiple handles in the backend directly, and it
may open the door to reducing the number of requests made to the backend
in the future.
2025-02-01 19:26:27 +01:00
|
|
|
if feature.Flag.Enabled(feature.S3Restore) {
|
|
|
|
job, err := repo.StartWarmup(ctx, packs)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if job.HandleCount() != 0 {
|
|
|
|
logf("warming up %d packs from cold storage, this may take a while...", job.HandleCount())
|
|
|
|
if err := job.Wait(ctx); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-07 22:52:05 +02:00
|
|
|
var keepMutex sync.Mutex
|
2021-08-20 10:10:35 +02:00
|
|
|
downloadQueue := make(chan restic.PackBlobs)
|
2020-09-20 00:45:11 +02:00
|
|
|
wg.Go(func() error {
|
|
|
|
defer close(downloadQueue)
|
2024-05-19 12:41:56 +02:00
|
|
|
for pbs := range repo.ListPacksFromIndex(wgCtx, packs) {
|
2021-08-20 10:10:35 +02:00
|
|
|
var packBlobs []restic.Blob
|
|
|
|
keepMutex.Lock()
|
|
|
|
// filter out unnecessary blobs
|
|
|
|
for _, entry := range pbs.Blobs {
|
|
|
|
h := restic.BlobHandle{ID: entry.ID, Type: entry.Type}
|
|
|
|
if keepBlobs.Has(h) {
|
|
|
|
packBlobs = append(packBlobs, entry)
|
|
|
|
}
|
2016-08-01 18:55:07 +02:00
|
|
|
}
|
2021-08-20 10:10:35 +02:00
|
|
|
keepMutex.Unlock()
|
2016-08-01 18:55:07 +02:00
|
|
|
|
2020-09-20 00:45:11 +02:00
|
|
|
select {
|
2021-08-20 10:10:35 +02:00
|
|
|
case downloadQueue <- restic.PackBlobs{PackID: pbs.PackID, Blobs: packBlobs}:
|
2020-11-05 17:04:42 +01:00
|
|
|
case <-wgCtx.Done():
|
|
|
|
return wgCtx.Err()
|
2017-01-23 17:05:30 +01:00
|
|
|
}
|
2020-09-20 00:45:11 +02:00
|
|
|
}
|
2024-03-30 00:19:58 +01:00
|
|
|
return wgCtx.Err()
|
2020-09-20 00:45:11 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
worker := func() error {
|
2021-08-20 10:10:35 +02:00
|
|
|
for t := range downloadQueue {
|
2023-12-31 12:07:19 +01:00
|
|
|
err := repo.LoadBlobsFromPack(wgCtx, t.PackID, t.Blobs, func(blob restic.BlobHandle, buf []byte, err error) error {
|
2020-09-20 00:45:11 +02:00
|
|
|
if err != nil {
|
2023-12-31 15:27:36 +01:00
|
|
|
// a required blob couldn't be retrieved
|
|
|
|
return err
|
2020-09-20 00:45:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
keepMutex.Lock()
|
|
|
|
// recheck whether some other worker was faster
|
2021-08-20 10:10:35 +02:00
|
|
|
shouldKeep := keepBlobs.Has(blob)
|
2020-09-20 00:45:11 +02:00
|
|
|
if shouldKeep {
|
2021-08-20 10:10:35 +02:00
|
|
|
keepBlobs.Delete(blob)
|
2020-09-20 00:45:11 +02:00
|
|
|
}
|
|
|
|
keepMutex.Unlock()
|
|
|
|
|
|
|
|
if !shouldKeep {
|
2021-08-20 10:10:35 +02:00
|
|
|
return nil
|
2020-09-20 00:45:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// We do want to save already saved blobs!
|
2022-05-01 14:26:57 +02:00
|
|
|
_, _, _, err = dstRepo.SaveBlob(wgCtx, blob.Type, buf, blob.ID, true)
|
2020-09-20 00:45:11 +02:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-08-20 10:10:35 +02:00
|
|
|
debug.Log(" saved blob %v", blob.ID)
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2020-09-20 00:45:11 +02:00
|
|
|
}
|
2020-11-04 14:11:29 +01:00
|
|
|
p.Add(1)
|
2016-08-01 18:55:07 +02:00
|
|
|
}
|
2020-09-20 00:45:11 +02:00
|
|
|
return nil
|
|
|
|
}
|
2017-01-23 17:05:30 +01:00
|
|
|
|
2021-08-08 00:38:17 +02:00
|
|
|
// as packs are streamed the concurrency is limited by IO
|
|
|
|
// reduce by one to ensure that uploading is always possible
|
|
|
|
repackWorkerCount := int(repo.Connections() - 1)
|
2022-08-28 11:40:31 +02:00
|
|
|
if repo != dstRepo {
|
|
|
|
// no need to share the upload and download connections for different repositories
|
|
|
|
repackWorkerCount = int(repo.Connections())
|
|
|
|
}
|
2021-08-08 00:38:17 +02:00
|
|
|
for i := 0; i < repackWorkerCount; i++ {
|
2020-09-20 00:45:11 +02:00
|
|
|
wg.Go(worker)
|
|
|
|
}
|
2017-01-23 17:05:30 +01:00
|
|
|
|
2020-09-20 00:45:11 +02:00
|
|
|
if err := wg.Wait(); err != nil {
|
|
|
|
return nil, err
|
2016-08-01 18:55:07 +02:00
|
|
|
}
|
|
|
|
|
2021-09-12 00:03:41 +02:00
|
|
|
if err := dstRepo.Flush(ctx); err != nil {
|
2017-06-15 14:40:34 +02:00
|
|
|
return nil, err
|
2016-08-01 18:55:07 +02:00
|
|
|
}
|
|
|
|
|
2017-06-15 14:40:34 +02:00
|
|
|
return packs, nil
|
2016-08-01 18:55:07 +02:00
|
|
|
}
|