Each RPC normalizes the partition IDs of the keys in its input entities, and always returns entities with keys with normalized partition IDs.
This applies to all keys and entities, including those in values, except keys with both an empty path and an empty or unset partition ID. Normalization of input keys sets the project ID (if not already set) to the project ID from the request.
Equality
Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection>
objects compare equal. Objects that compare equal share the same underlying resources.
Performance
Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.
Thread Safety
Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.
Constructors
DatastoreClient(DatastoreClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DatastoreClient const &
|
DatastoreClient(DatastoreClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DatastoreClient &&
|
DatastoreClient(std::shared_ptr< DatastoreConnection >, Options)
Parameters | |
---|---|
Name | Description |
connection |
std::shared_ptr< DatastoreConnection >
|
opts |
Options
|
Operators
operator=(DatastoreClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DatastoreClient const &
|
Returns | |
---|---|
Type | Description |
DatastoreClient & |
operator=(DatastoreClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DatastoreClient &&
|
Returns | |
---|---|
Type | Description |
DatastoreClient & |
Functions
Lookup(std::string const &, google::datastore::v1::ReadOptions const &, std::vector< google::datastore::v1::Key > const &, Options)
Looks up entities by key.
Parameters | |
---|---|
Name | Description |
project_id |
std::string const &
Required. The ID of the project against which to make the request. |
read_options |
google::datastore::v1::ReadOptions const &
The options for this lookup request. |
keys |
std::vector< google::datastore::v1::Key > const &
Required. Keys of entities to look up. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::LookupResponse > |
the result of the RPC. The response message type (google.datastore.v1.LookupResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
Lookup(google::datastore::v1::LookupRequest const &, Options)
Looks up entities by key.
Parameters | |
---|---|
Name | Description |
request |
google::datastore::v1::LookupRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::LookupResponse > |
the result of the RPC. The response message type (google.datastore.v1.LookupResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
RunQuery(google::datastore::v1::RunQueryRequest const &, Options)
Queries for entities.
Parameters | |
---|---|
Name | Description |
request |
google::datastore::v1::RunQueryRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::RunQueryResponse > |
the result of the RPC. The response message type (google.datastore.v1.RunQueryResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
RunAggregationQuery(google::datastore::v1::RunAggregationQueryRequest const &, Options)
Runs an aggregation query.
Parameters | |
---|---|
Name | Description |
request |
google::datastore::v1::RunAggregationQueryRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::RunAggregationQueryResponse > |
the result of the RPC. The response message type (google.datastore.v1.RunAggregationQueryResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
BeginTransaction(std::string const &, Options)
Begins a new transaction.
Parameters | |
---|---|
Name | Description |
project_id |
std::string const &
Required. The ID of the project against which to make the request. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::BeginTransactionResponse > |
the result of the RPC. The response message type (google.datastore.v1.BeginTransactionResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
BeginTransaction(google::datastore::v1::BeginTransactionRequest const &, Options)
Begins a new transaction.
Parameters | |
---|---|
Name | Description |
request |
google::datastore::v1::BeginTransactionRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::BeginTransactionResponse > |
the result of the RPC. The response message type (google.datastore.v1.BeginTransactionResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
Commit(std::string const &, google::datastore::v1::CommitRequest::Mode, std::string const &, std::vector< google::datastore::v1::Mutation > const &, Options)
Commits a transaction, optionally creating, deleting or modifying some entities.
Parameters | |
---|---|
Name | Description |
project_id |
std::string const &
Required. The ID of the project against which to make the request. |
mode |
google::datastore::v1::CommitRequest::Mode
The type of commit to perform. Defaults to |
transaction |
std::string const &
The identifier of the transaction associated with the commit. A transaction identifier is returned by a call to Datastore.BeginTransaction. |
mutations |
std::vector< google::datastore::v1::Mutation > const &
The mutations to perform.
|
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::CommitResponse > |
the result of the RPC. The response message type (google.datastore.v1.CommitResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
Commit(std::string const &, google::datastore::v1::CommitRequest::Mode, std::vector< google::datastore::v1::Mutation > const &, Options)
Commits a transaction, optionally creating, deleting or modifying some entities.
Parameters | |
---|---|
Name | Description |
project_id |
std::string const &
Required. The ID of the project against which to make the request. |
mode |
google::datastore::v1::CommitRequest::Mode
The type of commit to perform. Defaults to |
mutations |
std::vector< google::datastore::v1::Mutation > const &
The mutations to perform.
|
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::CommitResponse > |
the result of the RPC. The response message type (google.datastore.v1.CommitResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
Commit(google::datastore::v1::CommitRequest const &, Options)
Commits a transaction, optionally creating, deleting or modifying some entities.
Parameters | |
---|---|
Name | Description |
request |
google::datastore::v1::CommitRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::CommitResponse > |
the result of the RPC. The response message type (google.datastore.v1.CommitResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
Rollback(std::string const &, std::string const &, Options)
Rolls back a transaction.
Parameters | |
---|---|
Name | Description |
project_id |
std::string const &
Required. The ID of the project against which to make the request. |
transaction |
std::string const &
Required. The transaction identifier, returned by a call to Datastore.BeginTransaction. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::RollbackResponse > |
the result of the RPC. The response message type (google.datastore.v1.RollbackResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
Rollback(google::datastore::v1::RollbackRequest const &, Options)
Rolls back a transaction.
Parameters | |
---|---|
Name | Description |
request |
google::datastore::v1::RollbackRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::RollbackResponse > |
the result of the RPC. The response message type (google.datastore.v1.RollbackResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
AllocateIds(std::string const &, std::vector< google::datastore::v1::Key > const &, Options)
Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted.
Parameters | |
---|---|
Name | Description |
project_id |
std::string const &
Required. The ID of the project against which to make the request. |
keys |
std::vector< google::datastore::v1::Key > const &
Required. A list of keys with incomplete key paths for which to allocate IDs. No key may be reserved/read-only. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::AllocateIdsResponse > |
the result of the RPC. The response message type (google.datastore.v1.AllocateIdsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
AllocateIds(google::datastore::v1::AllocateIdsRequest const &, Options)
Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted.
Parameters | |
---|---|
Name | Description |
request |
google::datastore::v1::AllocateIdsRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::AllocateIdsResponse > |
the result of the RPC. The response message type (google.datastore.v1.AllocateIdsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ReserveIds(std::string const &, std::vector< google::datastore::v1::Key > const &, Options)
Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore.
Parameters | |
---|---|
Name | Description |
project_id |
std::string const &
Required. The ID of the project against which to make the request. |
keys |
std::vector< google::datastore::v1::Key > const &
Required. A list of keys with complete key paths whose numeric IDs should not be auto-allocated. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::ReserveIdsResponse > |
the result of the RPC. The response message type (google.datastore.v1.ReserveIdsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ReserveIds(google::datastore::v1::ReserveIdsRequest const &, Options)
Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore.
Parameters | |
---|---|
Name | Description |
request |
google::datastore::v1::ReserveIdsRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::datastore::v1::ReserveIdsResponse > |
the result of the RPC. The response message type (google.datastore.v1.ReserveIdsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListOperations(std::string const &, std::string const &, Options)
Lists operations that match the specified filter in the request.
If the server doesn't support this method, it returns UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
The name of the operation's parent resource. |
filter |
std::string const &
The standard list filter. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::longrunning::Operation > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListOperations(google::longrunning::ListOperationsRequest, Options)
Lists operations that match the specified filter in the request.
If the server doesn't support this method, it returns UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
google::longrunning::ListOperationsRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::longrunning::Operation > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
GetOperation(std::string const &, Options)
Gets the latest state of a long-running operation.
Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
The name of the operation resource. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
the result of the RPC. The response message type (google.longrunning.Operation) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetOperation(google::longrunning::GetOperationRequest const &, Options)
Gets the latest state of a long-running operation.
Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters | |
---|---|
Name | Description |
request |
google::longrunning::GetOperationRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
the result of the RPC. The response message type (google.longrunning.Operation) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
DeleteOperation(std::string const &, Options)
Deletes a long-running operation.
This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
The name of the operation resource to be deleted. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
DeleteOperation(google::longrunning::DeleteOperationRequest const &, Options)
Deletes a long-running operation.
This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
google::longrunning::DeleteOperationRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
CancelOperation(std::string const &, Options)
Starts asynchronous cancellation on a long-running operation.
The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1
, corresponding to Code.CANCELLED
.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
The name of the operation resource to be cancelled. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
CancelOperation(google::longrunning::CancelOperationRequest const &, Options)
Starts asynchronous cancellation on a long-running operation.
The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1
, corresponding to Code.CANCELLED
.
Parameters | |
---|---|
Name | Description |
request |
google::longrunning::CancelOperationRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |