public class GapicSpannerRpc implements SpannerRpc
Implementation of Cloud Spanner remote calls using Gapic libraries.
Static Fields
DEFAULT_USER_AGENT
public static final String DEFAULT_USER_AGENT
Field Value
Static Methods
create(SpannerOptions options)
public static GapicSpannerRpc create(SpannerOptions options)
Parameter
Returns
Constructors
GapicSpannerRpc(SpannerOptions options)
public GapicSpannerRpc(SpannerOptions options)
Parameter
Methods
asyncDeleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
public ApiFuture<Empty> asyncDeleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
Parameters
Returns
batchCreateSessions(String databaseName, int sessionCount, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
public List<Session> batchCreateSessions(String databaseName, int sessionCount, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
beginTransaction(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options)
public Transaction beginTransaction(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
beginTransactionAsync(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options)
public ApiFuture<Transaction> beginTransactionAsync(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
cancelOperation(String name)
public void cancelOperation(String name)
Cancels the specified long-running operation.
Parameter
Exceptions
commit(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
public CommitResponse commit(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
commitAsync(CommitRequest request, Map<SpannerRpc.Option,?> options)
public ApiFuture<CommitResponse> commitAsync(CommitRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
createBackup(Backup backupInfo)
public OperationFuture<Backup,CreateBackupMetadata> createBackup(Backup backupInfo)
Parameter
Name | Description |
backupInfo | Backup
|
Returns
Exceptions
createDatabase(String instanceName, String createDatabaseStatement, Iterable<String> additionalStatements, Database databaseInfo)
public OperationFuture<Database,CreateDatabaseMetadata> createDatabase(String instanceName, String createDatabaseStatement, Iterable<String> additionalStatements, Database databaseInfo)
Parameters
Returns
Exceptions
createInstance(String parent, String instanceId, Instance instance)
public OperationFuture<Instance,CreateInstanceMetadata> createInstance(String parent, String instanceId, Instance instance)
Parameters
Returns
Exceptions
createSession(String databaseName, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
public Session createSession(String databaseName, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
deleteBackup(String backupName)
public void deleteBackup(String backupName)
Deletes a pending or completed backup.
Parameter
Name | Description |
backupName | String
|
deleteInstance(String instanceName)
public void deleteInstance(String instanceName)
Parameter
Name | Description |
instanceName | String
|
Exceptions
deleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
public void deleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
Parameters
Exceptions
dropDatabase(String databaseName)
public void dropDatabase(String databaseName)
Parameter
Name | Description |
databaseName | String
|
Exceptions
executeBatchDml(ExecuteBatchDmlRequest request, Map<SpannerRpc.Option,?> options)
public ExecuteBatchDmlResponse executeBatchDml(ExecuteBatchDmlRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeBatchDmlAsync(ExecuteBatchDmlRequest request, Map<SpannerRpc.Option,?> options)
public ApiFuture<ExecuteBatchDmlResponse> executeBatchDmlAsync(ExecuteBatchDmlRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executePartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
public ResultSet executePartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeQuery(ExecuteSqlRequest request, SpannerRpc.ResultStreamConsumer consumer, Map<SpannerRpc.Option,?> options)
public SpannerRpc.StreamingCall executeQuery(ExecuteSqlRequest request, SpannerRpc.ResultStreamConsumer consumer, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeQuery(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
public ResultSet executeQuery(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeQueryAsync(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
public ApiFuture<ResultSet> executeQueryAsync(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeStreamingPartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options, Duration timeout)
public ServerStream<PartialResultSet> executeStreamingPartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options, Duration timeout)
Parameters
Returns
getBackup(String backupName)
public Backup getBackup(String backupName)
Gets the backup with the specified name.
Parameter
Name | Description |
backupName | String
|
Returns
Exceptions
getDatabase(String databaseName)
public Database getDatabase(String databaseName)
Parameter
Name | Description |
databaseName | String
|
Returns
Exceptions
getDatabaseAdminIAMPolicy(String resource)
public Policy getDatabaseAdminIAMPolicy(String resource)
Parameter
Returns
Type | Description |
com.google.iam.v1.Policy | |
getDatabaseDdl(String databaseName)
public List<String> getDatabaseDdl(String databaseName)
Parameter
Name | Description |
databaseName | String
|
Returns
Exceptions
getInstance(String instanceName)
public Instance getInstance(String instanceName)
Parameter
Name | Description |
instanceName | String
|
Returns
Exceptions
getInstanceAdminIAMPolicy(String resource)
public Policy getInstanceAdminIAMPolicy(String resource)
Parameter
Returns
Type | Description |
com.google.iam.v1.Policy | |
getInstanceConfig(String instanceConfigName)
public InstanceConfig getInstanceConfig(String instanceConfigName)
Parameter
Name | Description |
instanceConfigName | String
|
Returns
Exceptions
getOperation(String name)
public Operation getOperation(String name)
Retrieves a long running operation.
Parameter
Returns
Exceptions
getPartitionedDmlRetrySettings()
public RetrySettings getPartitionedDmlRetrySettings()
Returns
isClosed()
public boolean isClosed()
Returns
listBackupOperations(String instanceName, int pageSize, String filter, String pageToken)
public SpannerRpc.Paginated<Operation> listBackupOperations(String instanceName, int pageSize, String filter, String pageToken)
List all long-running backup operations on the given instance.
Parameters
Returns
listBackups(String instanceName, int pageSize, String filter, String pageToken)
public SpannerRpc.Paginated<Backup> listBackups(String instanceName, int pageSize, String filter, String pageToken)
Lists the backups in the specified instance.
Parameters
Returns
Exceptions
listDatabaseOperations(String instanceName, int pageSize, String filter, String pageToken)
public SpannerRpc.Paginated<Operation> listDatabaseOperations(String instanceName, int pageSize, String filter, String pageToken)
Parameters
Returns
listDatabases(String instanceName, int pageSize, String pageToken)
public SpannerRpc.Paginated<Database> listDatabases(String instanceName, int pageSize, String pageToken)
Parameters
Returns
Exceptions
listInstanceConfigs(int pageSize, String pageToken)
public SpannerRpc.Paginated<InstanceConfig> listInstanceConfigs(int pageSize, String pageToken)
Parameters
Returns
Exceptions
listInstances(int pageSize, String pageToken, String filter)
public SpannerRpc.Paginated<Instance> listInstances(int pageSize, String pageToken, String filter)
Parameters
Returns
Exceptions
partitionQuery(PartitionQueryRequest request, Map<SpannerRpc.Option,?> options)
public PartitionResponse partitionQuery(PartitionQueryRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
partitionRead(PartitionReadRequest request, Map<SpannerRpc.Option,?> options)
public PartitionResponse partitionRead(PartitionReadRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
read(ReadRequest request, SpannerRpc.ResultStreamConsumer consumer, Map<SpannerRpc.Option,?> options)
public SpannerRpc.StreamingCall read(ReadRequest request, SpannerRpc.ResultStreamConsumer consumer, Map<SpannerRpc.Option,?> options)
Parameters
Returns
restoreDatabase(Restore restore)
public OperationFuture<Database,RestoreDatabaseMetadata> restoreDatabase(Restore restore)
Restore a backup into the given database.
Parameter
Returns
rollback(RollbackRequest request, Map<SpannerRpc.Option,?> options)
public void rollback(RollbackRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Exceptions
rollbackAsync(RollbackRequest request, Map<SpannerRpc.Option,?> options)
public ApiFuture<Empty> rollbackAsync(RollbackRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
setDatabaseAdminIAMPolicy(String resource, Policy policy)
public Policy setDatabaseAdminIAMPolicy(String resource, Policy policy)
Updates the IAM policy for the given resource using the DatabaseAdminStub. It is highly
recommended to first get the current policy and base the updated policy on the returned policy.
See Policy.Builder#setEtag(com.google.protobuf.ByteString) for information on the
recommended read-modify-write cycle.
Parameters
Name | Description |
resource | String
|
policy | com.google.iam.v1.Policy
|
Returns
Type | Description |
com.google.iam.v1.Policy | |
setInstanceAdminIAMPolicy(String resource, Policy policy)
public Policy setInstanceAdminIAMPolicy(String resource, Policy policy)
Updates the IAM policy for the given resource using the InstanceAdminStub. It is highly
recommended to first get the current policy and base the updated policy on the returned policy.
See Policy.Builder#setEtag(com.google.protobuf.ByteString) for information on the
recommended read-modify-write cycle.
Parameters
Name | Description |
resource | String
|
policy | com.google.iam.v1.Policy
|
Returns
Type | Description |
com.google.iam.v1.Policy | |
shutdown()
shutdownNow()
public void shutdownNow()
testDatabaseAdminIAMPermissions(String resource, Iterable<String> permissions)
public TestIamPermissionsResponse testDatabaseAdminIAMPermissions(String resource, Iterable<String> permissions)
Parameters
Returns
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse | |
testInstanceAdminIAMPermissions(String resource, Iterable<String> permissions)
public TestIamPermissionsResponse testInstanceAdminIAMPermissions(String resource, Iterable<String> permissions)
Parameters
Returns
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse | |
updateBackup(Backup backup, FieldMask updateMask)
public Backup updateBackup(Backup backup, FieldMask updateMask)
Updates the specified backup. The only supported field for updates is expireTime.
Parameters
Returns
updateDatabaseDdl(String databaseName, Iterable<String> updateDatabaseStatements, String updateId)
public OperationFuture<Empty,UpdateDatabaseDdlMetadata> updateDatabaseDdl(String databaseName, Iterable<String> updateDatabaseStatements, String updateId)
If the update database ddl operation returns an ALREADY_EXISTS error, meaning the operation id
used is already in flight, this method will simply resume the original operation. The returned
future will be completed when the original operation finishes.
This mechanism is necessary, because the update database ddl can be retried. If a retryable
failure occurs, the backend has already started processing the update database ddl operation
with the given id and the library issues a retry, an ALREADY_EXISTS error will be returned. If
we were to bubble this error up, it would be confusing for the caller, who used originally
called the method with a new operation id.
Parameters
Returns
Exceptions
updateInstance(Instance instance, FieldMask fieldMask)
public OperationFuture<Instance,UpdateInstanceMetadata> updateInstance(Instance instance, FieldMask fieldMask)
Parameters
Returns
Exceptions