public interface SpannerRpc extends ServiceRpc
Abstracts remote calls to the Cloud Spanner service. Typically end-consumer code will never use
this interface; it's main purpose is to abstract the implementation of the public Cloud Spanner
API from the underlying transport mechanism.
Each SpannerRPC
instance is bound to a particular project and set of authorization
credentials.
The interface is currently defined in terms of the generated HTTP client model classes. This
is purely for expedience; a future version of this interface is likely to be independent of
transport to allow switching between gRPC and HTTP.
Implements
com.google.cloud.ServiceRpc
Methods
asyncDeleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
public abstract ApiFuture<Empty> asyncDeleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
batchCreateSessions(String databaseName, int sessionCount, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
public abstract 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 abstract Transaction beginTransaction(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
beginTransactionAsync(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options)
public abstract ApiFuture<Transaction> beginTransactionAsync(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
cancelOperation(String name)
public abstract void cancelOperation(String name)
Cancels the specified long-running operation.
Parameter
Exceptions
commit(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
public abstract CommitResponse commit(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
commitAsync(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
public abstract ApiFuture<CommitResponse> commitAsync(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
Parameters
Returns
copyBackup(BackupId sourceBackupId, Backup destinationBackup)
public default OperationFuture<Backup,CopyBackupMetadata> copyBackup(BackupId sourceBackupId, Backup destinationBackup)
Creates a copy backup from the source backup specified.
Parameters
Name | Description |
sourceBackupId | BackupId
|
destinationBackup | Backup
the backup to create. The instance, database, and expireTime fields of
the backup must be filled. It may also optionally have an encryption config set. If no
encryption config has been set, the new backup will use the same encryption config as the
source backup.
|
Returns
createBackup(Backup backupInfo)
public abstract OperationFuture<Backup,CreateBackupMetadata> createBackup(Backup backupInfo)
Parameter
Name | Description |
backupInfo | Backup
the backup to create. The instance, database and expireTime fields of the
backup must be filled.
|
Returns
Exceptions
createDatabase(String instanceName, String createDatabaseStatement, Iterable<String> additionalStatements, Database database)
public abstract OperationFuture<Database,CreateDatabaseMetadata> createDatabase(String instanceName, String createDatabaseStatement, Iterable<String> additionalStatements, Database database)
Parameters
Returns
Exceptions
createInstance(String parent, String instanceId, Instance instance)
public abstract 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 abstract Session createSession(String databaseName, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
deleteBackup(String backupName)
public abstract void deleteBackup(String backupName)
Deletes a pending or completed backup.
Parameter
Name | Description |
backupName | String
Required. The fully qualified name of the backup to delete.
|
deleteInstance(String instanceName)
public abstract void deleteInstance(String instanceName)
Parameter
Name | Description |
instanceName | String
|
Exceptions
deleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
public abstract void deleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
Parameters
Exceptions
dropDatabase(String databaseName)
public abstract void dropDatabase(String databaseName)
Parameter
Name | Description |
databaseName | String
|
Exceptions
executeBatchDml(ExecuteBatchDmlRequest build, Map<SpannerRpc.Option,?> options)
public abstract ExecuteBatchDmlResponse executeBatchDml(ExecuteBatchDmlRequest build, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeBatchDmlAsync(ExecuteBatchDmlRequest build, Map<SpannerRpc.Option,?> options)
public abstract ApiFuture<ExecuteBatchDmlResponse> executeBatchDmlAsync(ExecuteBatchDmlRequest build, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executePartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
public abstract ResultSet executePartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeQuery(ExecuteSqlRequest request, SpannerRpc.ResultStreamConsumer consumer, Map<SpannerRpc.Option,?> options)
public abstract SpannerRpc.StreamingCall executeQuery(ExecuteSqlRequest request, SpannerRpc.ResultStreamConsumer consumer, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeQuery(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
public abstract ResultSet executeQuery(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeQueryAsync(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
public abstract ApiFuture<ResultSet> executeQueryAsync(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
executeStreamingPartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options, Duration timeout)
public abstract ServerStream<PartialResultSet> executeStreamingPartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options, Duration timeout)
Parameters
Returns
getBackup(String backupName)
public abstract Backup getBackup(String backupName)
Gets the backup with the specified name.
Parameter
Name | Description |
backupName | String
|
Returns
Exceptions
getDatabase(String databaseName)
public abstract Database getDatabase(String databaseName)
Parameter
Name | Description |
databaseName | String
|
Returns
Exceptions
getDatabaseAdminIAMPolicy(String resource)
public abstract Policy getDatabaseAdminIAMPolicy(String resource)
Parameter
Returns
Type | Description |
com.google.iam.v1.Policy | |
getDatabaseDdl(String databaseName)
public abstract List<String> getDatabaseDdl(String databaseName)
Parameter
Name | Description |
databaseName | String
|
Returns
Exceptions
getInstance(String instanceName)
public abstract Instance getInstance(String instanceName)
Parameter
Name | Description |
instanceName | String
|
Returns
Exceptions
getInstanceAdminIAMPolicy(String resource)
public abstract Policy getInstanceAdminIAMPolicy(String resource)
Parameter
Returns
Type | Description |
com.google.iam.v1.Policy | |
getInstanceConfig(String instanceConfigName)
public abstract InstanceConfig getInstanceConfig(String instanceConfigName)
Parameter
Name | Description |
instanceConfigName | String
|
Returns
Exceptions
getOperation(String name)
public abstract Operation getOperation(String name)
Retrieves a long running operation.
Parameter
Returns
Exceptions
getPartitionedDmlRetrySettings()
public abstract RetrySettings getPartitionedDmlRetrySettings()
Returns
isClosed()
public abstract boolean isClosed()
Returns
listBackupOperations(String instanceName, int pageSize, String filter, String pageToken)
public abstract 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 abstract 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 abstract SpannerRpc.Paginated<Operation> listDatabaseOperations(String instanceName, int pageSize, String filter, String pageToken)
Parameters
Returns
listDatabases(String instanceName, int pageSize, String pageToken)
public abstract SpannerRpc.Paginated<Database> listDatabases(String instanceName, int pageSize, String pageToken)
Parameters
Returns
Exceptions
listInstanceConfigs(int pageSize, String pageToken)
public abstract SpannerRpc.Paginated<InstanceConfig> listInstanceConfigs(int pageSize, String pageToken)
Parameters
Returns
Exceptions
listInstances(int pageSize, String pageToken, String filter)
public abstract SpannerRpc.Paginated<Instance> listInstances(int pageSize, String pageToken, String filter)
Parameters
Returns
Exceptions
partitionQuery(PartitionQueryRequest request, Map<SpannerRpc.Option,?> options)
public abstract PartitionResponse partitionQuery(PartitionQueryRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
partitionRead(PartitionReadRequest request, Map<SpannerRpc.Option,?> options)
public abstract PartitionResponse partitionRead(PartitionReadRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
Exceptions
read(ReadRequest request, SpannerRpc.ResultStreamConsumer consumer, Map<SpannerRpc.Option,?> options)
public abstract SpannerRpc.StreamingCall read(ReadRequest request, SpannerRpc.ResultStreamConsumer consumer, Map<SpannerRpc.Option,?> options)
Parameters
Returns
restoreDatabase(Restore restore)
public abstract OperationFuture<Database,RestoreDatabaseMetadata> restoreDatabase(Restore restore)
Restore a backup into the given database.
Parameter
Name | Description |
restore | Restore
a Restore instance with the backup source and destination database
|
Returns
rollback(RollbackRequest request, Map<SpannerRpc.Option,?> options)
public abstract void rollback(RollbackRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Exceptions
rollbackAsync(RollbackRequest request, Map<SpannerRpc.Option,?> options)
public abstract ApiFuture<Empty> rollbackAsync(RollbackRequest request, Map<SpannerRpc.Option,?> options)
Parameters
Returns
setDatabaseAdminIAMPolicy(String resource, Policy policy)
public abstract 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 abstract 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()
public abstract void shutdown()
testDatabaseAdminIAMPermissions(String resource, Iterable<String> permissions)
public abstract TestIamPermissionsResponse testDatabaseAdminIAMPermissions(String resource, Iterable<String> permissions)
Parameters
Returns
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse | |
testInstanceAdminIAMPermissions(String resource, Iterable<String> permissions)
public abstract TestIamPermissionsResponse testInstanceAdminIAMPermissions(String resource, Iterable<String> permissions)
Parameters
Returns
Type | Description |
com.google.iam.v1.TestIamPermissionsResponse | |
updateBackup(Backup backup, FieldMask updateMask)
public abstract 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 abstract OperationFuture<Empty,UpdateDatabaseDdlMetadata> updateDatabaseDdl(String databaseName, Iterable<String> updateDatabaseStatements, String updateId)
Parameters
Returns
Exceptions
updateInstance(Instance instance, FieldMask fieldMask)
public abstract OperationFuture<Instance,UpdateInstanceMetadata> updateInstance(Instance instance, FieldMask fieldMask)
Parameters
Returns
Exceptions