From cece74ca6c68e1c8d4323fb13184743be096af46 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 24 May 2024 13:58:51 +0530 Subject: [PATCH] feat: Add String type with Utf8Raw encoding to Bigtable API (#7338) Bigtable will allow users to configure the type of a column family with string type PiperOrigin-RevId: 636631633 Source-Link: https://github.com/googleapis/googleapis/commit/89a836483eaf7e3f8f41bde6c56831bca4b46e26 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d7767007eae0fe87755b21cfe569b8779f02151c Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6ImQ3NzY3MDA3ZWFlMGZlODc3NTViMjFjZmU1NjliODc3OWYwMjE1MWMifQ== --- Bigtable/metadata/Admin/V2/Types.php | Bin 1736 -> 1986 bytes Bigtable/src/Admin/V2/Type.php | 39 ++++++++- Bigtable/src/Admin/V2/Type/PBString.php | 81 ++++++++++++++++++ .../src/Admin/V2/Type/PBString/Encoding.php | 78 +++++++++++++++++ .../V2/Type/PBString/Encoding/Utf8Raw.php | 42 +++++++++ 5 files changed, 237 insertions(+), 3 deletions(-) create mode 100644 Bigtable/src/Admin/V2/Type/PBString.php create mode 100644 Bigtable/src/Admin/V2/Type/PBString/Encoding.php create mode 100644 Bigtable/src/Admin/V2/Type/PBString/Encoding/Utf8Raw.php diff --git a/Bigtable/metadata/Admin/V2/Types.php b/Bigtable/metadata/Admin/V2/Types.php index bee616b20e2a6164f9d554b74367dc2500212da2..4dedcc0cac878a14afce4a49ff34d23bfdc45ff6 100644 GIT binary patch delta 191 zcmX@Xdx(F7029k|E-sac-YSzVn53DGb4(6pau&1U;w~;J%FIiTFR3g@m0(g})ZjK! zom|Ky&lU_8-#nE`pHXfnBNvn}|029kw4lb36-YSzVn53D`vP}+Ua^8H6Nr!RsJ{A^c0M3RAt^fc4 diff --git a/Bigtable/src/Admin/V2/Type.php b/Bigtable/src/Admin/V2/Type.php index 8f116ff2aba4..671bfa8fadf8 100644 --- a/Bigtable/src/Admin/V2/Type.php +++ b/Bigtable/src/Admin/V2/Type.php @@ -22,18 +22,18 @@ * * Natural sort: Does the encoded value sort consistently with the original * typed value? Note that Bigtable will always sort data based on the raw * encoded value, *not* the decoded type. - * - Example: STRING values sort in the same order as their UTF-8 encodings. + * - Example: BYTES values sort in the same order as their raw encodings. * - Counterexample: Encoding INT64 to a fixed-width STRING does *not* * preserve sort order when dealing with negative numbers. * INT64(1) > INT64(-1), but STRING("-00001") > STRING("00001). - * - The overall encoding chain sorts naturally if *every* link does. + * - The overall encoding chain has this property if *every* link does. * * Self-delimiting: If we concatenate two encoded values, can we always tell * where the first one ends and the second one begins? * - Example: If we encode INT64s to fixed-width STRINGs, the first value * will always contain exactly N digits, possibly preceded by a sign. * - Counterexample: If we concatenate two UTF-8 encoded STRINGs, we have * no way to tell where the first one ends. - * - The overall encoding chain is self-delimiting if *any* link is. + * - The overall encoding chain has this property if *any* link does. * * Compatibility: Which other systems have matching encoding schemes? For * example, does this encoding have a GoogleSQL equivalent? HBase? Java? * @@ -51,6 +51,8 @@ class Type extends \Google\Protobuf\Internal\Message * * @type \Google\Cloud\Bigtable\Admin\V2\Type\Bytes $bytes_type * Bytes + * @type \Google\Cloud\Bigtable\Admin\V2\Type\PBString $string_type + * String * @type \Google\Cloud\Bigtable\Admin\V2\Type\Int64 $int64_type * Int64 * @type \Google\Cloud\Bigtable\Admin\V2\Type\Aggregate $aggregate_type @@ -93,6 +95,37 @@ public function setBytesType($var) return $this; } + /** + * String + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.String string_type = 2; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\PBString|null + */ + public function getStringType() + { + return $this->readOneof(2); + } + + public function hasStringType() + { + return $this->hasOneof(2); + } + + /** + * String + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.String string_type = 2; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\PBString $var + * @return $this + */ + public function setStringType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\PBString::class); + $this->writeOneof(2, $var); + + return $this; + } + /** * Int64 * diff --git a/Bigtable/src/Admin/V2/Type/PBString.php b/Bigtable/src/Admin/V2/Type/PBString.php new file mode 100644 index 000000000000..1d214453a67e --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/PBString.php @@ -0,0 +1,81 @@ +google.bigtable.admin.v2.Type.String + */ +class PBString extends \Google\Protobuf\Internal\Message +{ + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.String.Encoding encoding = 1; + */ + private $encoding = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\Type\PBString\Encoding $encoding + * The encoding to use when converting to/from lower level types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.String.Encoding encoding = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\PBString\Encoding|null + */ + public function getEncoding() + { + return $this->encoding; + } + + public function hasEncoding() + { + return isset($this->encoding); + } + + public function clearEncoding() + { + unset($this->encoding); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.String.Encoding encoding = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\PBString\Encoding $var + * @return $this + */ + public function setEncoding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\PBString\Encoding::class); + $this->encoding = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBString::class, \Google\Cloud\Bigtable\Admin\V2\Type_String::class); + diff --git a/Bigtable/src/Admin/V2/Type/PBString/Encoding.php b/Bigtable/src/Admin/V2/Type/PBString/Encoding.php new file mode 100644 index 000000000000..fd1365320bf9 --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/PBString/Encoding.php @@ -0,0 +1,78 @@ +google.bigtable.admin.v2.Type.String.Encoding + */ +class Encoding extends \Google\Protobuf\Internal\Message +{ + protected $encoding; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\Type\PBString\Encoding\Utf8Raw $utf8_raw + * Use `Utf8Raw` encoding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Use `Utf8Raw` encoding. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.String.Encoding.Utf8Raw utf8_raw = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\PBString\Encoding\Utf8Raw|null + */ + public function getUtf8Raw() + { + return $this->readOneof(1); + } + + public function hasUtf8Raw() + { + return $this->hasOneof(1); + } + + /** + * Use `Utf8Raw` encoding. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.String.Encoding.Utf8Raw utf8_raw = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\PBString\Encoding\Utf8Raw $var + * @return $this + */ + public function setUtf8Raw($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\PBString\Encoding\Utf8Raw::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getEncoding() + { + return $this->whichOneof("encoding"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Encoding::class, \Google\Cloud\Bigtable\Admin\V2\Type_String_Encoding::class); + diff --git a/Bigtable/src/Admin/V2/Type/PBString/Encoding/Utf8Raw.php b/Bigtable/src/Admin/V2/Type/PBString/Encoding/Utf8Raw.php new file mode 100644 index 000000000000..a474b3f01b72 --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/PBString/Encoding/Utf8Raw.php @@ -0,0 +1,42 @@ +google.bigtable.admin.v2.Type.String.Encoding.Utf8Raw + */ +class Utf8Raw extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Utf8Raw::class, \Google\Cloud\Bigtable\Admin\V2\Type_String_Encoding_Utf8Raw::class); +