Closed richardpark-msft closed 1 year ago
This would decouple us from any changes to the azblob package, allowing us to use the unchanging subset of features from Azure Storage.
Unfortunately, this doesn't work. The problem is that the Event Hubs package exports a Credential
interface that embeds azblob.Credential
from the azblob package. That interface requires a private marker method:
// azblob.Credential
type Credential interface {
pipeline.Factory
// can't be implemented by someone external this package
credentialMarker()
}
This is our normal use case:
// (azblob here is: "github.com/Azure/azure-storage-blob-go/azblob"
cred, err := azblob.NewSharedKeyCredential("foo", "Zm9vCg==")
leaser, err := NewStorageLeaserCheckpointer(cred, ts.AccountName, "someContainer", ts.Env)
Yields this compile error:
/storage.go:110:76: cannot use credential (variable of type Credential) as type "github.com/Azure/azure-event-hubs-go/v3/internal/azure-storage-blob-go/azblob".Credential in argument to azblobVendor.NewPipeline:
Credential does not implement "github.com/Azure/azure-event-hubs-go/v3/internal/azure-storage-blob-go/azblob".Credential (missing credentialMarker method)
Which makes sense - a struct can't implement a private function that can be "seen" in a separate package.
Ah! I didn't go far enough - @jhendrixMSFT solved this by creating a pipeline from the new package, and passing that to the older package which works beautifully.
We're using an older version of azblob (v0.6.0) but this can limit clients attempting to upgrade to newer versions of azblob.
azblob isn't GA yet, which means interface breaking changes are still possible, even if we do upgrade. The current compile error with 0.15.0 (latest as of this writing). It looks like it's just a simple expansion of arguments:
We're discussing solutions, but filing the issue to track any discussion.