| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 269546f commit 28fab80
26 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | 19 | import static com.google.common.base.Preconditions.checkArgument; | |
| 20 | 20 | ||
| 21 | + import com.google.api.gax.longrunning.OperationFuture; | ||
| 21 | 22 | import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata; | |
| 22 | 23 | ||
| 23 | 24 | /** | |
@@ -51,7 +52,7 @@ public Database reload() throws SpannerException { | |||
| 51 | 52 | * one. This must be unique within a database abd must be a valid identifier | |
| 52 | 53 | * [a-zA-Z][a-zA-Z0-9_]*. | |
| 53 | 54 | */ | |
| 54 | - public Operation<Void, UpdateDatabaseDdlMetadata> updateDdl( | ||
| 55 | + public OperationFuture<Void, UpdateDatabaseDdlMetadata> updateDdl( | ||
| 55 | 56 | Iterable<String> statements, String operationId) throws SpannerException { | |
| 56 | 57 | return dbClient.updateDatabaseDdl(instance(), database(), statements, operationId); | |
| 57 | 58 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | 17 | package com.google.cloud.spanner; | |
| 18 | 18 | ||
| 19 | + import com.google.api.gax.longrunning.OperationFuture; | ||
| 19 | 20 | import com.google.api.gax.paging.Page; | |
| 20 | 21 | import com.google.cloud.spanner.Options.ListOption; | |
| 21 | 22 | import com.google.spanner.admin.database.v1.CreateDatabaseMetadata; | |
@@ -29,7 +30,8 @@ public interface DatabaseAdminClient { | |||
| 29 | 30 | * Creates a new database in a Cloud Spanner instance. | |
| 30 | 31 | * | |
| 31 | 32 | * <p>Example to create database. | |
| 32 | - * <pre> {@code | ||
| 33 | + * | ||
| 34 | + * <pre>{@code | ||
| 33 | 35 | * String instanceId = my_instance_id; | |
| 34 | 36 | * String databaseId = my_database_id; | |
| 35 | 37 | * Operation<Database, CreateDatabaseMetadata> op = dbAdminClient | |
@@ -58,19 +60,19 @@ public interface DatabaseAdminClient { | |||
| 58 | 60 | * @param statements DDL statements to run while creating the database, for example {@code CREATE | |
| 59 | 61 | * TABLE MyTable ( ... )}. This should not include {@code CREATE DATABASE} statement. | |
| 60 | 62 | */ | |
| 61 | - Operation<Database, CreateDatabaseMetadata> createDatabase( | ||
| 63 | + OperationFuture<Database, CreateDatabaseMetadata> createDatabase( | ||
| 62 | 64 | String instanceId, String databaseId, Iterable<String> statements) throws SpannerException; | |
| 63 | 65 | ||
| 64 | - /** | ||
| 65 | - * Gets the current state of a Cloud Spanner database. | ||
| 66 | + /** | ||
| 67 | + * Gets the current state of a Cloud Spanner database. | ||
| 66 | 68 | * | |
| 67 | 69 | * <p>Example to getDatabase. | |
| 68 | - * <pre> {@code | ||
| 70 | + * | ||
| 71 | + * <pre>{@code | ||
| 69 | 72 | * String instanceId = my_instance_id; | |
| 70 | 73 | * String databaseId = my_database_id; | |
| 71 | 74 | * Database db = dbAdminClient.getDatabase(instanceId, databaseId); | |
| 72 | 75 | * }</pre> | |
| 73 | - * | ||
| 74 | 76 | */ | |
| 75 | 77 | Database getDatabase(String instanceId, String databaseId) throws SpannerException; | |
| 76 | 78 | ||
@@ -84,7 +86,8 @@ Operation<Database, CreateDatabaseMetadata> createDatabase( | |||
| 84 | 86 | * fails, all subsequent statements in the batch are automatically cancelled. | |
| 85 | 87 | * | |
| 86 | 88 | * <p>Example to update the database DDL. | |
| 87 | - * <pre> {@code | ||
| 89 | + * | ||
| 90 | + * <pre>{@code | ||
| 88 | 91 | * String instanceId = my_instance_id; | |
| 89 | 92 | * String databaseId = my_database_id; | |
| 90 | 93 | * dbAdminClient.updateDatabaseDdl(instanceId, | |
@@ -97,7 +100,7 @@ Operation<Database, CreateDatabaseMetadata> createDatabase( | |||
| 97 | 100 | * one. This must be unique within a database abd must be a valid identifier | |
| 98 | 101 | * [a-zA-Z][a-zA-Z0-9_]*. | |
| 99 | 102 | */ | |
| 100 | - Operation<Void, UpdateDatabaseDdlMetadata> updateDatabaseDdl( | ||
| 103 | + OperationFuture<Void, UpdateDatabaseDdlMetadata> updateDatabaseDdl( | ||
| 101 | 104 | String instanceId, | |
| 102 | 105 | String databaseId, | |
| 103 | 106 | Iterable<String> statements, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | 17 | package com.google.cloud.spanner; | |
| 18 | 18 | ||
| 19 | + import com.google.api.gax.longrunning.OperationFuture; | ||
| 19 | 20 | import com.google.api.gax.paging.Page; | |
| 20 | 21 | import com.google.spanner.admin.database.v1.CreateDatabaseMetadata; | |
| 21 | 22 | import com.google.spanner.admin.instance.v1.UpdateInstanceMetadata; | |
@@ -104,7 +105,7 @@ public void delete() { | |||
| 104 | 105 | instanceClient.deleteInstance(instanceId()); | |
| 105 | 106 | } | |
| 106 | 107 | ||
| 107 | - public Operation<Instance, UpdateInstanceMetadata> update( | ||
| 108 | + public OperationFuture<Instance, UpdateInstanceMetadata> update( | ||
| 108 | 109 | InstanceInfo.InstanceField... fieldsToUpdate) { | |
| 109 | 110 | return instanceClient.updateInstance(this, fieldsToUpdate); | |
| 110 | 111 | } | |
@@ -125,7 +126,7 @@ public Database getDatabase(String databaseId) { | |||
| 125 | 126 | * @param statements DDL statements to run while creating the database, for example {@code CREATE | |
| 126 | 127 | * TABLE MyTable ( ... )}. This should not include {@code CREATE DATABASE} statement. | |
| 127 | 128 | */ | |
| 128 | - public Operation<Database, CreateDatabaseMetadata> createDatabase( | ||
| 129 | + public OperationFuture<Database, CreateDatabaseMetadata> createDatabase( | ||
| 129 | 130 | String databaseId, Iterable<String> statements) throws SpannerException { | |
| 130 | 131 | return dbClient.createDatabase(instanceId(), databaseId, statements); | |
| 131 | 132 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | 17 | package com.google.cloud.spanner; | |
| 18 | 18 | ||
| 19 | + import com.google.api.gax.longrunning.OperationFuture; | ||
| 19 | 20 | import com.google.api.gax.paging.Page; | |
| 20 | 21 | import com.google.cloud.spanner.Options.ListOption; | |
| 21 | 22 | import com.google.spanner.admin.instance.v1.CreateInstanceMetadata; | |
@@ -51,29 +52,30 @@ public interface InstanceAdminClient { | |||
| 51 | 52 | * upon completion of this request: | |
| 52 | 53 | * | |
| 53 | 54 | * <ul> | |
| 54 | - * <li> The instance is readable via the API, with all requested attributes but no allocated | ||
| 55 | + * <li>The instance is readable via the API, with all requested attributes but no allocated | ||
| 55 | 56 | * resources. | |
| 56 | - * <li> Its state is {@code CREATING}. | ||
| 57 | + * <li>Its state is {@code CREATING}. | ||
| 57 | 58 | * </ul> | |
| 58 | 59 | * | |
| 59 | 60 | * Until completion of the returned operation: | |
| 60 | 61 | * | |
| 61 | 62 | * <ul> | |
| 62 | - * <li> Cancelling the operation renders the instance immediately unreadable via the API. | ||
| 63 | - * <li> The instance can be deleted. | ||
| 64 | - * <li> All other attempts to modify the instance are rejected. | ||
| 63 | + * <li>Cancelling the operation renders the instance immediately unreadable via the API. | ||
| 64 | + * <li>The instance can be deleted. | ||
| 65 | + * <li>All other attempts to modify the instance are rejected. | ||
| 65 | 66 | * </ul> | |
| 66 | 67 | * | |
| 67 | 68 | * Upon completion of the returned operation: | |
| 68 | 69 | * | |
| 69 | 70 | * <ul> | |
| 70 | - * <li> Billing for all successfully-allocated resources begins (some types may have lower than | ||
| 71 | + * <li>Billing for all successfully-allocated resources begins (some types may have lower than | ||
| 71 | 72 | * the requested levels). | |
| 72 | - * <li> Databases can be created in the instance. | ||
| 73 | - * <li> The instance's allocated resource levels are readable via the | ||
| 73 | + * <li>Databases can be created in the instance. | ||
| 74 | + * <li>The instance's allocated resource levels are readable via the | ||
| 74 | 75 | * </ul> | |
| 75 | 76 | * | |
| 76 | 77 | * <!--SNIPPET instance_admin_client_create_instance--> | |
| 78 | + * | ||
| 77 | 79 | * <pre>{@code | |
| 78 | 80 | * final String instanceId = my_instance_id; | |
| 79 | 81 | * final String configId = my_config_id; | |
@@ -88,9 +90,10 @@ public interface InstanceAdminClient { | |||
| 88 | 90 | * .build()); | |
| 89 | 91 | * op.waitFor(); | |
| 90 | 92 | * }</pre> | |
| 93 | + * | ||
| 91 | 94 | * <!--SNIPPET instance_admin_client_create_instance--> | |
| 92 | 95 | */ | |
| 93 | - Operation<Instance, CreateInstanceMetadata> createInstance(InstanceInfo instance) | ||
| 96 | + OperationFuture<Instance, CreateInstanceMetadata> createInstance(InstanceInfo instance) | ||
| 94 | 97 | throws SpannerException; | |
| 95 | 98 | ||
| 96 | 99 | /** Gets an instance. */ | |
@@ -142,31 +145,32 @@ Operation<Instance, CreateInstanceMetadata> createInstance(InstanceInfo instance | |||
| 142 | 145 | * <p>Immediately upon completion of this request: | |
| 143 | 146 | * | |
| 144 | 147 | * <ul> | |
| 145 | - * <li> For resource types for which a decrease in the instance's allocation has been requested, | ||
| 148 | + * <li>For resource types for which a decrease in the instance's allocation has been requested, | ||
| 146 | 149 | * billing is based on the newly-requested level. | |
| 147 | 150 | * </ul> | |
| 148 | 151 | * | |
| 149 | 152 | * Until completion of the returned operation: | |
| 150 | 153 | * | |
| 151 | 154 | * <ul> | |
| 152 | - * <li> Cancelling the operation sets its metadata's | ||
| 155 | + * <li>Cancelling the operation sets its metadata's | ||
| 153 | 156 | * [cancel_time][UpdateInstanceMetadata.cancel_time], and begins restoring resources to | |
| 154 | 157 | * their pre-request values. The operation is guaranteed to succeed at undoing all resource | |
| 155 | 158 | * changes, after which point it terminates with a `CANCELLED` status. | |
| 156 | - * <li> All other attempts to modify the instance are rejected. | ||
| 157 | - * <li> Reading the instance via the API continues to give the pre-request resource levels. | ||
| 159 | + * <li>All other attempts to modify the instance are rejected. | ||
| 160 | + * <li>Reading the instance via the API continues to give the pre-request resource levels. | ||
| 158 | 161 | * </ul> | |
| 159 | 162 | * | |
| 160 | 163 | * Upon completion of the returned operation: | |
| 161 | 164 | * | |
| 162 | 165 | * <ul> | |
| 163 | - * <li> Billing begins for all successfully-allocated resources (some types may have lower than | ||
| 166 | + * <li>Billing begins for all successfully-allocated resources (some types may have lower than | ||
| 164 | 167 | * the requested levels). | |
| 165 | - * <li> All newly-reserved resources are available for serving the instance's tables. | ||
| 166 | - * <li> The instance's new resource levels are readable via the API. | ||
| 168 | + * <li>All newly-reserved resources are available for serving the instance's tables. | ||
| 169 | + * <li>The instance's new resource levels are readable via the API. | ||
| 167 | 170 | * </ul> | |
| 168 | 171 | * | |
| 169 | 172 | * <!--SNIPPET instance_admin_client_update_instance--> | |
| 173 | + * | ||
| 170 | 174 | * <pre>{@code | |
| 171 | 175 | * Instance instance = my_instance; | |
| 172 | 176 | * final String clientProject = my_client_project; | |
@@ -184,9 +188,10 @@ Operation<Instance, CreateInstanceMetadata> createInstance(InstanceInfo instance | |||
| 184 | 188 | * instanceAdminClient.updateInstance(toUpdate, InstanceInfo.InstanceField.DISPLAY_NAME); | |
| 185 | 189 | * op.waitFor().getResult(); | |
| 186 | 190 | * }</pre> | |
| 191 | + * | ||
| 187 | 192 | * <!--SNIPPET instance_admin_client_update_instance--> | |
| 188 | 193 | */ | |
| 189 | - Operation<Instance, UpdateInstanceMetadata> updateInstance( | ||
| 194 | + OperationFuture<Instance, UpdateInstanceMetadata> updateInstance( | ||
| 190 | 195 | InstanceInfo instance, InstanceInfo.InstanceField... fieldsToUpdate); | |
| 191 | 196 | ||
| 192 | 197 | /** Returns a builder for {@code Instance} object with the given id. */ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments