diff --git a/Datastore/metadata/V1/Datastore.php b/Datastore/metadata/V1/Datastore.php index b06ea5d20319..5fd0a98c20b1 100644 Binary files a/Datastore/metadata/V1/Datastore.php and b/Datastore/metadata/V1/Datastore.php differ diff --git a/Datastore/src/V1/Mutation.php b/Datastore/src/V1/Mutation.php index 22be69b75280..d511ae376384 100644 --- a/Datastore/src/V1/Mutation.php +++ b/Datastore/src/V1/Mutation.php @@ -15,6 +15,14 @@ */ class Mutation extends \Google\Protobuf\Internal\Message { + /** + * The strategy to use when a conflict is detected. Defaults to + * `SERVER_VALUE`. + * If this is set, then `conflict_detection_strategy` must also be set. + * + * Generated from protobuf field .google.datastore.v1.Mutation.ConflictResolutionStrategy conflict_resolution_strategy = 10; + */ + private $conflict_resolution_strategy = 0; /** * The properties to write in this mutation. * None of the properties in the mask may have a reserved name, except for @@ -27,6 +35,15 @@ class Mutation extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.datastore.v1.PropertyMask property_mask = 9; */ private $property_mask = null; + /** + * Optional. The transforms to perform on the entity. + * This field can be set only when the operation is `insert`, `update`, + * or `upsert`. If present, the transforms are be applied to the entity + * regardless of the property mask, in order, after the operation. + * + * Generated from protobuf field repeated .google.datastore.v1.PropertyTransform property_transforms = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $property_transforms; protected $operation; protected $conflict_detection_strategy; @@ -56,6 +73,10 @@ class Mutation extends \Google\Protobuf\Internal\Message * The update time of the entity that this mutation is being applied * to. If this does not match the current update time on the server, the * mutation conflicts. + * @type int $conflict_resolution_strategy + * The strategy to use when a conflict is detected. Defaults to + * `SERVER_VALUE`. + * If this is set, then `conflict_detection_strategy` must also be set. * @type \Google\Cloud\Datastore\V1\PropertyMask $property_mask * The properties to write in this mutation. * None of the properties in the mask may have a reserved name, except for @@ -64,6 +85,11 @@ class Mutation extends \Google\Protobuf\Internal\Message * If the entity already exists, only properties referenced in the mask are * updated, others are left untouched. * Properties referenced in the mask but not in the entity are deleted. + * @type array<\Google\Cloud\Datastore\V1\PropertyTransform>|\Google\Protobuf\Internal\RepeatedField $property_transforms + * Optional. The transforms to perform on the entity. + * This field can be set only when the operation is `insert`, `update`, + * or `upsert`. If present, the transforms are be applied to the entity + * regardless of the property mask, in order, after the operation. * } */ public function __construct($data = NULL) { @@ -273,6 +299,36 @@ public function setUpdateTime($var) return $this; } + /** + * The strategy to use when a conflict is detected. Defaults to + * `SERVER_VALUE`. + * If this is set, then `conflict_detection_strategy` must also be set. + * + * Generated from protobuf field .google.datastore.v1.Mutation.ConflictResolutionStrategy conflict_resolution_strategy = 10; + * @return int + */ + public function getConflictResolutionStrategy() + { + return $this->conflict_resolution_strategy; + } + + /** + * The strategy to use when a conflict is detected. Defaults to + * `SERVER_VALUE`. + * If this is set, then `conflict_detection_strategy` must also be set. + * + * Generated from protobuf field .google.datastore.v1.Mutation.ConflictResolutionStrategy conflict_resolution_strategy = 10; + * @param int $var + * @return $this + */ + public function setConflictResolutionStrategy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\Mutation\ConflictResolutionStrategy::class); + $this->conflict_resolution_strategy = $var; + + return $this; + } + /** * The properties to write in this mutation. * None of the properties in the mask may have a reserved name, except for @@ -321,6 +377,38 @@ public function setPropertyMask($var) return $this; } + /** + * Optional. The transforms to perform on the entity. + * This field can be set only when the operation is `insert`, `update`, + * or `upsert`. If present, the transforms are be applied to the entity + * regardless of the property mask, in order, after the operation. + * + * Generated from protobuf field repeated .google.datastore.v1.PropertyTransform property_transforms = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPropertyTransforms() + { + return $this->property_transforms; + } + + /** + * Optional. The transforms to perform on the entity. + * This field can be set only when the operation is `insert`, `update`, + * or `upsert`. If present, the transforms are be applied to the entity + * regardless of the property mask, in order, after the operation. + * + * Generated from protobuf field repeated .google.datastore.v1.PropertyTransform property_transforms = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Datastore\V1\PropertyTransform>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPropertyTransforms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\PropertyTransform::class); + $this->property_transforms = $arr; + + return $this; + } + /** * @return string */ diff --git a/Datastore/src/V1/Mutation/ConflictResolutionStrategy.php b/Datastore/src/V1/Mutation/ConflictResolutionStrategy.php new file mode 100644 index 000000000000..f2809890ebe1 --- /dev/null +++ b/Datastore/src/V1/Mutation/ConflictResolutionStrategy.php @@ -0,0 +1,64 @@ +google.datastore.v1.Mutation.ConflictResolutionStrategy + */ +class ConflictResolutionStrategy +{ + /** + * Unspecified. Defaults to `SERVER_VALUE`. + * + * Generated from protobuf enum STRATEGY_UNSPECIFIED = 0; + */ + const STRATEGY_UNSPECIFIED = 0; + /** + * The server entity is kept. + * + * Generated from protobuf enum SERVER_VALUE = 1; + */ + const SERVER_VALUE = 1; + /** + * The whole commit request fails. + * + * Generated from protobuf enum FAIL = 3; + */ + const FAIL = 3; + + private static $valueToName = [ + self::STRATEGY_UNSPECIFIED => 'STRATEGY_UNSPECIFIED', + self::SERVER_VALUE => 'SERVER_VALUE', + self::FAIL => 'FAIL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ConflictResolutionStrategy::class, \Google\Cloud\Datastore\V1\Mutation_ConflictResolutionStrategy::class); + diff --git a/Datastore/src/V1/MutationResult.php b/Datastore/src/V1/MutationResult.php index a5a507fbbd95..388e3aae280f 100644 --- a/Datastore/src/V1/MutationResult.php +++ b/Datastore/src/V1/MutationResult.php @@ -54,6 +54,14 @@ class MutationResult extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool conflict_detected = 5; */ private $conflict_detected = false; + /** + * The results of applying each + * [PropertyTransform][google.datastore.v1.PropertyTransform], in the same + * order of the request. + * + * Generated from protobuf field repeated .google.datastore.v1.Value transform_results = 8; + */ + private $transform_results; /** * Constructor. @@ -80,6 +88,10 @@ class MutationResult extends \Google\Protobuf\Internal\Message * @type bool $conflict_detected * Whether a conflict was detected for this mutation. Always false when a * conflict detection strategy field is not set in the mutation. + * @type array<\Google\Cloud\Datastore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $transform_results + * The results of applying each + * [PropertyTransform][google.datastore.v1.PropertyTransform], in the same + * order of the request. * } */ public function __construct($data = NULL) { @@ -265,5 +277,35 @@ public function setConflictDetected($var) return $this; } + /** + * The results of applying each + * [PropertyTransform][google.datastore.v1.PropertyTransform], in the same + * order of the request. + * + * Generated from protobuf field repeated .google.datastore.v1.Value transform_results = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransformResults() + { + return $this->transform_results; + } + + /** + * The results of applying each + * [PropertyTransform][google.datastore.v1.PropertyTransform], in the same + * order of the request. + * + * Generated from protobuf field repeated .google.datastore.v1.Value transform_results = 8; + * @param array<\Google\Cloud\Datastore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransformResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Value::class); + $this->transform_results = $arr; + + return $this; + } + } diff --git a/Datastore/src/V1/PropertyTransform.php b/Datastore/src/V1/PropertyTransform.php new file mode 100644 index 000000000000..5be9066dcaa6 --- /dev/null +++ b/Datastore/src/V1/PropertyTransform.php @@ -0,0 +1,432 @@ +google.datastore.v1.PropertyTransform + */ +class PropertyTransform extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The name of the property. + * Property paths (a list of property names separated by dots (`.`)) may be + * used to refer to properties inside entity values. For example `foo.bar` + * means the property `bar` inside the entity property `foo`. + * If a property name contains a dot `.` or a backlslash `\`, then that name + * must be escaped. + * + * Generated from protobuf field string property = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $property = ''; + protected $transform_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $property + * Optional. The name of the property. + * Property paths (a list of property names separated by dots (`.`)) may be + * used to refer to properties inside entity values. For example `foo.bar` + * means the property `bar` inside the entity property `foo`. + * If a property name contains a dot `.` or a backlslash `\`, then that name + * must be escaped. + * @type int $set_to_server_value + * Sets the property to the given server value. + * @type \Google\Cloud\Datastore\V1\Value $increment + * Adds the given value to the property's current value. + * This must be an integer or a double value. + * If the property is not an integer or double, or if the property does not + * yet exist, the transformation will set the property to the given value. + * If either of the given value or the current property value are doubles, + * both values will be interpreted as doubles. Double arithmetic and + * representation of double values follows IEEE 754 semantics. + * If there is positive/negative integer overflow, the property is resolved + * to the largest magnitude positive/negative integer. + * @type \Google\Cloud\Datastore\V1\Value $maximum + * Sets the property to the maximum of its current value and the given + * value. + * This must be an integer or a double value. + * If the property is not an integer or double, or if the property does not + * yet exist, the transformation will set the property to the given value. + * If a maximum operation is applied where the property and the input value + * are of mixed types (that is - one is an integer and one is a double) + * the property takes on the type of the larger operand. If the operands are + * equivalent (e.g. 3 and 3.0), the property does not change. + * 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and + * zero input value is always the stored value. + * The maximum of any numeric value x and NaN is NaN. + * @type \Google\Cloud\Datastore\V1\Value $minimum + * Sets the property to the minimum of its current value and the given + * value. + * This must be an integer or a double value. + * If the property is not an integer or double, or if the property does not + * yet exist, the transformation will set the property to the input value. + * If a minimum operation is applied where the property and the input value + * are of mixed types (that is - one is an integer and one is a double) + * the property takes on the type of the smaller operand. If the operands + * are equivalent (e.g. 3 and 3.0), the property does not change. 0, 0.0, + * and -0.0 are all zero. The minimum of a zero stored value and zero input + * value is always the stored value. The minimum of any numeric value x and + * NaN is NaN. + * @type \Google\Cloud\Datastore\V1\ArrayValue $append_missing_elements + * Appends the given elements in order if they are not already present in + * the current property value. + * If the property is not an array, or if the property does not yet exist, + * it is first set to the empty array. + * Equivalent numbers of different types (e.g. 3L and 3.0) are + * considered equal when checking if a value is missing. + * NaN is equal to NaN, and the null value is equal to the null value. + * If the input contains multiple equivalent values, only the first will + * be considered. + * The corresponding transform result will be the null value. + * @type \Google\Cloud\Datastore\V1\ArrayValue $remove_all_from_array + * Removes all of the given elements from the array in the property. + * If the property is not an array, or if the property does not yet exist, + * it is set to the empty array. + * Equivalent numbers of different types (e.g. 3L and 3.0) are + * considered equal when deciding whether an element should be removed. + * NaN is equal to NaN, and the null value is equal to the null value. + * This will remove all equivalent values if there are duplicates. + * The corresponding transform result will be the null value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Datastore\V1\Datastore::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The name of the property. + * Property paths (a list of property names separated by dots (`.`)) may be + * used to refer to properties inside entity values. For example `foo.bar` + * means the property `bar` inside the entity property `foo`. + * If a property name contains a dot `.` or a backlslash `\`, then that name + * must be escaped. + * + * Generated from protobuf field string property = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getProperty() + { + return $this->property; + } + + /** + * Optional. The name of the property. + * Property paths (a list of property names separated by dots (`.`)) may be + * used to refer to properties inside entity values. For example `foo.bar` + * means the property `bar` inside the entity property `foo`. + * If a property name contains a dot `.` or a backlslash `\`, then that name + * must be escaped. + * + * Generated from protobuf field string property = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkString($var, True); + $this->property = $var; + + return $this; + } + + /** + * Sets the property to the given server value. + * + * Generated from protobuf field .google.datastore.v1.PropertyTransform.ServerValue set_to_server_value = 2; + * @return int + */ + public function getSetToServerValue() + { + return $this->readOneof(2); + } + + public function hasSetToServerValue() + { + return $this->hasOneof(2); + } + + /** + * Sets the property to the given server value. + * + * Generated from protobuf field .google.datastore.v1.PropertyTransform.ServerValue set_to_server_value = 2; + * @param int $var + * @return $this + */ + public function setSetToServerValue($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\PropertyTransform\ServerValue::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Adds the given value to the property's current value. + * This must be an integer or a double value. + * If the property is not an integer or double, or if the property does not + * yet exist, the transformation will set the property to the given value. + * If either of the given value or the current property value are doubles, + * both values will be interpreted as doubles. Double arithmetic and + * representation of double values follows IEEE 754 semantics. + * If there is positive/negative integer overflow, the property is resolved + * to the largest magnitude positive/negative integer. + * + * Generated from protobuf field .google.datastore.v1.Value increment = 3; + * @return \Google\Cloud\Datastore\V1\Value|null + */ + public function getIncrement() + { + return $this->readOneof(3); + } + + public function hasIncrement() + { + return $this->hasOneof(3); + } + + /** + * Adds the given value to the property's current value. + * This must be an integer or a double value. + * If the property is not an integer or double, or if the property does not + * yet exist, the transformation will set the property to the given value. + * If either of the given value or the current property value are doubles, + * both values will be interpreted as doubles. Double arithmetic and + * representation of double values follows IEEE 754 semantics. + * If there is positive/negative integer overflow, the property is resolved + * to the largest magnitude positive/negative integer. + * + * Generated from protobuf field .google.datastore.v1.Value increment = 3; + * @param \Google\Cloud\Datastore\V1\Value $var + * @return $this + */ + public function setIncrement($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Value::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Sets the property to the maximum of its current value and the given + * value. + * This must be an integer or a double value. + * If the property is not an integer or double, or if the property does not + * yet exist, the transformation will set the property to the given value. + * If a maximum operation is applied where the property and the input value + * are of mixed types (that is - one is an integer and one is a double) + * the property takes on the type of the larger operand. If the operands are + * equivalent (e.g. 3 and 3.0), the property does not change. + * 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and + * zero input value is always the stored value. + * The maximum of any numeric value x and NaN is NaN. + * + * Generated from protobuf field .google.datastore.v1.Value maximum = 4; + * @return \Google\Cloud\Datastore\V1\Value|null + */ + public function getMaximum() + { + return $this->readOneof(4); + } + + public function hasMaximum() + { + return $this->hasOneof(4); + } + + /** + * Sets the property to the maximum of its current value and the given + * value. + * This must be an integer or a double value. + * If the property is not an integer or double, or if the property does not + * yet exist, the transformation will set the property to the given value. + * If a maximum operation is applied where the property and the input value + * are of mixed types (that is - one is an integer and one is a double) + * the property takes on the type of the larger operand. If the operands are + * equivalent (e.g. 3 and 3.0), the property does not change. + * 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and + * zero input value is always the stored value. + * The maximum of any numeric value x and NaN is NaN. + * + * Generated from protobuf field .google.datastore.v1.Value maximum = 4; + * @param \Google\Cloud\Datastore\V1\Value $var + * @return $this + */ + public function setMaximum($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Value::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Sets the property to the minimum of its current value and the given + * value. + * This must be an integer or a double value. + * If the property is not an integer or double, or if the property does not + * yet exist, the transformation will set the property to the input value. + * If a minimum operation is applied where the property and the input value + * are of mixed types (that is - one is an integer and one is a double) + * the property takes on the type of the smaller operand. If the operands + * are equivalent (e.g. 3 and 3.0), the property does not change. 0, 0.0, + * and -0.0 are all zero. The minimum of a zero stored value and zero input + * value is always the stored value. The minimum of any numeric value x and + * NaN is NaN. + * + * Generated from protobuf field .google.datastore.v1.Value minimum = 5; + * @return \Google\Cloud\Datastore\V1\Value|null + */ + public function getMinimum() + { + return $this->readOneof(5); + } + + public function hasMinimum() + { + return $this->hasOneof(5); + } + + /** + * Sets the property to the minimum of its current value and the given + * value. + * This must be an integer or a double value. + * If the property is not an integer or double, or if the property does not + * yet exist, the transformation will set the property to the input value. + * If a minimum operation is applied where the property and the input value + * are of mixed types (that is - one is an integer and one is a double) + * the property takes on the type of the smaller operand. If the operands + * are equivalent (e.g. 3 and 3.0), the property does not change. 0, 0.0, + * and -0.0 are all zero. The minimum of a zero stored value and zero input + * value is always the stored value. The minimum of any numeric value x and + * NaN is NaN. + * + * Generated from protobuf field .google.datastore.v1.Value minimum = 5; + * @param \Google\Cloud\Datastore\V1\Value $var + * @return $this + */ + public function setMinimum($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Value::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Appends the given elements in order if they are not already present in + * the current property value. + * If the property is not an array, or if the property does not yet exist, + * it is first set to the empty array. + * Equivalent numbers of different types (e.g. 3L and 3.0) are + * considered equal when checking if a value is missing. + * NaN is equal to NaN, and the null value is equal to the null value. + * If the input contains multiple equivalent values, only the first will + * be considered. + * The corresponding transform result will be the null value. + * + * Generated from protobuf field .google.datastore.v1.ArrayValue append_missing_elements = 6; + * @return \Google\Cloud\Datastore\V1\ArrayValue|null + */ + public function getAppendMissingElements() + { + return $this->readOneof(6); + } + + public function hasAppendMissingElements() + { + return $this->hasOneof(6); + } + + /** + * Appends the given elements in order if they are not already present in + * the current property value. + * If the property is not an array, or if the property does not yet exist, + * it is first set to the empty array. + * Equivalent numbers of different types (e.g. 3L and 3.0) are + * considered equal when checking if a value is missing. + * NaN is equal to NaN, and the null value is equal to the null value. + * If the input contains multiple equivalent values, only the first will + * be considered. + * The corresponding transform result will be the null value. + * + * Generated from protobuf field .google.datastore.v1.ArrayValue append_missing_elements = 6; + * @param \Google\Cloud\Datastore\V1\ArrayValue $var + * @return $this + */ + public function setAppendMissingElements($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\ArrayValue::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Removes all of the given elements from the array in the property. + * If the property is not an array, or if the property does not yet exist, + * it is set to the empty array. + * Equivalent numbers of different types (e.g. 3L and 3.0) are + * considered equal when deciding whether an element should be removed. + * NaN is equal to NaN, and the null value is equal to the null value. + * This will remove all equivalent values if there are duplicates. + * The corresponding transform result will be the null value. + * + * Generated from protobuf field .google.datastore.v1.ArrayValue remove_all_from_array = 7; + * @return \Google\Cloud\Datastore\V1\ArrayValue|null + */ + public function getRemoveAllFromArray() + { + return $this->readOneof(7); + } + + public function hasRemoveAllFromArray() + { + return $this->hasOneof(7); + } + + /** + * Removes all of the given elements from the array in the property. + * If the property is not an array, or if the property does not yet exist, + * it is set to the empty array. + * Equivalent numbers of different types (e.g. 3L and 3.0) are + * considered equal when deciding whether an element should be removed. + * NaN is equal to NaN, and the null value is equal to the null value. + * This will remove all equivalent values if there are duplicates. + * The corresponding transform result will be the null value. + * + * Generated from protobuf field .google.datastore.v1.ArrayValue remove_all_from_array = 7; + * @param \Google\Cloud\Datastore\V1\ArrayValue $var + * @return $this + */ + public function setRemoveAllFromArray($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\ArrayValue::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * @return string + */ + public function getTransformType() + { + return $this->whichOneof("transform_type"); + } + +} + diff --git a/Datastore/src/V1/PropertyTransform/ServerValue.php b/Datastore/src/V1/PropertyTransform/ServerValue.php new file mode 100644 index 000000000000..6162f10f4c4d --- /dev/null +++ b/Datastore/src/V1/PropertyTransform/ServerValue.php @@ -0,0 +1,59 @@ +google.datastore.v1.PropertyTransform.ServerValue + */ +class ServerValue +{ + /** + * Unspecified. This value must not be used. + * + * Generated from protobuf enum SERVER_VALUE_UNSPECIFIED = 0; + */ + const SERVER_VALUE_UNSPECIFIED = 0; + /** + * The time at which the server processed the request, with millisecond + * precision. If used on multiple properties (same or different entities) + * in a transaction, all the properties will get the same server timestamp. + * + * Generated from protobuf enum REQUEST_TIME = 1; + */ + const REQUEST_TIME = 1; + + private static $valueToName = [ + self::SERVER_VALUE_UNSPECIFIED => 'SERVER_VALUE_UNSPECIFIED', + self::REQUEST_TIME => 'REQUEST_TIME', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ServerValue::class, \Google\Cloud\Datastore\V1\PropertyTransform_ServerValue::class); + diff --git a/Datastore/src/V1/resources/datastore_client_config.json b/Datastore/src/V1/resources/datastore_client_config.json index 135281a0a986..081d5f9f6b62 100644 --- a/Datastore/src/V1/resources/datastore_client_config.json +++ b/Datastore/src/V1/resources/datastore_client_config.json @@ -7,7 +7,8 @@ "UNAVAILABLE", "DEADLINE_EXCEEDED" ], - "no_retry_1_codes": [] + "no_retry_1_codes": [], + "no_retry_2_codes": [] }, "retry_params": { "no_retry_params": { @@ -36,6 +37,15 @@ "rpc_timeout_multiplier": 1.0, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 60000 + }, + "no_retry_2_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 } }, "methods": {