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][google.datastore.v1.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][google.datastore.v1.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 |