class Google::Cloud::Bigtable::SingleClusterRouting

A single-cluster routing policy for all read/write requests that use the associated app profile.

Unconditionally routes all read/write requests to a specific cluster. This option preserves read-your-writes consistency, but does not improve availability.

@example

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new

instance = bigtable.instance "my-instance"

routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing(
  "my-cluster",
  allow_transactional_writes: true
)

app_profile = instance.create_app_profile(
  "my-app-profile",
  routing_policy,
  description: "App profile for user data instance"
)
puts app_profile.routing_policy

@!attribute [rw] cluster_id

@return [String]
  The cluster to which read/write requests should be routed.

@!attribute [rw] allow_transactional_writes

@return [true, false]
  If true, `CheckAndMutateRow` and `ReadModifyWriteRow` requests are
  allowed by this app profile. It is unsafe to send these requests to
  the same table/row/column in multiple clusters.
  Default value is false.

Attributes

allow_transactional_writes[R]
cluster_id[R]

Public Class Methods

new(cluster_id, allow_transactional_writes) click to toggle source

Creates a new single-cluster routing policy.

@param cluster_id [String] The cluster to which read/write requests

should be routed.

@param allow_transactional_writes [Boolean]

If true, `CheckAndMutateRow` and `ReadModifyWriteRow` requests are
allowed by this app profile. It is unsafe to send these requests to
the same table/row/column in multiple clusters.
Default value is false.
Calls superclass method
# File lib/google/cloud/bigtable/routing_policy.rb, line 158
def initialize cluster_id, allow_transactional_writes
  super()
  @cluster_id = cluster_id
  @allow_transactional_writes = allow_transactional_writes
end

Public Instance Methods

to_grpc() click to toggle source

@private

# File lib/google/cloud/bigtable/routing_policy.rb, line 165
def to_grpc
  Google::Cloud::Bigtable::Admin::V2::AppProfile::SingleClusterRouting.new(
    cluster_id:                 cluster_id,
    allow_transactional_writes: allow_transactional_writes
  )
end