repository: enforce that SaveBlob is called within WithBlobUploader

This is achieved by removing SaveBlob from the public API and only
returning it via a uploader object that is passed in by
WithBlobUploader.
This commit is contained in:
Michael Eischer committed 2025-10-12 18:26:26 +02:00
1 parent ac4642b479
commit c6e33c3954
21 files changed
+172 -143

No files matched your search

+2 -2
View File
@@ -107,10 +107,10 @@ func TestEmptyLoadTree(t *testing.T) {
tree := data.NewTree(0)
var id restic.ID
rtest.OK(t, repo.WithBlobUploader(context.TODO(), func(ctx context.Context) error {
rtest.OK(t, repo.WithBlobUploader(context.TODO(), func(ctx context.Context, uploader restic.BlobSaver) error {
var err error
// save tree
id, err = data.SaveTree(ctx, repo, tree)
id, err = data.SaveTree(ctx, uploader, tree)
return err
}))