(ctx context.Context, name string)
| 502 | } |
| 503 | |
| 504 | func (rw *Azure) readAll(ctx context.Context, name string) ([]byte, azcore.ETag, error) { |
| 505 | blobClient := rw.hedgedContainerClient.NewBlockBlobClient(name) |
| 506 | |
| 507 | props, err := blobClient.GetProperties(ctx, &blob.GetPropertiesOptions{}) |
| 508 | if err != nil { |
| 509 | return nil, "", err |
| 510 | } |
| 511 | |
| 512 | if props.ContentLength == nil { |
| 513 | return nil, "", fmt.Errorf("expected content length but got none for blob %s: %w", name, err) |
| 514 | } |
| 515 | |
| 516 | destBuffer := make([]byte, *props.ContentLength) |
| 517 | |
| 518 | if _, err := blobClient.DownloadBuffer(context.Background(), destBuffer, &blob.DownloadBufferOptions{ |
| 519 | Range: blob.HTTPRange{ |
| 520 | Offset: 0, |
| 521 | Count: *props.ContentLength, |
| 522 | }, |
| 523 | BlockSize: blob.DefaultDownloadBlockSize, |
| 524 | Concurrency: maxParallelism, |
| 525 | RetryReaderOptionsPerBlock: blob.RetryReaderOptions{ |
| 526 | MaxRetries: maxRetries, |
| 527 | }, |
| 528 | }); err != nil { |
| 529 | return nil, "", err |
| 530 | } |
| 531 | |
| 532 | var etag azcore.ETag |
| 533 | if props.ETag != nil { |
| 534 | etag = *props.ETag |
| 535 | } |
| 536 | |
| 537 | return destBuffer, etag, nil |
| 538 | } |
no outgoing calls
no test coverage detected