diff --git a/Spanner/metadata/V1/Spanner.php b/Spanner/metadata/V1/Spanner.php index 9d093fc4bc88..cd8c3b563d3d 100644 --- a/Spanner/metadata/V1/Spanner.php +++ b/Spanner/metadata/V1/Spanner.php @@ -31,7 +31,7 @@ public static function initOnce() { \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); \GPBMetadata\Google\Spanner\V1\Type::initOnce(); $pool->internalAddGeneratedFile( - "\x0A\xA7W\x0A\x1Fgoogle/spanner/v1/spanner.proto\x12\x11google.spanner.v1\x1A\x1Cgoogle/api/annotations.proto\x1A\x17google/api/client.proto\x1A\x1Fgoogle/api/field_behavior.proto\x1A\x19google/api/resource.proto\x1A\x1Egoogle/protobuf/duration.proto\x1A\x1Bgoogle/protobuf/empty.proto\x1A\x1Cgoogle/protobuf/struct.proto\x1A\x1Fgoogle/protobuf/timestamp.proto\x1A\x17google/rpc/status.proto\x1A\x1Cgoogle/spanner/v1/keys.proto\x1A google/spanner/v1/location.proto\x1A google/spanner/v1/mutation.proto\x1A\"google/spanner/v1/result_set.proto\x1A#google/spanner/v1/transaction.proto\x1A\x1Cgoogle/spanner/v1/type.proto\"\x83\x01\x0A\x14CreateSessionRequest\x129\x0A\x08database\x18\x01 \x01(\x09B'\xE0A\x02\xFAA!\x0A\x1Fspanner.googleapis.com/Database\x120\x0A\x07session\x18\x02 \x01(\x0B2\x1A.google.spanner.v1.SessionB\x03\xE0A\x02\"\xA9\x01\x0A\x1ABatchCreateSessionsRequest\x129\x0A\x08database\x18\x01 \x01(\x09B'\xE0A\x02\xFAA!\x0A\x1Fspanner.googleapis.com/Database\x124\x0A\x10session_template\x18\x02 \x01(\x0B2\x1A.google.spanner.v1.Session\x12\x1A\x0A\x0Dsession_count\x18\x03 \x01(\x05B\x03\xE0A\x02\"J\x0A\x1BBatchCreateSessionsResponse\x12+\x0A\x07session\x18\x01 \x03(\x0B2\x1A.google.spanner.v1.Session\"\xB8\x03\x0A\x07Session\x12\x11\x0A\x04name\x18\x01 \x01(\x09B\x03\xE0A\x03\x126\x0A\x06labels\x18\x02 \x03(\x0B2&.google.spanner.v1.Session.LabelsEntry\x124\x0A\x0Bcreate_time\x18\x03 \x01(\x0B2\x1A.google.protobuf.TimestampB\x03\xE0A\x03\x12B\x0A\x19approximate_last_use_time\x18\x04 \x01(\x0B2\x1A.google.protobuf.TimestampB\x03\xE0A\x03\x12\x14\x0A\x0Ccreator_role\x18\x05 \x01(\x09\x12\x18\x0A\x0Bmultiplexed\x18\x06 \x01(\x08B\x03\xE0A\x01\x1A-\x0A\x0BLabelsEntry\x12\x0B\x0A\x03key\x18\x01 \x01(\x09\x12\x0D\x0A\x05value\x18\x02 \x01(\x09:\x028\x01:\x88\x01\xEAA\x84\x01\x0A\x1Espanner.googleapis.com/Session\x12Oprojects/{project}/instances/{instance}/databases/{database}/sessions/{session}*\x08sessions2\x07session\"I\x0A\x11GetSessionRequest\x124\x0A\x04name\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\"\x87\x01\x0A\x13ListSessionsRequest\x129\x0A\x08database\x18\x01 \x01(\x09B'\xE0A\x02\xFAA!\x0A\x1Fspanner.googleapis.com/Database\x12\x11\x0A\x09page_size\x18\x02 \x01(\x05\x12\x12\x0A\x0Apage_token\x18\x03 \x01(\x09\x12\x0E\x0A\x06filter\x18\x04 \x01(\x09\"]\x0A\x14ListSessionsResponse\x12,\x0A\x08sessions\x18\x01 \x03(\x0B2\x1A.google.spanner.v1.Session\x12\x17\x0A\x0Fnext_page_token\x18\x02 \x01(\x09\"L\x0A\x14DeleteSessionRequest\x124\x0A\x04name\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\"\xEB\x03\x0A\x0ERequestOptions\x12<\x0A\x08priority\x18\x01 \x01(\x0E2*.google.spanner.v1.RequestOptions.Priority\x12\x13\x0A\x0Brequest_tag\x18\x02 \x01(\x09\x12\x17\x0A\x0Ftransaction_tag\x18\x03 \x01(\x09\x12L\x0A\x0Eclient_context\x18\x04 \x01(\x0B2/.google.spanner.v1.RequestOptions.ClientContextB\x03\xE0A\x01\x1A\xBE\x01\x0A\x0DClientContext\x12_\x0A\x0Esecure_context\x18\x01 \x03(\x0B2B.google.spanner.v1.RequestOptions.ClientContext.SecureContextEntryB\x03\xE0A\x01\x1AL\x0A\x12SecureContextEntry\x12\x0B\x0A\x03key\x18\x01 \x01(\x09\x12%\x0A\x05value\x18\x02 \x01(\x0B2\x16.google.protobuf.Value:\x028\x01\"^\x0A\x08Priority\x12\x18\x0A\x14PRIORITY_UNSPECIFIED\x10\x00\x12\x10\x0A\x0CPRIORITY_LOW\x10\x01\x12\x13\x0A\x0FPRIORITY_MEDIUM\x10\x02\x12\x11\x0A\x0DPRIORITY_HIGH\x10\x03\"\xEA\x04\x0A\x13DirectedReadOptions\x12R\x0A\x10include_replicas\x18\x01 \x01(\x0B26.google.spanner.v1.DirectedReadOptions.IncludeReplicasH\x00\x12R\x0A\x10exclude_replicas\x18\x02 \x01(\x0B26.google.spanner.v1.DirectedReadOptions.ExcludeReplicasH\x00\x1A\xAD\x01\x0A\x10ReplicaSelection\x12\x10\x0A\x08location\x18\x01 \x01(\x09\x12J\x0A\x04type\x18\x02 \x01(\x0E2<.google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type\";\x0A\x04Type\x12\x14\x0A\x10TYPE_UNSPECIFIED\x10\x00\x12\x0E\x0A\x0AREAD_WRITE\x10\x01\x12\x0D\x0A\x09READ_ONLY\x10\x02\x1A\x86\x01\x0A\x0FIncludeReplicas\x12S\x0A\x12replica_selections\x18\x01 \x03(\x0B27.google.spanner.v1.DirectedReadOptions.ReplicaSelection\x12\x1E\x0A\x16auto_failover_disabled\x18\x02 \x01(\x08\x1Af\x0A\x0FExcludeReplicas\x12S\x0A\x12replica_selections\x18\x01 \x03(\x0B27.google.spanner.v1.DirectedReadOptions.ReplicaSelectionB\x0A\x0A\x08replicas\"\xC8\x07\x0A\x11ExecuteSqlRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12;\x0A\x0Btransaction\x18\x02 \x01(\x0B2&.google.spanner.v1.TransactionSelector\x12\x10\x0A\x03sql\x18\x03 \x01(\x09B\x03\xE0A\x02\x12'\x0A\x06params\x18\x04 \x01(\x0B2\x17.google.protobuf.Struct\x12I\x0A\x0Bparam_types\x18\x05 \x03(\x0B24.google.spanner.v1.ExecuteSqlRequest.ParamTypesEntry\x12\x14\x0A\x0Cresume_token\x18\x06 \x01(\x0C\x12B\x0A\x0Aquery_mode\x18\x07 \x01(\x0E2..google.spanner.v1.ExecuteSqlRequest.QueryMode\x12\x17\x0A\x0Fpartition_token\x18\x08 \x01(\x0C\x12\x0D\x0A\x05seqno\x18\x09 \x01(\x03\x12H\x0A\x0Dquery_options\x18\x0A \x01(\x0B21.google.spanner.v1.ExecuteSqlRequest.QueryOptions\x12:\x0A\x0Frequest_options\x18\x0B \x01(\x0B2!.google.spanner.v1.RequestOptions\x12E\x0A\x15directed_read_options\x18\x0F \x01(\x0B2&.google.spanner.v1.DirectedReadOptions\x12\x1A\x0A\x12data_boost_enabled\x18\x10 \x01(\x08\x12\x1B\x0A\x0Elast_statement\x18\x11 \x01(\x08B\x03\xE0A\x01\x129\x0A\x0Crouting_hint\x18\x12 \x01(\x0B2\x1E.google.spanner.v1.RoutingHintB\x03\xE0A\x01\x1AO\x0A\x0CQueryOptions\x12\x19\x0A\x11optimizer_version\x18\x01 \x01(\x09\x12\$\x0A\x1Coptimizer_statistics_package\x18\x02 \x01(\x09\x1AJ\x0A\x0FParamTypesEntry\x12\x0B\x0A\x03key\x18\x01 \x01(\x09\x12&\x0A\x05value\x18\x02 \x01(\x0B2\x17.google.spanner.v1.Type:\x028\x01\"W\x0A\x09QueryMode\x12\x0A\x0A\x06NORMAL\x10\x00\x12\x08\x0A\x04PLAN\x10\x01\x12\x0B\x0A\x07PROFILE\x10\x02\x12\x0E\x0A\x0AWITH_STATS\x10\x03\x12\x17\x0A\x13WITH_PLAN_AND_STATS\x10\x04\"\xBE\x04\x0A\x16ExecuteBatchDmlRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12@\x0A\x0Btransaction\x18\x02 \x01(\x0B2&.google.spanner.v1.TransactionSelectorB\x03\xE0A\x02\x12L\x0A\x0Astatements\x18\x03 \x03(\x0B23.google.spanner.v1.ExecuteBatchDmlRequest.StatementB\x03\xE0A\x02\x12\x12\x0A\x05seqno\x18\x04 \x01(\x03B\x03\xE0A\x02\x12:\x0A\x0Frequest_options\x18\x05 \x01(\x0B2!.google.spanner.v1.RequestOptions\x12\x1C\x0A\x0Flast_statements\x18\x06 \x01(\x08B\x03\xE0A\x01\x1A\xEC\x01\x0A\x09Statement\x12\x10\x0A\x03sql\x18\x01 \x01(\x09B\x03\xE0A\x02\x12'\x0A\x06params\x18\x02 \x01(\x0B2\x17.google.protobuf.Struct\x12X\x0A\x0Bparam_types\x18\x03 \x03(\x0B2C.google.spanner.v1.ExecuteBatchDmlRequest.Statement.ParamTypesEntry\x1AJ\x0A\x0FParamTypesEntry\x12\x0B\x0A\x03key\x18\x01 \x01(\x09\x12&\x0A\x05value\x18\x02 \x01(\x0B2\x17.google.spanner.v1.Type:\x028\x01\"\xC3\x01\x0A\x17ExecuteBatchDmlResponse\x121\x0A\x0Bresult_sets\x18\x01 \x03(\x0B2\x1C.google.spanner.v1.ResultSet\x12\"\x0A\x06status\x18\x02 \x01(\x0B2\x12.google.rpc.Status\x12Q\x0A\x0Fprecommit_token\x18\x03 \x01(\x0B23.google.spanner.v1.MultiplexedSessionPrecommitTokenB\x03\xE0A\x01\"H\x0A\x10PartitionOptions\x12\x1C\x0A\x14partition_size_bytes\x18\x01 \x01(\x03\x12\x16\x0A\x0Emax_partitions\x18\x02 \x01(\x03\"\xAD\x03\x0A\x15PartitionQueryRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12;\x0A\x0Btransaction\x18\x02 \x01(\x0B2&.google.spanner.v1.TransactionSelector\x12\x10\x0A\x03sql\x18\x03 \x01(\x09B\x03\xE0A\x02\x12,\x0A\x06params\x18\x04 \x01(\x0B2\x17.google.protobuf.StructB\x03\xE0A\x01\x12R\x0A\x0Bparam_types\x18\x05 \x03(\x0B28.google.spanner.v1.PartitionQueryRequest.ParamTypesEntryB\x03\xE0A\x01\x12>\x0A\x11partition_options\x18\x06 \x01(\x0B2#.google.spanner.v1.PartitionOptions\x1AJ\x0A\x0FParamTypesEntry\x12\x0B\x0A\x03key\x18\x01 \x01(\x09\x12&\x0A\x05value\x18\x02 \x01(\x0B2\x17.google.spanner.v1.Type:\x028\x01\"\xB1\x02\x0A\x14PartitionReadRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12;\x0A\x0Btransaction\x18\x02 \x01(\x0B2&.google.spanner.v1.TransactionSelector\x12\x12\x0A\x05table\x18\x03 \x01(\x09B\x03\xE0A\x02\x12\x0D\x0A\x05index\x18\x04 \x01(\x09\x12\x0F\x0A\x07columns\x18\x05 \x03(\x09\x12/\x0A\x07key_set\x18\x06 \x01(\x0B2\x19.google.spanner.v1.KeySetB\x03\xE0A\x02\x12>\x0A\x11partition_options\x18\x09 \x01(\x0B2#.google.spanner.v1.PartitionOptions\"\$\x0A\x09Partition\x12\x17\x0A\x0Fpartition_token\x18\x01 \x01(\x0C\"z\x0A\x11PartitionResponse\x120\x0A\x0Apartitions\x18\x01 \x03(\x0B2\x1C.google.spanner.v1.Partition\x123\x0A\x0Btransaction\x18\x02 \x01(\x0B2\x1E.google.spanner.v1.Transaction\"\xB1\x06\x0A\x0BReadRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12;\x0A\x0Btransaction\x18\x02 \x01(\x0B2&.google.spanner.v1.TransactionSelector\x12\x12\x0A\x05table\x18\x03 \x01(\x09B\x03\xE0A\x02\x12\x0D\x0A\x05index\x18\x04 \x01(\x09\x12\x14\x0A\x07columns\x18\x05 \x03(\x09B\x03\xE0A\x02\x12/\x0A\x07key_set\x18\x06 \x01(\x0B2\x19.google.spanner.v1.KeySetB\x03\xE0A\x02\x12\x0D\x0A\x05limit\x18\x08 \x01(\x03\x12\x14\x0A\x0Cresume_token\x18\x09 \x01(\x0C\x12\x17\x0A\x0Fpartition_token\x18\x0A \x01(\x0C\x12:\x0A\x0Frequest_options\x18\x0B \x01(\x0B2!.google.spanner.v1.RequestOptions\x12E\x0A\x15directed_read_options\x18\x0E \x01(\x0B2&.google.spanner.v1.DirectedReadOptions\x12\x1A\x0A\x12data_boost_enabled\x18\x0F \x01(\x08\x12=\x0A\x08order_by\x18\x10 \x01(\x0E2&.google.spanner.v1.ReadRequest.OrderByB\x03\xE0A\x01\x12?\x0A\x09lock_hint\x18\x11 \x01(\x0E2'.google.spanner.v1.ReadRequest.LockHintB\x03\xE0A\x01\x129\x0A\x0Crouting_hint\x18\x12 \x01(\x0B2\x1E.google.spanner.v1.RoutingHintB\x03\xE0A\x01\"T\x0A\x07OrderBy\x12\x18\x0A\x14ORDER_BY_UNSPECIFIED\x10\x00\x12\x18\x0A\x14ORDER_BY_PRIMARY_KEY\x10\x01\x12\x15\x0A\x11ORDER_BY_NO_ORDER\x10\x02\"T\x0A\x08LockHint\x12\x19\x0A\x15LOCK_HINT_UNSPECIFIED\x10\x00\x12\x14\x0A\x10LOCK_HINT_SHARED\x10\x01\x12\x17\x0A\x13LOCK_HINT_EXCLUSIVE\x10\x02\"\xBE\x02\x0A\x17BeginTransactionRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12;\x0A\x07options\x18\x02 \x01(\x0B2%.google.spanner.v1.TransactionOptionsB\x03\xE0A\x02\x12:\x0A\x0Frequest_options\x18\x03 \x01(\x0B2!.google.spanner.v1.RequestOptions\x126\x0A\x0Cmutation_key\x18\x04 \x01(\x0B2\x1B.google.spanner.v1.MutationB\x03\xE0A\x01\x129\x0A\x0Crouting_hint\x18\x05 \x01(\x0B2\x1E.google.spanner.v1.RoutingHintB\x03\xE0A\x01\"\x8B\x04\x0A\x0DCommitRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12\x18\x0A\x0Etransaction_id\x18\x02 \x01(\x0CH\x00\x12G\x0A\x16single_use_transaction\x18\x03 \x01(\x0B2%.google.spanner.v1.TransactionOptionsH\x00\x12.\x0A\x09mutations\x18\x04 \x03(\x0B2\x1B.google.spanner.v1.Mutation\x12\x1B\x0A\x13return_commit_stats\x18\x05 \x01(\x08\x128\x0A\x10max_commit_delay\x18\x08 \x01(\x0B2\x19.google.protobuf.DurationB\x03\xE0A\x01\x12:\x0A\x0Frequest_options\x18\x06 \x01(\x0B2!.google.spanner.v1.RequestOptions\x12Q\x0A\x0Fprecommit_token\x18\x09 \x01(\x0B23.google.spanner.v1.MultiplexedSessionPrecommitTokenB\x03\xE0A\x01\x129\x0A\x0Crouting_hint\x18\x0A \x01(\x0B2\x1E.google.spanner.v1.RoutingHintB\x03\xE0A\x01B\x0D\x0A\x0Btransaction\"g\x0A\x0FRollbackRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12\x1B\x0A\x0Etransaction_id\x18\x02 \x01(\x0CB\x03\xE0A\x02\"\xCE\x02\x0A\x11BatchWriteRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12:\x0A\x0Frequest_options\x18\x03 \x01(\x0B2!.google.spanner.v1.RequestOptions\x12P\x0A\x0Fmutation_groups\x18\x04 \x03(\x0B22.google.spanner.v1.BatchWriteRequest.MutationGroupB\x03\xE0A\x02\x12,\x0A\x1Fexclude_txn_from_change_streams\x18\x05 \x01(\x08B\x03\xE0A\x01\x1AD\x0A\x0DMutationGroup\x123\x0A\x09mutations\x18\x01 \x03(\x0B2\x1B.google.spanner.v1.MutationB\x03\xE0A\x02\"\x7F\x0A\x12BatchWriteResponse\x12\x0F\x0A\x07indexes\x18\x01 \x03(\x05\x12\"\x0A\x06status\x18\x02 \x01(\x0B2\x12.google.rpc.Status\x124\x0A\x10commit_timestamp\x18\x03 \x01(\x0B2\x1A.google.protobuf.Timestamp2\x8B\x18\x0A\x07Spanner\x12\xA6\x01\x0A\x0DCreateSession\x12'.google.spanner.v1.CreateSessionRequest\x1A\x1A.google.spanner.v1.Session\"P\xDAA\x08database\x82\xD3\xE4\x93\x02?\":/v1/{database=projects/*/instances/*/databases/*}/sessions:\x01*\x12\xE0\x01\x0A\x13BatchCreateSessions\x12-.google.spanner.v1.BatchCreateSessionsRequest\x1A..google.spanner.v1.BatchCreateSessionsResponse\"j\xDAA\x16database,session_count\x82\xD3\xE4\x93\x02K\"F/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate:\x01*\x12\x97\x01\x0A\x0AGetSession\x12\$.google.spanner.v1.GetSessionRequest\x1A\x1A.google.spanner.v1.Session\"G\xDAA\x04name\x82\xD3\xE4\x93\x02:\x128/v1/{name=projects/*/instances/*/databases/*/sessions/*}\x12\xAE\x01\x0A\x0CListSessions\x12&.google.spanner.v1.ListSessionsRequest\x1A'.google.spanner.v1.ListSessionsResponse\"M\xDAA\x08database\x82\xD3\xE4\x93\x02<\x12:/v1/{database=projects/*/instances/*/databases/*}/sessions\x12\x99\x01\x0A\x0DDeleteSession\x12'.google.spanner.v1.DeleteSessionRequest\x1A\x16.google.protobuf.Empty\"G\xDAA\x04name\x82\xD3\xE4\x93\x02:*8/v1/{name=projects/*/instances/*/databases/*/sessions/*}\x12\xA3\x01\x0A\x0AExecuteSql\x12\$.google.spanner.v1.ExecuteSqlRequest\x1A\x1C.google.spanner.v1.ResultSet\"Q\x82\xD3\xE4\x93\x02K\"F/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeSql:\x01*\x12\xBE\x01\x0A\x13ExecuteStreamingSql\x12\$.google.spanner.v1.ExecuteSqlRequest\x1A#.google.spanner.v1.PartialResultSet\"Z\x82\xD3\xE4\x93\x02T\"O/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeStreamingSql:\x01*0\x01\x12\xC0\x01\x0A\x0FExecuteBatchDml\x12).google.spanner.v1.ExecuteBatchDmlRequest\x1A*.google.spanner.v1.ExecuteBatchDmlResponse\"V\x82\xD3\xE4\x93\x02P\"K/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml:\x01*\x12\x91\x01\x0A\x04Read\x12\x1E.google.spanner.v1.ReadRequest\x1A\x1C.google.spanner.v1.ResultSet\"K\x82\xD3\xE4\x93\x02E\"@/v1/{session=projects/*/instances/*/databases/*/sessions/*}:read:\x01*\x12\xAC\x01\x0A\x0DStreamingRead\x12\x1E.google.spanner.v1.ReadRequest\x1A#.google.spanner.v1.PartialResultSet\"T\x82\xD3\xE4\x93\x02N\"I/v1/{session=projects/*/instances/*/databases/*/sessions/*}:streamingRead:\x01*0\x01\x12\xC9\x01\x0A\x10BeginTransaction\x12*.google.spanner.v1.BeginTransactionRequest\x1A\x1E.google.spanner.v1.Transaction\"i\xDAA\x0Fsession,options\x82\xD3\xE4\x93\x02Q\"L/v1/{session=projects/*/instances/*/databases/*/sessions/*}:beginTransaction:\x01*\x12\xEB\x01\x0A\x06Commit\x12 .google.spanner.v1.CommitRequest\x1A!.google.spanner.v1.CommitResponse\"\x9B\x01\xDAA session,transaction_id,mutations\xDAA(session,single_use_transaction,mutations\x82\xD3\xE4\x93\x02G\"B/v1/{session=projects/*/instances/*/databases/*/sessions/*}:commit:\x01*\x12\xB0\x01\x0A\x08Rollback\x12\".google.spanner.v1.RollbackRequest\x1A\x16.google.protobuf.Empty\"h\xDAA\x16session,transaction_id\x82\xD3\xE4\x93\x02I\"D/v1/{session=projects/*/instances/*/databases/*/sessions/*}:rollback:\x01*\x12\xB7\x01\x0A\x0EPartitionQuery\x12(.google.spanner.v1.PartitionQueryRequest\x1A\$.google.spanner.v1.PartitionResponse\"U\x82\xD3\xE4\x93\x02O\"J/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionQuery:\x01*\x12\xB4\x01\x0A\x0DPartitionRead\x12'.google.spanner.v1.PartitionReadRequest\x1A\$.google.spanner.v1.PartitionResponse\"T\x82\xD3\xE4\x93\x02N\"I/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionRead:\x01*\x12\xC8\x01\x0A\x0ABatchWrite\x12\$.google.spanner.v1.BatchWriteRequest\x1A%.google.spanner.v1.BatchWriteResponse\"k\xDAA\x17session,mutation_groups\x82\xD3\xE4\x93\x02K\"F/v1/{session=projects/*/instances/*/databases/*/sessions/*}:batchWrite:\x01*0\x01\x1Aw\xCAA\x16spanner.googleapis.com\xD2A[https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/spanner.dataB\x91\x02\x0A\x15com.google.spanner.v1B\x0CSpannerProtoP\x01Z5cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb\xAA\x02\x17Google.Cloud.Spanner.V1\xCA\x02\x17Google\\Cloud\\Spanner\\V1\xEA\x02\x1AGoogle::Cloud::Spanner::V1\xEAA_\x0A\x1Fspanner.googleapis.com/Database\x12\x0A\x11partition_options\x18\x06 \x01(\x0B2#.google.spanner.v1.PartitionOptions\x1AJ\x0A\x0FParamTypesEntry\x12\x0B\x0A\x03key\x18\x01 \x01(\x09\x12&\x0A\x05value\x18\x02 \x01(\x0B2\x17.google.spanner.v1.Type:\x028\x01\"\xB1\x02\x0A\x14PartitionReadRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12;\x0A\x0Btransaction\x18\x02 \x01(\x0B2&.google.spanner.v1.TransactionSelector\x12\x12\x0A\x05table\x18\x03 \x01(\x09B\x03\xE0A\x02\x12\x0D\x0A\x05index\x18\x04 \x01(\x09\x12\x0F\x0A\x07columns\x18\x05 \x03(\x09\x12/\x0A\x07key_set\x18\x06 \x01(\x0B2\x19.google.spanner.v1.KeySetB\x03\xE0A\x02\x12>\x0A\x11partition_options\x18\x09 \x01(\x0B2#.google.spanner.v1.PartitionOptions\"\$\x0A\x09Partition\x12\x17\x0A\x0Fpartition_token\x18\x01 \x01(\x0C\"z\x0A\x11PartitionResponse\x120\x0A\x0Apartitions\x18\x01 \x03(\x0B2\x1C.google.spanner.v1.Partition\x123\x0A\x0Btransaction\x18\x02 \x01(\x0B2\x1E.google.spanner.v1.Transaction\"\xB1\x06\x0A\x0BReadRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12;\x0A\x0Btransaction\x18\x02 \x01(\x0B2&.google.spanner.v1.TransactionSelector\x12\x12\x0A\x05table\x18\x03 \x01(\x09B\x03\xE0A\x02\x12\x0D\x0A\x05index\x18\x04 \x01(\x09\x12\x14\x0A\x07columns\x18\x05 \x03(\x09B\x03\xE0A\x02\x12/\x0A\x07key_set\x18\x06 \x01(\x0B2\x19.google.spanner.v1.KeySetB\x03\xE0A\x02\x12\x0D\x0A\x05limit\x18\x08 \x01(\x03\x12\x14\x0A\x0Cresume_token\x18\x09 \x01(\x0C\x12\x17\x0A\x0Fpartition_token\x18\x0A \x01(\x0C\x12:\x0A\x0Frequest_options\x18\x0B \x01(\x0B2!.google.spanner.v1.RequestOptions\x12E\x0A\x15directed_read_options\x18\x0E \x01(\x0B2&.google.spanner.v1.DirectedReadOptions\x12\x1A\x0A\x12data_boost_enabled\x18\x0F \x01(\x08\x12=\x0A\x08order_by\x18\x10 \x01(\x0E2&.google.spanner.v1.ReadRequest.OrderByB\x03\xE0A\x01\x12?\x0A\x09lock_hint\x18\x11 \x01(\x0E2'.google.spanner.v1.ReadRequest.LockHintB\x03\xE0A\x01\x129\x0A\x0Crouting_hint\x18\x12 \x01(\x0B2\x1E.google.spanner.v1.RoutingHintB\x03\xE0A\x01\"T\x0A\x07OrderBy\x12\x18\x0A\x14ORDER_BY_UNSPECIFIED\x10\x00\x12\x18\x0A\x14ORDER_BY_PRIMARY_KEY\x10\x01\x12\x15\x0A\x11ORDER_BY_NO_ORDER\x10\x02\"T\x0A\x08LockHint\x12\x19\x0A\x15LOCK_HINT_UNSPECIFIED\x10\x00\x12\x14\x0A\x10LOCK_HINT_SHARED\x10\x01\x12\x17\x0A\x13LOCK_HINT_EXCLUSIVE\x10\x02\"\xBE\x02\x0A\x17BeginTransactionRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12;\x0A\x07options\x18\x02 \x01(\x0B2%.google.spanner.v1.TransactionOptionsB\x03\xE0A\x02\x12:\x0A\x0Frequest_options\x18\x03 \x01(\x0B2!.google.spanner.v1.RequestOptions\x126\x0A\x0Cmutation_key\x18\x04 \x01(\x0B2\x1B.google.spanner.v1.MutationB\x03\xE0A\x01\x129\x0A\x0Crouting_hint\x18\x05 \x01(\x0B2\x1E.google.spanner.v1.RoutingHintB\x03\xE0A\x01\"\x8B\x04\x0A\x0DCommitRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12\x18\x0A\x0Etransaction_id\x18\x02 \x01(\x0CH\x00\x12G\x0A\x16single_use_transaction\x18\x03 \x01(\x0B2%.google.spanner.v1.TransactionOptionsH\x00\x12.\x0A\x09mutations\x18\x04 \x03(\x0B2\x1B.google.spanner.v1.Mutation\x12\x1B\x0A\x13return_commit_stats\x18\x05 \x01(\x08\x128\x0A\x10max_commit_delay\x18\x08 \x01(\x0B2\x19.google.protobuf.DurationB\x03\xE0A\x01\x12:\x0A\x0Frequest_options\x18\x06 \x01(\x0B2!.google.spanner.v1.RequestOptions\x12Q\x0A\x0Fprecommit_token\x18\x09 \x01(\x0B23.google.spanner.v1.MultiplexedSessionPrecommitTokenB\x03\xE0A\x01\x129\x0A\x0Crouting_hint\x18\x0A \x01(\x0B2\x1E.google.spanner.v1.RoutingHintB\x03\xE0A\x01B\x0D\x0A\x0Btransaction\"g\x0A\x0FRollbackRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12\x1B\x0A\x0Etransaction_id\x18\x02 \x01(\x0CB\x03\xE0A\x02\"\xCE\x02\x0A\x11BatchWriteRequest\x127\x0A\x07session\x18\x01 \x01(\x09B&\xE0A\x02\xFAA \x0A\x1Espanner.googleapis.com/Session\x12:\x0A\x0Frequest_options\x18\x03 \x01(\x0B2!.google.spanner.v1.RequestOptions\x12P\x0A\x0Fmutation_groups\x18\x04 \x03(\x0B22.google.spanner.v1.BatchWriteRequest.MutationGroupB\x03\xE0A\x02\x12,\x0A\x1Fexclude_txn_from_change_streams\x18\x05 \x01(\x08B\x03\xE0A\x01\x1AD\x0A\x0DMutationGroup\x123\x0A\x09mutations\x18\x01 \x03(\x0B2\x1B.google.spanner.v1.MutationB\x03\xE0A\x02\"\x7F\x0A\x12BatchWriteResponse\x12\x0F\x0A\x07indexes\x18\x01 \x03(\x05\x12\"\x0A\x06status\x18\x02 \x01(\x0B2\x12.google.rpc.Status\x124\x0A\x10commit_timestamp\x18\x03 \x01(\x0B2\x1A.google.protobuf.Timestamp\"\x91\x01\x0A\x17FetchCacheUpdateRequest\x129\x0A\x08database\x18\x01 \x01(\x09B'\xE0A\x02\xFAA!\x0A\x1Fspanner.googleapis.com/Database\x12\x1D\x0A\x10max_recipe_count\x18\x02 \x01(\x05B\x03\xE0A\x01\x12\x1C\x0A\x0Fmax_range_count\x18\x03 \x01(\x05B\x03\xE0A\x012\xC3\x19\x0A\x07Spanner\x12\xA6\x01\x0A\x0DCreateSession\x12'.google.spanner.v1.CreateSessionRequest\x1A\x1A.google.spanner.v1.Session\"P\xDAA\x08database\x82\xD3\xE4\x93\x02?\":/v1/{database=projects/*/instances/*/databases/*}/sessions:\x01*\x12\xE0\x01\x0A\x13BatchCreateSessions\x12-.google.spanner.v1.BatchCreateSessionsRequest\x1A..google.spanner.v1.BatchCreateSessionsResponse\"j\xDAA\x16database,session_count\x82\xD3\xE4\x93\x02K\"F/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate:\x01*\x12\x97\x01\x0A\x0AGetSession\x12\$.google.spanner.v1.GetSessionRequest\x1A\x1A.google.spanner.v1.Session\"G\xDAA\x04name\x82\xD3\xE4\x93\x02:\x128/v1/{name=projects/*/instances/*/databases/*/sessions/*}\x12\xAE\x01\x0A\x0CListSessions\x12&.google.spanner.v1.ListSessionsRequest\x1A'.google.spanner.v1.ListSessionsResponse\"M\xDAA\x08database\x82\xD3\xE4\x93\x02<\x12:/v1/{database=projects/*/instances/*/databases/*}/sessions\x12\x99\x01\x0A\x0DDeleteSession\x12'.google.spanner.v1.DeleteSessionRequest\x1A\x16.google.protobuf.Empty\"G\xDAA\x04name\x82\xD3\xE4\x93\x02:*8/v1/{name=projects/*/instances/*/databases/*/sessions/*}\x12\xA3\x01\x0A\x0AExecuteSql\x12\$.google.spanner.v1.ExecuteSqlRequest\x1A\x1C.google.spanner.v1.ResultSet\"Q\x82\xD3\xE4\x93\x02K\"F/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeSql:\x01*\x12\xBE\x01\x0A\x13ExecuteStreamingSql\x12\$.google.spanner.v1.ExecuteSqlRequest\x1A#.google.spanner.v1.PartialResultSet\"Z\x82\xD3\xE4\x93\x02T\"O/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeStreamingSql:\x01*0\x01\x12\xC0\x01\x0A\x0FExecuteBatchDml\x12).google.spanner.v1.ExecuteBatchDmlRequest\x1A*.google.spanner.v1.ExecuteBatchDmlResponse\"V\x82\xD3\xE4\x93\x02P\"K/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml:\x01*\x12\x91\x01\x0A\x04Read\x12\x1E.google.spanner.v1.ReadRequest\x1A\x1C.google.spanner.v1.ResultSet\"K\x82\xD3\xE4\x93\x02E\"@/v1/{session=projects/*/instances/*/databases/*/sessions/*}:read:\x01*\x12\xAC\x01\x0A\x0DStreamingRead\x12\x1E.google.spanner.v1.ReadRequest\x1A#.google.spanner.v1.PartialResultSet\"T\x82\xD3\xE4\x93\x02N\"I/v1/{session=projects/*/instances/*/databases/*/sessions/*}:streamingRead:\x01*0\x01\x12\xC9\x01\x0A\x10BeginTransaction\x12*.google.spanner.v1.BeginTransactionRequest\x1A\x1E.google.spanner.v1.Transaction\"i\xDAA\x0Fsession,options\x82\xD3\xE4\x93\x02Q\"L/v1/{session=projects/*/instances/*/databases/*/sessions/*}:beginTransaction:\x01*\x12\xEB\x01\x0A\x06Commit\x12 .google.spanner.v1.CommitRequest\x1A!.google.spanner.v1.CommitResponse\"\x9B\x01\xDAA session,transaction_id,mutations\xDAA(session,single_use_transaction,mutations\x82\xD3\xE4\x93\x02G\"B/v1/{session=projects/*/instances/*/databases/*/sessions/*}:commit:\x01*\x12\xB0\x01\x0A\x08Rollback\x12\".google.spanner.v1.RollbackRequest\x1A\x16.google.protobuf.Empty\"h\xDAA\x16session,transaction_id\x82\xD3\xE4\x93\x02I\"D/v1/{session=projects/*/instances/*/databases/*/sessions/*}:rollback:\x01*\x12\xB7\x01\x0A\x0EPartitionQuery\x12(.google.spanner.v1.PartitionQueryRequest\x1A\$.google.spanner.v1.PartitionResponse\"U\x82\xD3\xE4\x93\x02O\"J/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionQuery:\x01*\x12\xB4\x01\x0A\x0DPartitionRead\x12'.google.spanner.v1.PartitionReadRequest\x1A\$.google.spanner.v1.PartitionResponse\"T\x82\xD3\xE4\x93\x02N\"I/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionRead:\x01*\x12\xC8\x01\x0A\x0ABatchWrite\x12\$.google.spanner.v1.BatchWriteRequest\x1A%.google.spanner.v1.BatchWriteResponse\"k\xDAA\x17session,mutation_groups\x82\xD3\xE4\x93\x02K\"F/v1/{session=projects/*/instances/*/databases/*/sessions/*}:batchWrite:\x01*0\x01\x12\xB5\x01\x0A\x10FetchCacheUpdate\x12*.google.spanner.v1.FetchCacheUpdateRequest\x1A\x1E.google.spanner.v1.CacheUpdate\"S\xDAA\x08database\x82\xD3\xE4\x93\x02B\"=/v1/{database=projects/*/instances/*/databases/*}:cacheUpdate:\x01*0\x01\x1Aw\xCAA\x16spanner.googleapis.com\xD2A[https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/spanner.dataB\x91\x02\x0A\x15com.google.spanner.v1B\x0CSpannerProtoP\x01Z5cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb\xAA\x02\x17Google.Cloud.Spanner.V1\xCA\x02\x17Google\\Cloud\\Spanner\\V1\xEA\x02\x1AGoogle::Cloud::Spanner::V1\xEAA_\x0A\x1Fspanner.googleapis.com/Database\x12setDatabase($formattedDatabase); + + // Call the API and handle any network failures. + try { + /** @var ServerStream $stream */ + $stream = $spannerClient->fetchCacheUpdate($request); + + /** @var CacheUpdate $element */ + foreach ($stream->readAll() as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedDatabase = SpannerClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + + fetch_cache_update_sample($formattedDatabase); +} +// [END spanner_v1_generated_Spanner_FetchCacheUpdate_sync] diff --git a/Spanner/src/V1/Client/SpannerClient.php b/Spanner/src/V1/Client/SpannerClient.php index 75ed7b7d312b..cc303019e70a 100644 --- a/Spanner/src/V1/Client/SpannerClient.php +++ b/Spanner/src/V1/Client/SpannerClient.php @@ -41,6 +41,7 @@ use Google\Cloud\Spanner\V1\BatchWriteRequest; use Google\Cloud\Spanner\V1\BatchWriteResponse; use Google\Cloud\Spanner\V1\BeginTransactionRequest; +use Google\Cloud\Spanner\V1\CacheUpdate; use Google\Cloud\Spanner\V1\CommitRequest; use Google\Cloud\Spanner\V1\CommitResponse; use Google\Cloud\Spanner\V1\CreateSessionRequest; @@ -49,6 +50,7 @@ use Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement; use Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse; use Google\Cloud\Spanner\V1\ExecuteSqlRequest; +use Google\Cloud\Spanner\V1\FetchCacheUpdateRequest; use Google\Cloud\Spanner\V1\GetSessionRequest; use Google\Cloud\Spanner\V1\ListSessionsRequest; use Google\Cloud\Spanner\V1\Mutation; @@ -608,6 +610,36 @@ public function executeStreamingSql(ExecuteSqlRequest $request, array $callOptio return $this->startApiCall('ExecuteStreamingSql', $request, $callOptions); } + /** + * Retrieves a cache update for a given database. + * + * This RPC can be used to warm up the client cache by fetching key recipes + * and server information for a given database. It is recommended to call + * this RPC at the beginning of the client's lifecycle, prior to any other + * data plane operations. + * + * The cache update is returned as a stream because the response can be too + * large to fit into a single `CacheUpdate` message. + * + * @example samples/V1/SpannerClient/fetch_cache_update.php + * + * @param FetchCacheUpdateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return ServerStream + * + * @throws ApiException Thrown if the API call fails. + */ + public function fetchCacheUpdate(FetchCacheUpdateRequest $request, array $callOptions = []): ServerStream + { + return $this->startApiCall('FetchCacheUpdate', $request, $callOptions); + } + /** * Gets a session. Returns `NOT_FOUND` if the session doesn't exist. * This is mainly useful for determining whether a session is still diff --git a/Spanner/src/V1/FetchCacheUpdateRequest.php b/Spanner/src/V1/FetchCacheUpdateRequest.php new file mode 100644 index 000000000000..e89eebc80aa6 --- /dev/null +++ b/Spanner/src/V1/FetchCacheUpdateRequest.php @@ -0,0 +1,158 @@ +google.spanner.v1.FetchCacheUpdateRequest + */ +class FetchCacheUpdateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The database for which to retrieve the cache update. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $database = ''; + /** + * Optional. The maximum number of key recipes to return in the response. + * If not set, a default limit of 100 will be used. + * + * Generated from protobuf field int32 max_recipe_count = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_recipe_count = 0; + /** + * Optional. The maximum number of ranges to return in the response. + * If not set, a default limit of 10000 will be used. + * + * Generated from protobuf field int32 max_range_count = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_range_count = 0; + + /** + * @param string $database Required. The database for which to retrieve the cache update. Please see + * {@see SpannerClient::databaseName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\V1\FetchCacheUpdateRequest + * + * @experimental + */ + public static function build(string $database): self + { + return (new self()) + ->setDatabase($database); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * Required. The database for which to retrieve the cache update. + * @type int $max_recipe_count + * Optional. The maximum number of key recipes to return in the response. + * If not set, a default limit of 100 will be used. + * @type int $max_range_count + * Optional. The maximum number of ranges to return in the response. + * If not set, a default limit of 10000 will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The database for which to retrieve the cache update. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * Required. The database for which to retrieve the cache update. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + + /** + * Optional. The maximum number of key recipes to return in the response. + * If not set, a default limit of 100 will be used. + * + * Generated from protobuf field int32 max_recipe_count = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getMaxRecipeCount() + { + return $this->max_recipe_count; + } + + /** + * Optional. The maximum number of key recipes to return in the response. + * If not set, a default limit of 100 will be used. + * + * Generated from protobuf field int32 max_recipe_count = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setMaxRecipeCount($var) + { + GPBUtil::checkInt32($var); + $this->max_recipe_count = $var; + + return $this; + } + + /** + * Optional. The maximum number of ranges to return in the response. + * If not set, a default limit of 10000 will be used. + * + * Generated from protobuf field int32 max_range_count = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getMaxRangeCount() + { + return $this->max_range_count; + } + + /** + * Optional. The maximum number of ranges to return in the response. + * If not set, a default limit of 10000 will be used. + * + * Generated from protobuf field int32 max_range_count = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setMaxRangeCount($var) + { + GPBUtil::checkInt32($var); + $this->max_range_count = $var; + + return $this; + } + +} + diff --git a/Spanner/src/V1/gapic_metadata.json b/Spanner/src/V1/gapic_metadata.json index 135ccdf08cb4..91718c416ec2 100644 --- a/Spanner/src/V1/gapic_metadata.json +++ b/Spanner/src/V1/gapic_metadata.json @@ -55,6 +55,11 @@ "executeStreamingSql" ] }, + "FetchCacheUpdate": { + "methods": [ + "fetchCacheUpdate" + ] + }, "GetSession": { "methods": [ "getSession" diff --git a/Spanner/src/V1/resources/spanner_client_config.json b/Spanner/src/V1/resources/spanner_client_config.json index e185586d033d..f64cf8898934 100644 --- a/Spanner/src/V1/resources/spanner_client_config.json +++ b/Spanner/src/V1/resources/spanner_client_config.json @@ -106,6 +106,9 @@ "ExecuteStreamingSql": { "timeout_millis": 3600000 }, + "FetchCacheUpdate": { + "timeout_millis": 60000 + }, "GetSession": { "timeout_millis": 30000, "retry_codes_name": "retry_policy_3_codes", diff --git a/Spanner/src/V1/resources/spanner_descriptor_config.php b/Spanner/src/V1/resources/spanner_descriptor_config.php index 144a3fdb958d..80d4ff4eba41 100644 --- a/Spanner/src/V1/resources/spanner_descriptor_config.php +++ b/Spanner/src/V1/resources/spanner_descriptor_config.php @@ -137,6 +137,21 @@ ], ], ], + 'FetchCacheUpdate' => [ + 'grpcStreaming' => [ + 'grpcStreamingType' => 'ServerStreaming', + ], + 'callType' => \Google\ApiCore\Call::SERVER_STREAMING_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\CacheUpdate', + 'headerParams' => [ + [ + 'keyName' => 'database', + 'fieldAccessors' => [ + 'getDatabase', + ], + ], + ], + ], 'GetSession' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Cloud\Spanner\V1\Session', diff --git a/Spanner/src/V1/resources/spanner_rest_client_config.php b/Spanner/src/V1/resources/spanner_rest_client_config.php index a8415b2edeeb..6dabce721b36 100644 --- a/Spanner/src/V1/resources/spanner_rest_client_config.php +++ b/Spanner/src/V1/resources/spanner_rest_client_config.php @@ -264,6 +264,18 @@ ], ], ], + 'FetchCacheUpdate' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}:cacheUpdate', + 'body' => '*', + 'placeholders' => [ + 'database' => [ + 'getters' => [ + 'getDatabase', + ], + ], + ], + ], 'GetSession' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/sessions/*}', diff --git a/Spanner/tests/Unit/V1/Client/SpannerClientTest.php b/Spanner/tests/Unit/V1/Client/SpannerClientTest.php index 42662493b10d..1928c529eb74 100644 --- a/Spanner/tests/Unit/V1/Client/SpannerClientTest.php +++ b/Spanner/tests/Unit/V1/Client/SpannerClientTest.php @@ -32,6 +32,7 @@ use Google\Cloud\Spanner\V1\BatchWriteRequest; use Google\Cloud\Spanner\V1\BatchWriteResponse; use Google\Cloud\Spanner\V1\BeginTransactionRequest; +use Google\Cloud\Spanner\V1\CacheUpdate; use Google\Cloud\Spanner\V1\Client\SpannerClient; use Google\Cloud\Spanner\V1\CommitRequest; use Google\Cloud\Spanner\V1\CommitResponse; @@ -40,6 +41,7 @@ use Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest; use Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse; use Google\Cloud\Spanner\V1\ExecuteSqlRequest; +use Google\Cloud\Spanner\V1\FetchCacheUpdateRequest; use Google\Cloud\Spanner\V1\GetSessionRequest; use Google\Cloud\Spanner\V1\KeySet; use Google\Cloud\Spanner\V1\ListSessionsRequest; @@ -748,6 +750,86 @@ public function executeStreamingSqlExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function fetchCacheUpdateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $databaseId = 816491103; + $expectedResponse = new CacheUpdate(); + $expectedResponse->setDatabaseId($databaseId); + $transport->addResponse($expectedResponse); + $databaseId2 = 1331062190; + $expectedResponse2 = new CacheUpdate(); + $expectedResponse2->setDatabaseId($databaseId2); + $transport->addResponse($expectedResponse2); + $databaseId3 = 1331062189; + $expectedResponse3 = new CacheUpdate(); + $expectedResponse3->setDatabaseId($databaseId3); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new FetchCacheUpdateRequest()) + ->setDatabase($formattedDatabase); + $serverStream = $gapicClient->fetchCacheUpdate($request); + $this->assertInstanceOf(ServerStream::class, $serverStream); + $responses = iterator_to_array($serverStream->readAll()); + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/FetchCacheUpdate', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchCacheUpdateExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new FetchCacheUpdateRequest()) + ->setDatabase($formattedDatabase); + $serverStream = $gapicClient->fetchCacheUpdate($request); + $results = $serverStream->readAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function getSessionTest() {