Class: Google::Apis::BigtableadminV2::GoogleBigtableAdminV2TypeStructEncoding

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/bigtableadmin_v2/classes.rb,
lib/google/apis/bigtableadmin_v2/representations.rb,
lib/google/apis/bigtableadmin_v2/representations.rb

Overview

Rules used to convert to or from lower level types.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleBigtableAdminV2TypeStructEncoding

Returns a new instance of GoogleBigtableAdminV2TypeStructEncoding.



2486
2487
2488
# File 'lib/google/apis/bigtableadmin_v2/classes.rb', line 2486

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#delimited_bytesGoogle::Apis::BigtableadminV2::GoogleBigtableAdminV2TypeStructEncodingDelimitedBytes

Fields are encoded independently and concatenated with a configurable delimiter in between. A struct with no fields defined is encoded as a single delimiter. Sorted mode: - Fields are encoded in sorted mode. - Encoded field values must not contain any bytes <= delimiter[0] - Element-wise order is preserved: A < B if A[0] < B[0], or if A[0] == B[0] && A[1] < B[1], etc. Strict prefixes sort first. - This encoding does not support DESC field ordering. Distinct mode: - Fields are encoded in distinct mode. - Encoded field values must not contain delimiter[0]. Corresponds to the JSON property delimitedBytes



2448
2449
2450
# File 'lib/google/apis/bigtableadmin_v2/classes.rb', line 2448

def delimited_bytes
  @delimited_bytes
end

#ordered_code_bytesGoogle::Apis::BigtableadminV2::GoogleBigtableAdminV2TypeStructEncodingOrderedCodeBytes

Fields are encoded independently, then escaped and delimited by appling the following rules in order: - While the last remaining field is ASC or UNSPECIFIED, and encodes to the empty string "", remove it. - In each remaining field, replace all null bytes 0x00 with the fixed byte pair 0x00, 0xFF. - If any remaining field encodes to the empty string "", replace it with the fixed byte pair 0x00, 0x00. - Append the fixed byte pair 0x00, 0x01 to each remaining field, except for the last remaining field if it is ASC. - Bitwise negate all DESC fields. - Concatenate the results, or emit the fixed byte pair 0x00, 0x00 if there are no remaining fields to concatenate. Examples: - STRUCT() -> "\00\00" - STRUCT("") -> "\00\00" - STRUCT("", "") -> "\00\00" - STRUCT("", "B") -> "\00\00" + "\00\01" + "B" - STRUCT("A", "") -> "A" - STRUCT("", "B", "") -> "\00\00" + "\00\01" + "B" - STRUCT("A", "", "C") -> "A" + "\00\01" + "\00\00" + "\00\01" + "C" Examples for struct with DESC fields: `- STRUCT("" DESC) -> "\xFF\xFF" + " \xFF\xFE" - STRUCT("" DESC, "") -> "\xFF\xFF" + "\xFF\xFE" - STRUCT("" DESC, "" , "") -> "\xFF\xFF" + "\xFF\xFE" - STRUCT("" DESC, "A") -> "\xFF\xFF" + "\xFF\ xFE" + "A" - STRUCT("A", "" DESC, "") -> "A" + "\00\01" + "\xFF\xFF" + "\xFF\ xFE" - STRUCT("", "A" DESC) -> "\x00\x00" + "\x00\x01" + "\xBE" + "\xFF\xFE" Since null bytes are always escaped, this encoding can cause size blowup for encodings likeInt64.BigEndianBytesthat are likely to produce many such bytes. Sorted mode: - Fields are encoded in sorted mode. - All values supported by the field encodings are allowed. - Fields with unset or UNSPECIFIEDorder are treated asASC. - Element-wise order is preserved:A < BifA[0] < B[0], or ifA[0] == B[0] && A[1] < B[1], etc. Strict prefixes sort first. Distinct mode: - Fields are encoded in distinct mode. - All values supported by the field encodings are allowed. Corresponds to the JSON propertyorderedCodeBytes`



2478
2479
2480
# File 'lib/google/apis/bigtableadmin_v2/classes.rb', line 2478

def ordered_code_bytes
  @ordered_code_bytes
end

#singletonGoogle::Apis::BigtableadminV2::GoogleBigtableAdminV2TypeStructEncodingSingleton

Uses the encoding of fields[0].type as-is. Only valid if fields.size == 1. This encoding does not support DESC field ordering. Corresponds to the JSON property singleton



2484
2485
2486
# File 'lib/google/apis/bigtableadmin_v2/classes.rb', line 2484

def singleton
  @singleton
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



2491
2492
2493
2494
2495
# File 'lib/google/apis/bigtableadmin_v2/classes.rb', line 2491

def update!(**args)
  @delimited_bytes = args[:delimited_bytes] if args.key?(:delimited_bytes)
  @ordered_code_bytes = args[:ordered_code_bytes] if args.key?(:ordered_code_bytes)
  @singleton = args[:singleton] if args.key?(:singleton)
end