本文整理汇总了Golang中github.com/Azure/azure-sdk-for-go/storage.BlobStorageClient.GetBlobURL方法的典型用法代码示例。如果您正苦于以下问题:Golang BlobStorageClient.GetBlobURL方法的具体用法?Golang BlobStorageClient.GetBlobURL怎么用?Golang BlobStorageClient.GetBlobURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Azure/azure-sdk-for-go/storage.BlobStorageClient
的用法示例。
在下文中一共展示了BlobStorageClient.GetBlobURL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: validate
func validate(cli storage.BlobStorageClient, blob string, startByte, endByte int64, data []byte) error {
url := cli.GetBlobURL(cnt, blob)
reader, err := cli.GetBlob(cnt, blob)
if err != nil {
return fmt.Errorf("Failed to read from %s: %s\n", url, err.Error())
}
defer reader.Close()
dataRead, err := ioutil.ReadAll(reader)
if err != nil {
return fmt.Errorf("Failed to read from %s: %s\n", url, err.Error())
}
same := true
for i := startByte; i <= endByte; i++ {
if data[i] != dataRead[i] {
same = false
}
}
if !same {
return fmt.Errorf("Failed to read data properly from %s: %s\n", url, err.Error())
}
return nil
}
示例2: clearPage
func clearPage(cli storage.BlobStorageClient, name string, startByte, endByte int64) error {
if err := cli.PutPage(cnt, name, startByte, endByte, storage.PageWriteTypeClear, nil); err != nil {
url := cli.GetBlobURL(cnt, name)
fmt.Printf("Failed to clear pages of %s: %s\n", url, err.Error())
return err
}
return nil
}
示例3: writePage
func writePage(cli storage.BlobStorageClient, name string, startByte, endByte int64, chunk []byte) error {
if err := cli.PutPage(cnt, name, startByte, endByte, storage.PageWriteTypeUpdate, chunk); err != nil {
url := cli.GetBlobURL(cnt, name)
fmt.Printf("Failed to write pages to %s: %s\n", url, err.Error())
return err
}
return nil
}