Package com.google.cloud.spanner
Class Options
java.lang.Object
com.google.cloud.spanner.Options
- All Implemented Interfaces:
Serializable
Specifies options for various spanner operations
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceMarker interface to mark options applicable to operations in admin API.static interfaceMarker interface to mark options applicable to Create operations in admin API.static interfaceMarker interface to mark options applicable to Create, Update and Delete operations in admin API.static interfaceMarker interface to mark options applicable to Delete operations in admin API.static interfaceMarker interface to mark options applicable to list operations in admin API.static interfaceMarker interface to mark options applicable to query operation.static interfaceMarker interface for options that can be used with both executeQuery and executeUpdate.static interfaceMarker interface to mark options applicable to both Read and Query operationsstatic interfaceMarker interface to mark options applicable to read operationstatic interfaceMarker interface to mark options applicable to Read, Query, Update and Write operationsstatic enumstatic enumOrderBy for an RPC invocation.static enumPriority for an RPC invocation.static interfaceMarker interface to mark options applicable to write operationsstatic interfaceMarker interface to mark options applicable to Update operations in admin API.static interfaceMarker interface to mark options applicable to update operation.static interfaceMarker interface to mark options applicable to Update and Write operations -
Method Summary
Modifier and TypeMethodDescriptionstatic Options.ReadAndQueryOptionbufferRows(int bufferRows) static Options.TransactionOptionSpecifying this instructs the transaction to requestCommitStatsfrom the backend.static com.google.cloud.spanner.Options.DataBoostQueryOptiondataBoostEnabled(Boolean dataBoostEnabled) If this is for PartitionedRead or PartitionedQuery and this field is set to `true`, the request will be executed via Spanner independent compute resources.static Options.ReadAndQueryOptiondecodeMode(DecodeMode decodeMode) static Options.ReadAndQueryOptiondirectedRead(DirectedReadOptions directedReadOptions) Option to request DirectedRead for ReadOnlyTransaction and SingleUseTransaction.booleanstatic Options.DeleteAdminApiOptionSpecifying this will help in optimistic concurrency control as a way to help prevent simultaneous deletes of an instance config from overwriting each other.Specifying this instructs the transaction to be excluded from being recorded in change streams with the DDL option `allow_txn_exclusion=true`.static Options.ListOptionSpecifying this will cause the given filter to be applied to the list operation.inthashCode()static Options.TransactionOptionisolationLevel(TransactionOptions.IsolationLevel isolationLevel) Specifying this instructs the transaction to requestTransactionOptions.IsolationLevelfrom the backend.static Options.QueryUpdateOptionIf set to true, this option marks the end of the transaction.static Options.ReadOptionlimit(long limit) Specifying this will cause the read to yield at most this many rows.static Options.ReadOptionlockHint(Options.RpcLockHint orderBy) static Options.TransactionOptionmaxCommitDelay(Duration maxCommitDelay) static Options.TransactionOptionSpecifying this instructs the transaction to request Optimistic Lock from the backend.static Options.ReadOptionorderBy(Options.RpcOrderBy orderBy) Specifies the order_by to use for the RPC.static Options.ListOptionpageSize(int pageSize) Specifying this will cause the list operations to fetch at most this many records in a page.static Options.ListOptionSpecifying this will cause the list operation to start fetching the record from this onwards.static Options.ReadAndQueryOptionprefetchChunks(int prefetchChunks) Specifying this will allow the client to prefetch up toprefetchChunksPartialResultSetchunks for read and query.priority(Options.RpcPriority priority) Specifies the priority to use for the RPC.static com.google.cloud.spanner.Options.RequestIdOptionrequestId(XGoogSpannerRequestId reqId) Specifying this will cause the reads, queries, updates and writes operations statistics collection to be grouped by tag.toString()validateOnly(Boolean validateOnly) Specifying this will not actually execute a request, and provide the same response.
-
Method Details
-
commitStats
Specifying this instructs the transaction to requestCommitStatsfrom the backend. -
optimisticLock
Specifying this instructs the transaction to request Optimistic Lock from the backend. In this concurrency mode, operations during the execution phase, i.e., reads and queries, are performed without acquiring locks, and transactional consistency is ensured by running a validation process in the commit phase (when any needed locks are acquired). The validation process succeeds only if there are no conflicting committed transactions (that committed mutations to the read data at a commit timestamp after the read timestamp). -
isolationLevel
public static Options.TransactionOption isolationLevel(TransactionOptions.IsolationLevel isolationLevel) Specifying this instructs the transaction to requestTransactionOptions.IsolationLevelfrom the backend. -
excludeTxnFromChangeStreams
Specifying this instructs the transaction to be excluded from being recorded in change streams with the DDL option `allow_txn_exclusion=true`. This does not exclude the transaction from being recorded in the change streams with the DDL option `allow_txn_exclusion` being false or unset. -
requestId
public static com.google.cloud.spanner.Options.RequestIdOption requestId(XGoogSpannerRequestId reqId) -
limit
Specifying this will cause the read to yield at most this many rows. This should be greater than 0. -
orderBy
Specifies the order_by to use for the RPC. -
lockHint
-
prefetchChunks
Specifying this will allow the client to prefetch up toprefetchChunksPartialResultSetchunks for read and query. The data size of each chunk depends on the server implementation but a good rule of thumb is that each chunk will be up to 1 MiB. Larger values reduce the likelihood of blocking while consuming results at the cost of greater memory consumption.prefetchChunksshould be greater than 0. To get good performance choose a value that is large enough to allow buffering of chunks for an entire row. Apart from the buffered chunks, there can be at most one more row buffered in the client. -
bufferRows
-
priority
Specifies the priority to use for the RPC. -
maxCommitDelay
-
tag
Specifying this will cause the reads, queries, updates and writes operations statistics collection to be grouped by tag. -
pageSize
Specifying this will cause the list operations to fetch at most this many records in a page. -
dataBoostEnabled
public static com.google.cloud.spanner.Options.DataBoostQueryOption dataBoostEnabled(Boolean dataBoostEnabled) If this is for PartitionedRead or PartitionedQuery and this field is set to `true`, the request will be executed via Spanner independent compute resources. -
lastStatement
If set to true, this option marks the end of the transaction. The transaction should be committed or aborted after this statement executes, and attempts to execute any other requests against this transaction (including reads and queries) will be rejected. Mixing mutations with statements that are marked as the last statement is not allowed.For DML statements, setting this option may cause some error reporting to be deferred until commit time (e.g. validation of unique constraints). Given this, successful execution of a DML statement should not be assumed until the transaction commits.
-
pageToken
Specifying this will cause the list operation to start fetching the record from this onwards. -
filter
Specifying this will cause the given filter to be applied to the list operation. List operations that support this options are: If this option is passed to any other list operation, it will throw an IllegalArgumentException.- Parameters:
filter- An expression for filtering the results of the request. Filter rules are case insensitive. Some examples of using filters are:- name:* The entity has a name.
- name:Howl The entity's name contains "howl".
- name:HOWL Equivalent to above.
- NAME:howl Equivalent to above.
- labels.env:* The entity has the label env.
- labels.env:dev The entity has a label env whose value contains "dev".
- name:howl labels.env:dev The entity's name contains "howl" and it has the label env whose value contains "dev".
-
etag
Specifying this will help in optimistic concurrency control as a way to help prevent simultaneous deletes of an instance config from overwriting each other. Operations that support this option are: -
validateOnly
Specifying this will not actually execute a request, and provide the same response. Operations that support this option are:InstanceAdminClient.createInstanceConfig(com.google.cloud.spanner.InstanceConfigInfo, com.google.cloud.spanner.Options.CreateAdminApiOption...)InstanceAdminClient.updateInstanceConfig(com.google.cloud.spanner.InstanceConfigInfo, java.lang.Iterable<com.google.cloud.spanner.InstanceConfigInfo.InstanceConfigField>, com.google.cloud.spanner.Options.UpdateAdminApiOption...)InstanceAdminClient.deleteInstanceConfig(java.lang.String, com.google.cloud.spanner.Options.DeleteAdminApiOption...)
-
directedRead
Option to request DirectedRead for ReadOnlyTransaction and SingleUseTransaction.The DirectedReadOptions can be used to indicate which replicas or regions should be used for non-transactional reads or queries. Not all requests can be sent to non-leader replicas. In particular, some requests such as reads within read-write transactions must be sent to a designated leader replica. These requests ignore DirectedReadOptions.
-
decodeMode
-
toString
-
equals
-
hashCode
public int hashCode()
-