From 1973fc1ecc076614cd1ad5dad6b264dc15c50a4d Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 29 Oct 2020 12:03:41 +0000 Subject: [PATCH] azureblob: update lib from v0.10.0 to v0.11.0 and fix API breakage See: https://github.com/Azure/azure-storage-blob-go/issues/226 --- backend/azureblob/azureblob.go | 18 +++++++++--------- go.mod | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go index 2d895cf1f..e62eea111 100644 --- a/backend/azureblob/azureblob.go +++ b/backend/azureblob/azureblob.go @@ -524,7 +524,7 @@ func (f *Fs) cntURL(container string) (containerURL *azblob.ContainerURL) { // Return an Object from a path // // If it can't be found it returns the error fs.ErrorObjectNotFound. -func (f *Fs) newObjectWithInfo(remote string, info *azblob.BlobItem) (fs.Object, error) { +func (f *Fs) newObjectWithInfo(remote string, info *azblob.BlobItemInternal) (fs.Object, error) { o := &Object{ fs: f, remote: remote, @@ -581,7 +581,7 @@ func isDirectoryMarker(size int64, metadata azblob.Metadata, remote string) bool } // listFn is called from list to handle an object -type listFn func(remote string, object *azblob.BlobItem, isDirectory bool) error +type listFn func(remote string, object *azblob.BlobItemInternal, isDirectory bool) error // list lists the objects into the function supplied from // the container and root supplied @@ -680,7 +680,7 @@ func (f *Fs) list(ctx context.Context, container, directory, prefix string, addC } // Convert a list item into a DirEntry -func (f *Fs) itemToDirEntry(remote string, object *azblob.BlobItem, isDirectory bool) (fs.DirEntry, error) { +func (f *Fs) itemToDirEntry(remote string, object *azblob.BlobItemInternal, isDirectory bool) (fs.DirEntry, error) { if isDirectory { d := fs.NewDir(remote, time.Time{}) return d, nil @@ -694,7 +694,7 @@ func (f *Fs) itemToDirEntry(remote string, object *azblob.BlobItem, isDirectory // listDir lists a single directory func (f *Fs) listDir(ctx context.Context, container, directory, prefix string, addContainer bool) (entries fs.DirEntries, err error) { - err = f.list(ctx, container, directory, prefix, addContainer, false, f.opt.ListChunkSize, func(remote string, object *azblob.BlobItem, isDirectory bool) error { + err = f.list(ctx, container, directory, prefix, addContainer, false, f.opt.ListChunkSize, func(remote string, object *azblob.BlobItemInternal, isDirectory bool) error { entry, err := f.itemToDirEntry(remote, object, isDirectory) if err != nil { return err @@ -775,7 +775,7 @@ func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) ( container, directory := f.split(dir) list := walk.NewListRHelper(callback) listR := func(container, directory, prefix string, addContainer bool) error { - return f.list(ctx, container, directory, prefix, addContainer, true, f.opt.ListChunkSize, func(remote string, object *azblob.BlobItem, isDirectory bool) error { + return f.list(ctx, container, directory, prefix, addContainer, true, f.opt.ListChunkSize, func(remote string, object *azblob.BlobItemInternal, isDirectory bool) error { entry, err := f.itemToDirEntry(remote, object, isDirectory) if err != nil { return err @@ -903,7 +903,7 @@ func (f *Fs) makeContainer(ctx context.Context, container string) error { // isEmpty checks to see if a given (container, directory) is empty and returns an error if not func (f *Fs) isEmpty(ctx context.Context, container, directory string) (err error) { empty := true - err = f.list(ctx, container, directory, f.rootDirectory, f.rootContainer == "", true, 1, func(remote string, object *azblob.BlobItem, isDirectory bool) error { + err = f.list(ctx, container, directory, f.rootDirectory, f.rootContainer == "", true, 1, func(remote string, object *azblob.BlobItemInternal, isDirectory bool) error { empty = false return nil }) @@ -1008,7 +1008,7 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, var startCopy *azblob.BlobStartCopyFromURLResponse err = f.pacer.Call(func() (bool, error) { - startCopy, err = dstBlobURL.StartCopyFromURL(ctx, *source, nil, azblob.ModifiedAccessConditions{}, options) + startCopy, err = dstBlobURL.StartCopyFromURL(ctx, *source, nil, azblob.ModifiedAccessConditions{}, options, azblob.AccessTierType(f.opt.AccessTier), nil) return f.shouldRetry(err) }) if err != nil { @@ -1123,7 +1123,7 @@ func (o *Object) decodeMetaDataFromPropertiesResponse(info *azblob.BlobGetProper return nil } -func (o *Object) decodeMetaDataFromBlob(info *azblob.BlobItem) (err error) { +func (o *Object) decodeMetaDataFromBlob(info *azblob.BlobItemInternal) (err error) { metadata := info.Metadata size := *info.Properties.ContentLength if isDirectoryMarker(size, metadata, o.remote) { @@ -1424,7 +1424,7 @@ func (o *Object) uploadMultipart(ctx context.Context, in io.Reader, size int64, // Finalise the upload session err = o.fs.pacer.Call(func() (bool, error) { - _, err := blockBlobURL.CommitBlockList(ctx, blocks, *httpHeaders, o.meta, azblob.BlobAccessConditions{}) + _, err := blockBlobURL.CommitBlockList(ctx, blocks, *httpHeaders, o.meta, azblob.BlobAccessConditions{}, azblob.AccessTierType(o.fs.opt.AccessTier), nil) return o.fs.shouldRetry(err) }) if err != nil { diff --git a/go.mod b/go.mod index f1b90525f..3c50c2fbe 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.14 require ( bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05 cloud.google.com/go v0.70.0 // indirect - github.com/Azure/azure-pipeline-go v0.2.2 - github.com/Azure/azure-storage-blob-go v0.10.0 + github.com/Azure/azure-pipeline-go v0.2.3 + github.com/Azure/azure-storage-blob-go v0.11.0 github.com/Unknwon/goconfig v0.0.0-20200908083735-df7de6a44db8 github.com/a8m/tree v0.0.0-20201026183218-fce18e2a750e github.com/aalpar/deheap v0.0.0-20200318053559-9a0c2883bd56