-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
26 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,16 +101,6 @@ func (c *Client) DeleteBlob(ctx context.Context, uri string) error { | |
return nil | ||
} | ||
|
||
func (c *Client) DeleteBlobs(ctx context.Context, uris []string) error { | ||
// Implement parallel delete if slow - not prematurely optimizing. | ||
for i, uri := range uris { | ||
if err := c.DeleteBlob(ctx, uri); err != nil { | ||
return fmt.Errorf("deleting blob %d/%d: %w", i, len(uris), err) | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
// SignedUploadURL returns a URL that is allowed to upload to the given URI. | ||
// See https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/[email protected]/sas#example-package-UserDelegationSAS | ||
func (c *Client) SignedUploadURL(ctx context.Context, uri string) (string, error) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package pactasrv | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
) | ||
|
||
type blobDeleter interface { | ||
DeleteBlob(ctx context.Context, uri string) error | ||
} | ||
|
||
func deleteBlobs(ctx context.Context, bd blobDeleter, uris []string) error { | ||
// Implement parallel delete if slow - not prematurely optimizing. | ||
for i, uri := range uris { | ||
if err := bd.DeleteBlob(ctx, uri); err != nil { | ||
return fmt.Errorf("deleting blob %d/%d: %w", i, len(uris), err) | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func (s *Server) deleteBlobs(ctx context.Context, uris []string) error { | ||
return deleteBlobs(ctx, s.Blob, uris) | ||
} |