-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
files.get
interface differs significantly between Fog::Storage::GoogleJson and Fog::Storage::GoogleXML
#291
Comments
files.get
interface differs significantly between Fog::Storage::GoogleJson and Fog::Storage::GoogleXML
I'll get a fix for handling that block correctly. get_object doesn't actually expect download_dest to be passed in (it's set to a temporary buffer), and the file value is returned as object[:body]. Also, @icco to confirm but I don't think in general the GoogleXML library is being supported anymore. It certainly was not upgraded. |
GoogleXML is still suported, it just uses a completely different backend. GoogleJSON supports https://cloud.google.com/storage/docs/json_api/v1/ and GoogleXML supports https://cloud.google.com/storage/docs/xml-api/overview |
Also @tcdowney could you provide an example of how you're calling the code? We'd love to add it to our tests or examples / use it to debug. |
Yeah, it'd be helpful to see the block you're passing in. @icco it looks like the block was removed in this pass. I think it was reasonable since the block is excon related. If we want to keep it compatible, we'll probably have to wrap the excon response block in an IO stream to pass to the Google request (here). Does that sound reasonable? |
@emilymye I'm confused, so GoogleXML uses excon, but GoogleJSON just uses the google api client. The main thing is that https://github.com/fog/fog-google/blob/master/lib/fog/storage/google_json/models/files.rb#L34-L41, https://github.com/fog/fog-google/blob/master/lib/fog/storage/google_xml/models/files.rb#L55-L67, and https://github.com/fog/fog-aws/blob/master/lib/fog/aws/models/storage/files.rb#L59-L77 act similarly from an input standpoint. The requests can be wildly different. |
@tcdowney Sorry, I just saw the example in the original comment. @icco I assumed the passed-in block was the format expected by Excon - each of these file.get methods just pass through the block to the underlying request and for AWS/GoogleXML/the previous google-api-client calls, it gets set as the Excon |
@emilymye Yeah. Can we turn a streaming block and transform it into an IO Stream? |
We would basically be creating an IO stream and reading it into the block, and then letting @tcdowney write it back to an IO stream in this case. So, it is POSSIBLE - I just hate it a little. 😭 |
Wow thanks for getting a PR out so quickly @emilymye!! We'll try it out on Monday. 👍 |
@tcdowney I merged into master. I'll do a release once you sign off on it. |
We're having some difficulty testing We call it with the
Is it possible for it to keep the same interface as the
|
@tcdowney totally, sorry, we tried to keep the model interfaces the same. Problem here is it won't actually do anything. We can take in a generic object and ignore the options, but because google severely changed their bucket api, it will act much differently: https://cloud.google.com/storage/docs/json_api/v1/buckets/get |
Yeah that's interesting... I think for the interface it's helpful if it can accept what the other implementations allow though I agree it's a little unfortunate that it doesn't actually do anything and is silent about it. 🤷♂️ I don't think the Openstack implementation works with |
One last thing we've seen so far is that I'm not very familiar with the difference between the two implementations, but it seems like we could alias Thanks! |
Yup, what you're saying makes sense. My original goal in this was to keep models pretty close, but was okay with changes when proposed mainly because we really have no idea how people use this library. Glad we can make some minor tweaks and keep if working for you. Thanks for reporting @tcdowney. |
@icco we're still seeing:
We made the method names symbols inline in our code here and it works: Thanks for your quick responses! |
Submitted a PR for the above issue: #295 |
Awesome, thanks. Merged. I've been meaning to write a bot that assigns all PRs to me... Would solve the missing PRs that don't mention me or @fog/fog-google |
Thanks, can confirm that we can now successfully call |
Awesome. Released 1.1.0 with this fix. |
We were trying to consume the new JSON API functionality provided in the latest version (
1.0.1
) of this gem.Calls to
files.get
that use the newGoogleJson
version ofget_object
are not working with our existing code that passes thefiles.get
method a block that we use to write the file out to disk. You can see an example of this here.In the old
GoogleXML
implementation of this, there is apparent handling of the passed block, whereas in the the newGoogleJson
implementation it appears to just return the object directly regardless of whether a block was provided in the call to files.get.Comments in the new code imply that we need to call this method differently and supply a
download_dest
option.Unfortunately, this seems like an inconsistency between the two implementations and makes it more difficult to interoperate with
fog-aws
which functions similarly to theGoogleXML
version. It also makes it very difficult to interoperate with both theGoogleXML
andGoogleJson
versions themselves since it's not clear to consumers which codepath the gem will end up using. In our application we allow users to provide arbitrary fog connection config so we want to be able to rely on a standardized interface.Thanks!
Tim Downey && @ericpromislow
The text was updated successfully, but these errors were encountered: