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)
batchCreateSessions(String databaseName, int sessionCount, String databaseRole, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
public abstract List<Session> batchCreateSessions(String databaseName, int sessionCount, String databaseRole, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
batchWriteAtLeastOnce(BatchWriteRequest request, Map<SpannerRpc.Option,?> options)
public abstract ServerStream<BatchWriteResponse> batchWriteAtLeastOnce(BatchWriteRequest request, Map<SpannerRpc.Option,?> options)
beginTransaction(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options, boolean routeToLeader)
public abstract Transaction beginTransaction(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options, boolean routeToLeader)
Parameters |
Name |
Description |
request |
BeginTransactionRequest
|
options |
Map<Option,?>
|
routeToLeader |
boolean
Set to true to route the request to the leader region, and false to route
the request to any region. When leader aware routing is enabled, RW/PDML requests are
preferred to be routed to the leader region, and RO requests (except for
PartitionRead/PartitionQuery) are preferred to be routed to any region for optimal latency.
|
beginTransactionAsync(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options, boolean routeToLeader)
public abstract ApiFuture<Transaction> beginTransactionAsync(BeginTransactionRequest request, Map<SpannerRpc.Option,?> options, boolean routeToLeader)
Begins a transaction asynchronously.
Parameters |
Name |
Description |
request |
BeginTransactionRequest
|
options |
Map<Option,?>
|
routeToLeader |
boolean
Set to true to route the request to the leader region, and false to route
the request to any region. When leader aware routing is enabled, RW/PDML requests are
preferred to be routed to the leader region, and RO requests (except for
PartitionRead/PartitionQuery) are preferred to be routed to any region for optimal latency.
|
cancelOperation(String name)
public abstract void cancelOperation(String name)
Cancels the specified long-running operation.
Parameter |
Name |
Description |
name |
String
|
commit(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
public abstract CommitResponse commit(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
commitAsync(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
public abstract ApiFuture<CommitResponse> commitAsync(CommitRequest commitRequest, Map<SpannerRpc.Option,?> options)
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.
|
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.
|
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)
createInstance(String parent, String instanceId, Instance instance)
public abstract OperationFuture<Instance,CreateInstanceMetadata> createInstance(String parent, String instanceId, Instance instance)
createInstanceConfig(String parent, String instanceConfigId, InstanceConfig instanceConfig, Boolean validateOnly)
public default OperationFuture<InstanceConfig,CreateInstanceConfigMetadata> createInstanceConfig(String parent, String instanceConfigId, InstanceConfig instanceConfig, Boolean validateOnly)
createSession(String databaseName, String databaseRole, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
public abstract Session createSession(String databaseName, String databaseRole, Map<String,String> labels, Map<SpannerRpc.Option,?> options)
createSession(String databaseName, String databaseRole, Map<String,String> labels, Map<SpannerRpc.Option,?> options, boolean isMultiplexed)
public default Session createSession(String databaseName, String databaseRole, Map<String,String> labels, Map<SpannerRpc.Option,?> options, boolean isMultiplexed)
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
|
deleteInstanceConfig(String instanceConfigName, String etag, Boolean validateOnly)
public default void deleteInstanceConfig(String instanceConfigName, String etag, Boolean validateOnly)
deleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
public abstract void deleteSession(String sessionName, Map<SpannerRpc.Option,?> options)
dropDatabase(String databaseName)
public abstract void dropDatabase(String databaseName)
Parameter |
Name |
Description |
databaseName |
String
|
executeBatchDml(ExecuteBatchDmlRequest build, Map<SpannerRpc.Option,?> options)
public abstract ExecuteBatchDmlResponse executeBatchDml(ExecuteBatchDmlRequest build, Map<SpannerRpc.Option,?> options)
executeBatchDmlAsync(ExecuteBatchDmlRequest build, Map<SpannerRpc.Option,?> options)
public abstract ApiFuture<ExecuteBatchDmlResponse> executeBatchDmlAsync(ExecuteBatchDmlRequest build, Map<SpannerRpc.Option,?> options)
executePartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
public abstract ResultSet executePartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options)
executeQuery(ExecuteSqlRequest request, SpannerRpc.ResultStreamConsumer consumer, Map<SpannerRpc.Option,?> options, boolean routeToLeader)