repository: streamPack: separate requests for gap larger than 1MB

With most cloud providers, traffic is much more expensive than API
calls. Thus slightly bias streamPack towards a bit more API calls in
exchange for slightly less traffic.
This commit is contained in:
Michael Eischer 2024-04-22 21:12:20 +02:00
parent cf700d8794
commit 20d8eed400
1 changed files with 2 additions and 2 deletions

View File

@ -941,8 +941,8 @@ func (r *Repository) SaveBlob(ctx context.Context, t restic.BlobType, buf []byte
type backendLoadFn func(ctx context.Context, h backend.Handle, length int, offset int64, fn func(rd io.Reader) error) error
type loadBlobFn func(ctx context.Context, t restic.BlobType, id restic.ID, buf []byte) ([]byte, error)
// Skip sections with more than 4MB unused blobs
const maxUnusedRange = 4 * 1024 * 1024
// Skip sections with more than 1MB unused blobs
const maxUnusedRange = 1 * 1024 * 1024
// LoadBlobsFromPack loads the listed blobs from the specified pack file. The plaintext blob is passed to
// the handleBlobFn callback or an error if decryption failed or the blob hash does not match.