Class: Google::Cloud::Bigtable::ReadModifyWriteRule

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/bigtable/read_modify_write_rule.rb

Overview

ReadModifyWriteRule

Specifies an atomic read/modify/write operation on the latest value of the specified column.

Examples:

Append value rule

rule = Google::Cloud::Bigtable::ReadModifyWriteRule.append(
  "cf", "field01", "append-xyz"
)

increment value rule

rule = Google::Cloud::Bigtable::ReadModifyWriteRule.increment(
  "cf", "field01", 1
)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.append(family, qualifier, value) ⇒ Google::Cloud::Bigtable::ReadModifyWriteRule

Create append value rule instance.

Examples:

Append value rule

rule = Google::Cloud::Bigtable::ReadModifyWriteRule.append(
  "cf", "field01", "append-xyz"
)

Parameters:

  • family (String)

    The name of the family to which the read/modify/write should be applied.

  • qualifier (String)

    The qualifier of the column to which the read/modify/write should be applied.

  • value (String)

    Rule specifying that append_value be appended to the existing value. If the targeted cell is unset, it will be treated as containing the empty string.

Returns:



67
68
69
70
71
# File 'lib/google/cloud/bigtable/read_modify_write_rule.rb', line 67

def self.append family, qualifier, value
  rule = new(family, qualifier)
  rule.append(value)
  rule
end

.increment(family, qualifier, amount) ⇒ Google::Cloud::Bigtable::ReadModifyWriteRule

Create increment amount rule instance.

Examples:

increment value rule

rule = Google::Cloud::Bigtable::ReadModifyWriteRule.increment(
  "cf", "field01", 1
)

Parameters:

  • family (String)

    The name of the family to which the read/modify/write should be applied.

  • qualifier (String)

    The qualifier of the column to which the read/modify/write should be applied.

  • amount (String)

    Rule specifying that increment_amount be added to the existing value. If the targeted cell is unset, it will be treated as containing a zero. Otherwise, the targeted cell must contain an 8-byte value (interpreted as a 64-bit big-endian signed integer), or the entire request will fail.

Returns:



91
92
93
94
95
# File 'lib/google/cloud/bigtable/read_modify_write_rule.rb', line 91

def self.increment family, qualifier, amount
  rule = new(family, qualifier)
  rule.increment(amount)
  rule
end

Instance Method Details

#append(value) ⇒ Google::Cloud::Bigtable::ReadModifyWriteRule

Set append value.

Parameters:

  • value (String)

Returns:



102
103
104
105
# File 'lib/google/cloud/bigtable/read_modify_write_rule.rb', line 102

def append value
  @grpc.append_value = value
  self
end

#increment(amount) ⇒ Google::Cloud::Bigtable::ReadModifyWriteRule

Set increment amount.

Parameters:

  • amount (Integer)

Returns:



112
113
114
115
# File 'lib/google/cloud/bigtable/read_modify_write_rule.rb', line 112

def increment amount
  @grpc.increment_amount = amount
  self
end