2015-02-03 23:29:00 +00:00
|
|
|
package azure
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
|
2015-06-11 22:30:18 +00:00
|
|
|
azure "github.com/Azure/azure-sdk-for-go/storage"
|
2015-02-03 23:29:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// azureBlockStorage is adaptor between azure.BlobStorageClient and
|
|
|
|
// blockStorage interface.
|
|
|
|
type azureBlockStorage struct {
|
|
|
|
azure.BlobStorageClient
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *azureBlockStorage) GetSectionReader(container, blob string, start, length int64) (io.ReadCloser, error) {
|
|
|
|
return b.BlobStorageClient.GetBlobRange(container, blob, fmt.Sprintf("%v-%v", start, start+length-1))
|
|
|
|
}
|
|
|
|
|
|
|
|
func newAzureBlockStorage(b azure.BlobStorageClient) azureBlockStorage {
|
|
|
|
a := azureBlockStorage{}
|
|
|
|
a.BlobStorageClient = b
|
|
|
|
return a
|
|
|
|
}
|