Bigtable createInstance Public Api#1086
Conversation
|
@mohitq The tests are failing. They need to pass before a review can happen. |
| use Google\Auth\FetchAuthTokenInterface; | ||
| use Google\Cloud\Core\ClientTrait; | ||
| use Google\Cloud\Core\Exception\GoogleException; | ||
| use Google\Cloud\Core\Int64; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| use Google\Cloud\Core\LongRunning\LROTrait; | ||
| use Google\Cloud\Bigtable\Admin\V2\BigtableInstanceAdminClient as InstanceAdminClient; | ||
| use Google\Cloud\Bigtable\Connection\Grpc; | ||
| use Google\Cloud\Bigtable\Connection\LongRunningConnection; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@jdpedrie, do you have any idea why the builds failed? |
|
@sduskis appveyor can be a bit flaky when installing dependencies. I've restarted the build there. There's no action that is required to fix that so long as the restarted build successfully gets through the install step. On travis, there was a segfault, which can sometimes be fixed with a re-run, but more often indicates an underlying problem which can be somewhat difficult to debug. I'm re-running that job. If it fails again I'll see if I can uncover the problem. |
| * $ pecl install protobuf | ||
| * ``` | ||
| * | ||
| * Example |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @type string $pageToken A previously-returned page token used to | ||
| * resume the loading of results from a specific point. | ||
| * } | ||
| * @return ItemIterator<InstanceConfiguration> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| use Google\Cloud\Core\LongRunning\LROTrait; | ||
| use Google\Cloud\Bigtable\Admin\V2\BigtableInstanceAdminClient as InstanceAdminClient; | ||
| use Google\Cloud\Bigtable\Connection\Grpc; | ||
| use Google\Cloud\Bigtable\Connection\LongRunningConnection; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@mohitq Did you want to include tests in this PR or as a follow up? |
|
@dwsupplee Is it possible this PR without tests? If yes, then i will create a new PR for tests. |
| * @method resumeOperation() { | ||
| * Resume a Long Running Operation | ||
| * | ||
| * Example |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| /** | ||
| * @param ConnectionInterface $connection | ||
| */ | ||
| public function __construct(ConnectionInterface $connection) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@mohitq I would recommend to write tests alongside the code, so that if the tests reveal any issues you don't need to circle back again. However, if you would prefer to add them later I don't have a major issue with that. |
|
@mohitq looks like you've got some snippet test failures. Don't forget, you can run all the tests except the system tests locally using # unit tests
$ vendor/bin/phpunit
# snippet tests
$ vendor/bin/phpunit -c phpunit-snippets.xml.distIf you want to run just the bigtable tests, use the # run bigtable unit tests
$ vendor/bin/phpunit --group=bigtable`
# run bigtable snippet tests
$ vendor/bin/phpunit -c phpunit-snippets.xml.dist --group=bigtableApologies if I'm reiterating information you already know. Just want to be sure. :) |
|
@jdpedrie and @dwsupplee I think that we're ready for a review. |
| $id = $value['clusterId']; | ||
| $clusters[$id] = [ | ||
| 'location' => InstanceAdminClient::locationName($this->projectId, $value['locationId']), | ||
| 'serveNodes' => isset($value['nodeCount']) ? $value['nodeCount'] : 1, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * string $clusterId | ||
| * string $locationId | ||
| * int $nodeCount **Defaults to** `1`. | ||
| * int $storageType **Defaults to** `0`. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * Configuration options | ||
| * | ||
| * @type string $displayName **Defaults to** the value of $name. | ||
| * @type int $instanceType **Defaults to** `0`. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * requests specifically for authentication. | ||
| * @type FetchAuthTokenInterface $credentialsFetcher A credentials | ||
| * fetcher instance. | ||
| * @type callable $httpHandler A handler used to deliver Psr7 requests. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Updated as per comment. |
| * | ||
| * @type string $displayName **Defaults to** the value of $instanceId. | ||
| * @type int $instanceType Possible values include `Instance_Type::PRODUCTION` | ||
| * and `Instance_Type::DEVELOPMENT`. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@jdpedrie Updated all comment changes. |
| * | ||
| * @type string $projectId The project ID from the Google Developer's | ||
| * Console. | ||
| * @type array $authCacheOptions Cache configuration options. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @type string $projectId The project ID from the Google Developer's | ||
| * Console. | ||
| * @type array $authCacheOptions Cache configuration options. | ||
| * @type callable $authHttpHandler A handler used to deliver Psr7 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
jdpedrie
left a comment
There was a problem hiding this comment.
Client is looking very good. I found a couple of style issues and a couple of suggested improvements, but this is getting close.
The new classes need unit test coverage. I'd prefer if it we could test as we go, rather than trying to play catch up later. If you feel strongly otherwise, please let me know and we'll talk about it.
| * **Defaults to**`Instance_Type::TYPE_UNSPECIFIED`. | ||
| * @type array $labels For more information, see | ||
| * [Using labels to organize Google Cloud Platform resources](https://cloudplatform.googleblog.com/2015/10/using-labels-to-organize-Google-Cloud-Platform-resources.html). | ||
| * @type array $clusters [] { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * } | ||
| * @return array | ||
| */ | ||
| private function clustersArray($args) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| $clusters[$id] = [ | ||
| 'location' => InstanceAdminClient::locationName($this->projectId, $value['locationId']), | ||
| 'serveNodes' => isset($value['serveNodes']) ? $value['serveNodes'] : '', | ||
| 'defaultStorageType' => isset($value['storageType'])?$value['storageType'] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @type array $authCacheOptions Cache configuration options. | ||
| * @type callable $authHttpHandler A handler used to deliver Psr7 | ||
| * requests specifically for authentication. | ||
| * @type FetchAuthTokenInterface $credentialsFetcher A credentials |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| namespace Google\Cloud\Bigtable; | ||
|
|
||
| use Google\Cloud\Core\ArrayTrait; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @type int $retries Number of retries for a failed request. | ||
| * **Defaults to** `3`. | ||
| * } | ||
| * @throws GoogleException If the gRPC extension is not enabled. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * ``` | ||
| * | ||
| * @codingStandardsIgnoreStart | ||
| * @see https://cloud.google.com/bigtable/docs/reference/admin/rpc/google.bigtable.admin.v2#CreateInstanceRequest CreateInstanceRequest |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * | ||
| * @type string $displayName **Defaults to** the value of $instanceId. | ||
| * @type int $instanceType Possible values include `Instance_Type::PRODUCTION` and `Instance_Type::DEVELOPMENT`. | ||
| * **Defaults to**`Instance_Type::TYPE_UNSPECIFIED`. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| public function exists(array $options = []) | ||
| { | ||
| try { | ||
| $this->reload($options = []); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * Configuration options | ||
| * | ||
| * @type string $displayName **Defaults to** the value of $instanceId. | ||
| * @type int $instanceType Possible values include `Instance_Type::PRODUCTION` and `Instance_Type::DEVELOPMENT`. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| */ | ||
| private function fullyQualifiedInstanceName($instanceId, $projectId) | ||
| { | ||
| try { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| use Google\Cloud\Bigtable\Admin\V2\BigtableInstanceAdminClient as InstanceAdminClient; | ||
| use Google\Cloud\Bigtable\BigtableClient; | ||
| use Google\Cloud\Bigtable\Instance; | ||
| use Google\Cloud\Bigtable\Connection\ConnectionInterface; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
|
|
||
| /** | ||
| * @group bigtabladmin |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
0c63349 to
c1ed412
Compare
|
This PR got larger than it needed to be, and still has some points of contention. I'd propose that we break up this PR into the following PRs:
How does this sound? |
| * int $storageType The storage media type for persisting Bigtable data. Possible values include `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_SSD` and `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_HDD`. | ||
| * **Defaults to** `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_UNSPECIFIED`. | ||
| * }] | ||
| * Ex. [ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @param array $args | ||
| */ | ||
| public function getOperation(array $args); | ||
| /** |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| /** | ||
| * @group bigtable | ||
| * @group bigtable-admin |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| $clustersArray = []; | ||
| foreach ($clusters as $value) { | ||
| $id = $value['clusterId']; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| private function cluster($args) | ||
| { | ||
| $cluster = []; | ||
| $cluster['location'] = InstanceAdminClient::locationName($this->projectId, $args['locationId']); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Sounds good to me @sduskis |
|
Long running connection PR was submitted: #1148 |
|
#1148 is merged, if we could please rebase now. |
| * $instance = $bigtable->instance('my-instance'); | ||
| * ``` | ||
| * | ||
| * @method resumeOperation() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * @param array $info [optional] The operation data. | ||
| * @return LongRunningOperation | ||
| * } | ||
| * @method longRunningOperations() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
The |
|
Thank you @sduskis. I hope you don't mind, I edited your comment to reflect the status of the items on the PR. It looks like we just need this last round of reviews to be addressed. From there, it would be great if @jdpedrie / @fiboknacky don't mind doing a final pass to make sure everything looks good to them as well. |
fiboknacky
left a comment
There was a problem hiding this comment.
I'm quite confused now.
We have #1158 open for similar changes.
Shall we continue reviewing this PR or move to do on that PR instead?
| * int $storageType The storage media type for persisting Bigtable data. Possible values include `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_SSD` and `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_HDD`. | ||
| * **Defaults to** `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_UNSPECIFIED`. | ||
| * }] | ||
| * Ex. [ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Closing this in favor of #1158 |
Review Public API