Skip to content
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

Adds adapter for Google Cloud Client Library #427

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

PanzerLlama
Copy link

@PanzerLlama PanzerLlama commented Sep 9, 2016

Hi,

Adapter for http://googlecloudplatform.github.io/google-cloud-php/


This change is Reviewable

@PanzerLlama PanzerLlama reopened this Mar 14, 2017
@akerouanton
Copy link
Contributor

Hello @PanzerLlama,

What's the difference with the current GoogleCloudStorage?

@PanzerLlama
Copy link
Author

PanzerLlama commented Mar 14, 2017

Hi @NiR- ,

Google Cloud Client Library is just an alternative to GCS PHP API lib. Quote from the homepage (https://googlecloudplatform.github.io/google-cloud-php/#/):

"What is the relationship between the Google Cloud Client Library and the Google APIs PHP Client?

[...] The Google Cloud Client Library is built specifically for the Google Cloud Platform and is the recommended way to integrate Google Cloud APIs into your PHP applications. If your application requires both Google Cloud Platform and other Google APIs, the 2 libraries may be used by your application."

Personally I found the documentation for GCCL to be clearer and easier to work with, also this lib is actively developed by Google programmers contrary to the GCS which is generated automatically. In a nutshell - Google recommends GCCL if the app is developed in single language (PHP).

More details on the differences can be found here: https://cloud.google.com/storage/docs/json_api/v1/libraries

@akerouanton
Copy link
Contributor

@PanzerLlama Could you update the existing adapter rather than creating a new one?

@akerouanton akerouanton added this to the v1.0 milestone Mar 28, 2017
@PanzerLlama
Copy link
Author

PanzerLlama commented Mar 30, 2017

@NiR- - not sure if this works out well since these are 2 different libraries sitting on top of the Google Cloud API so adding support to the existing adapter would generate a lot of extra code in it. Also the constructor of the existing adapter requires \Google_Service_Storage and my adapter uses \Google\Cloud\Storage\StorageClient so looks like merging will create BC break. (?) I think since these are 2 different libraries it feels right to have 2 different adapters.

edit sometime later: ok, the BC break note is not true. I think I don't get the pros of merging these 2 into one adapter but if you think it's vital I will come into line :) (won't be that quick though).

composer.json Outdated
@@ -38,7 +38,8 @@
"phpunit/phpunit": "3.7.*",
"microsoft/windowsazure": "dev-master",
"mikey179/vfsStream": "~1.2.0",
"league/flysystem": "~1.0"
"league/flysystem": "~1.0",
"google/cloud": ">=0.20.1"
Copy link

@AntoineLelaisant AntoineLelaisant Mar 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dep should be added in the suggest section, because there is no need to install this library if you don't need to use your GoogleCloud adapter.

We opened an RFC to find a better solution to this problematic #466

One more point: shouldn't we require 'google/cloud-storage' instead of the entire 'google/cloud' library (as it's recommended here https://github.com/GoogleCloudPlatform/google-cloud-php/tree/master/src/Storage in the README.md section) ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed & fixed.

@AntoineLelaisant
Copy link

Hi @PanzerLlama Sorry for not responding for a long time but we currently having a big internal discussion about the future of Gaufrette (see #466 and #464). The main idea for now is to split adapters into meta-packages and limit the amount of adapters we have to maintain.

At the moment we already have a GoogleCloudStorage adapter based on https://github.com/google/google-api-php-client and we don't want to maintain two adapters for the same functionality at the end. Moreover we could not simply replace the GoogleCloudStorage adapter by yours because it would bring BC breaks.

By the way, your implementation seems cool and it would be a waste to simply throw it away.

So I see two solutions:

  1. Let this PR pending until the release of Gaufrette v1.0
    -> Deprecate the actual GoogleCloudStorage in Gaufrette v0.4
    -> Replace it by your adapter in v1.0

  2. Create a separated repo for your adapter (so not maintained by KnpLabs)
    We would be happy to mention it in the Gaufrette's README.md

@akerouanton
Copy link
Contributor

@PanzerLlama Indeed, seems to be a bad idea to reuse the current Adapter.

@AntoineLelaisant I would go for the first option, but without even waiting the v1.0 release. If we want to deprecate the old adapter in the v0.4 release we need this new adapter to be available.

@PanzerLlama
Copy link
Author

Hi @AntoineLelaisant - let's do what you think is best. I'll be away now for around a week but will follow the feedback.

{
$this->isBucket();
$object = $this->bucket->object($this->computePath($key));
$object->delete();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as previous comment.


$object = $this->bucket->object($this->computePath($key));

$properties = array_replace_recursive(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why replace_recursive? A simple array_replace should do the work, no?

*
* @author Lech Buszczynski <[email protected]>
*/
interface ResourcesSupporter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this one? What's the purpose of such interface?

@PanzerLlama
Copy link
Author

@NiR- Will do the fixes sometime next week. Thanks for the feedback.

akerouanton pushed a commit to akerouanton/Gaufrette that referenced this pull request Jun 8, 2017
It should be re-added when KnpLabs#427 is merged.
@akerouanton
Copy link
Contributor

@PanzerLlama Is it ready to be merged?

@PanzerLlama
Copy link
Author

@NiR- yes, done all requested changed (may improve docs later but for now I am done)

@bwegrzyn
Copy link

Can't wait for this adapter to be merged. 👍

Thanks for the hard work.

@Matan
Copy link

Matan commented Sep 27, 2017

Hi! Any update on this? Would be great if we could get this merged in. 👍

@PanzerLlama
Copy link
Author

@NiR- I am not sure why this still is labelled "needs rework" - I am happy to do changes but as far as I can see I did the updates that were requested.

@PanzerLlama
Copy link
Author

For anyone who wants to use this adapter (workaround):

  1. copy this file into your adapters directory: https://github.com/PanzerLlama/Gaufrette/blob/master/src/Gaufrette/Adapter/GoogleCloudClientStorage.php

  2. read: https://github.com/PanzerLlama/Gaufrette/blob/master/doc/adapters/google-cloud-client-storage.md

You can also copy the test but its not required. I use this adapter for well over a year w/o issues.

athos7933 pushed a commit to athos7933/Gaufrette that referenced this pull request Sep 13, 2018
It should be re-added when KnpLabs#427 is merged.
athos7933 pushed a commit to athos7933/Gaufrette that referenced this pull request Sep 13, 2018
It should be re-added when KnpLabs#427 is merged.
@PedroTroller PedroTroller self-assigned this Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants