Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Fix refactored API compatibility problem #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions upload/metadata/metaData.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ func NewMetaDataFromLocalVHD(vhdPath string) (*MetaData, error) {
// MetaData associated with the blob it returns nil value for MetaData
//
func NewMetadataFromBlob(blobClient storage.BlobStorageClient, containerName, blobName string) (*MetaData, error) {
allMetadata, err := blobClient.GetBlobMetadata(containerName, blobName)
if err != nil {
blob := blobClient.GetContainerReference(containerName).GetBlobReference(blobName)
if err := blob.GetMetadata(nil); err != nil {
return nil, fmt.Errorf("NewMetadataFromBlob, failed to fetch blob metadata: %v", err)
}
m, ok := allMetadata[metaDataKey]
m, ok := blob.Metadata[metaDataKey]
if !ok {
return nil, nil
}
Expand Down
15 changes: 8 additions & 7 deletions upload/upload.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package upload

import (
"bytes"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -86,13 +87,13 @@ L:
//
req := &concurrent.Request{
Work: func() error {
err := cxt.BlobServiceClient.PutPage(cxt.ContainerName,
cxt.BlobName,
dataWithRange.Range.Start,
dataWithRange.Range.End,
storage.PageWriteTypeUpdate,
dataWithRange.Data,
nil)
container := cxt.BlobServiceClient.GetContainerReference(cxt.ContainerName)
blob := container.GetBlobReference(cxt.BlobName)

err := blob.WriteRange(storage.BlobRange{
Start: uint64(dataWithRange.Range.Start),
End: uint64(dataWithRange.Range.End),
}, bytes.NewReader(dataWithRange.Data), nil)
if err == nil {
uploadProgress.ReportBytesProcessedCount(dataWithRange.Range.Length())
}
Expand Down