partitionRead method
- PartitionReadRequest request,
- String session, {
- String? $fields,
Creates a set of partition tokens that can be used to execute a read operation in parallel.
Each of the returned partition tokens can be used by StreamingRead to
specify a subset of the read result to read. The same session and
read-only transaction must be used by the PartitionReadRequest
used to
create the partition tokens and the ReadRequests
that use the partition
tokens. There are no ordering guarantees on rows returned among the
returned partition tokens, or even within each individual StreamingRead
call issued with a partition_token
. Partition tokens become invalid when
the session used to create them is deleted, is idle for too long, begins a
new transaction, or becomes too old. When any of these happen, it isn't
possible to resume the read, and the whole operation must be restarted
from the beginning.
request
- The metadata request object.
Request parameters:
session
- Required. The session used to create the partitions.
Value must have pattern
^projects/\[^/\]+/instances/\[^/\]+/databases/\[^/\]+/sessions/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a PartitionResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<PartitionResponse> partitionRead(
PartitionReadRequest request,
core.String session, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$session') + ':partitionRead';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return PartitionResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}