Package com.google.cloud.spanner
Class Options
- java.lang.Object
-
- com.google.cloud.spanner.Options
-
- All Implemented Interfaces:
Serializable
public final class Options extends Object implements Serializable
Specifies options for various spanner operations- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceOptions.AdminApiOptionMarker interface to mark options applicable to operations in admin API.static interfaceOptions.CreateAdminApiOptionMarker interface to mark options applicable to Create operations in admin API.static interfaceOptions.CreateUpdateDeleteAdminApiOptionMarker interface to mark options applicable to Create, Update and Delete operations in admin API.static interfaceOptions.DeleteAdminApiOptionMarker interface to mark options applicable to Delete operations in admin API.static interfaceOptions.ListOptionMarker interface to mark options applicable to list operations in admin API.static interfaceOptions.QueryOptionMarker interface to mark options applicable to query operation.static interfaceOptions.ReadAndQueryOptionMarker interface to mark options applicable to both Read and Query operationsstatic interfaceOptions.ReadOptionMarker interface to mark options applicable to read operationstatic interfaceOptions.ReadQueryUpdateTransactionOptionMarker interface to mark options applicable to Read, Query, Update and Write operationsstatic classOptions.RpcPriorityPriority for an RPC invocation.static interfaceOptions.TransactionOptionMarker interface to mark options applicable to write operationsstatic interfaceOptions.UpdateAdminApiOptionMarker interface to mark options applicable to Update operations in admin API.static interfaceOptions.UpdateOptionMarker interface to mark options applicable to update operation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Options.ReadAndQueryOptionbufferRows(int bufferRows)static Options.TransactionOptioncommitStats()Specifying this instructs the transaction to requestCommitStatsfrom the backend.booleanequals(Object o)static Options.DeleteAdminApiOptionetag(String 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.static Options.ListOptionfilter(String filter)Specifying this will cause the given filter to be applied to the list operation.inthashCode()static Options.ReadOptionlimit(long limit)Specifying this will cause the read to yield at most this many rows.static Options.TransactionOptionoptimisticLock()Specifying this instructs the transaction to request Optimistic Lock from the backend.static Options.ListOptionpageSize(int pageSize)Specifying this will cause the list operations to fetch at most this many records in a page.static Options.ListOptionpageToken(String pageToken)Specifying 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.static Options.ReadQueryUpdateTransactionOptionpriority(Options.RpcPriority priority)Specifies the priority to use for the RPC.static Options.ReadQueryUpdateTransactionOptiontag(String name)Specifying this will cause the reads, queries, updates and writes operations statistics collection to be grouped by tag.StringtoString()static Options.CreateUpdateDeleteAdminApiOptionvalidateOnly(Boolean validateOnly)Specifying this will not actually execute a request, and provide the same response.
-
-
-
Method Detail
-
commitStats
public static Options.TransactionOption commitStats()
Specifying this instructs the transaction to requestCommitStatsfrom the backend.
-
optimisticLock
public static Options.TransactionOption 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).
-
limit
public static Options.ReadOption limit(long limit)
Specifying this will cause the read to yield at most this many rows. This should be greater than 0.
-
prefetchChunks
public static Options.ReadAndQueryOption prefetchChunks(int 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
public static Options.ReadAndQueryOption bufferRows(int bufferRows)
-
priority
public static Options.ReadQueryUpdateTransactionOption priority(Options.RpcPriority priority)
Specifies the priority to use for the RPC.
-
tag
public static Options.ReadQueryUpdateTransactionOption tag(String name)
Specifying this will cause the reads, queries, updates and writes operations statistics collection to be grouped by tag.
-
pageSize
public static Options.ListOption pageSize(int pageSize)
Specifying this will cause the list operations to fetch at most this many records in a page.
-
pageToken
public static Options.ListOption pageToken(String pageToken)
Specifying this will cause the list operation to start fetching the record from this onwards.
-
filter
public static Options.ListOption filter(String 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
public static Options.DeleteAdminApiOption etag(String 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
public static Options.CreateUpdateDeleteAdminApiOption validateOnly(Boolean 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...)
-
-