Trying to add support for azure and gcp using go-cloud

I’m trying to add support for gcp and azure using google’s go-cloud library.

The patch is available here add-go-cloud.patch · GitHub

However, it’s not working yet because gocloud.dev does not implement io.Seek unfortunately but it does support something which I think is similar called NewRangeReader.

I was wondering if you could give me any pointer in what would be the best way to make this work and if you could have a look at the patch please. It would be nice as it would give us support for gcp, azure, s3 and whichever cloud it supports in the future.

Thanks for reading this.

@patcito I won’t create a “gocloud” objectstorage implementation since gocloud is just a library to unify the API to access different object storages.

For example the current s3 objectstorage is implemented using the minio go client. But it could be reimplemented using the amazon s3 go api or gocloud.

So the right thing to do will be to create two new GCP and Azure objectstorages implementations that will share the same code using the gocloud api. And also the s3 objectstorage should use the same implementation instead of the minio go client.
Obviously to do this we should be sure that the gocloud api provides all the features and doesn’t introduce new bugs or regressions.

However, it’s not working yet because gocloud.dev does not implement io.Seek unfortunately but it does support something which I think is similar called NewRangeReader.

The minio go client automatically implements io.Seek. When using the gocloud API you should implement it by yourself:

  • The first call to objectstorage.ReadObject will return an object that saves the Reader return from a call to NewRangeReader with a starting position of 0 and end of -1.
  • Implement Seek on the above object to make it a ReadSeekCloser. When Seek is called you should close the current Reader provided by the call to NewRangeReader and create a new one using the provided starting offset/whence.