Class: Google::Cloud::Spanner::V1::DirectedReadOptions

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/spanner/v1/spanner.rb

Overview

The DirectedReadOptions can be used to indicate which replicas or regions should be used for non-transactional reads or queries.

DirectedReadOptions can only be specified for a read-only transaction, otherwise the API returns an INVALID_ARGUMENT error.

Defined Under Namespace

Classes: ExcludeReplicas, IncludeReplicas, ReplicaSelection

Instance Attribute Summary collapse

Instance Attribute Details

#exclude_replicas::Google::Cloud::Spanner::V1::DirectedReadOptions::ExcludeReplicas

Returns Exclude_replicas indicates that specified replicas should be excluded from serving requests. Spanner doesn't route requests to the replicas in this list.

Note: The following fields are mutually exclusive: exclude_replicas, include_replicas. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Spanner::V1::DirectedReadOptions::ExcludeReplicas)

    Exclude_replicas indicates that specified replicas should be excluded from serving requests. Spanner doesn't route requests to the replicas in this list.

    Note: The following fields are mutually exclusive: exclude_replicas, include_replicas. If a field in that set is populated, all other fields in the set will automatically be cleared.



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'proto_docs/google/spanner/v1/spanner.rb', line 264

class DirectedReadOptions
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # The directed read replica selector.
  # Callers must provide one or more of the following fields for replica
  # selection:
  #
  #   * `location` - The location must be one of the regions within the
  #      multi-region configuration of your database.
  #   * `type` - The type of the replica.
  #
  # Some examples of using replica_selectors are:
  #
  #   * `location:us-east1` --> The "us-east1" replica(s) of any available type
  #                             is used to process the request.
  #   * `type:READ_ONLY`    --> The "READ_ONLY" type replica(s) in the nearest
  #                             available location are used to process the
  #                             request.
  #   * `location:us-east1 type:READ_ONLY` --> The "READ_ONLY" type replica(s)
  #                          in location "us-east1" is used to process
  #                          the request.
  # @!attribute [rw] location
  #   @return [::String]
  #     The location or region of the serving requests, for example, "us-east1".
  # @!attribute [rw] type
  #   @return [::Google::Cloud::Spanner::V1::DirectedReadOptions::ReplicaSelection::Type]
  #     The type of replica.
  class ReplicaSelection
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Indicates the type of replica.
    module Type
      # Not specified.
      TYPE_UNSPECIFIED = 0

      # Read-write replicas support both reads and writes.
      READ_WRITE = 1

      # Read-only replicas only support reads (not writes).
      READ_ONLY = 2
    end
  end

  # An `IncludeReplicas` contains a repeated set of `ReplicaSelection` which
  # indicates the order in which replicas should be considered.
  # @!attribute [rw] replica_selections
  #   @return [::Array<::Google::Cloud::Spanner::V1::DirectedReadOptions::ReplicaSelection>]
  #     The directed read replica selector.
  # @!attribute [rw] auto_failover_disabled
  #   @return [::Boolean]
  #     If `true`, Spanner doesn't route requests to a replica outside the
  #     <`include_replicas` list when all of the specified replicas are
  #     unavailable or unhealthy. Default value is `false`.
  class IncludeReplicas
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # An ExcludeReplicas contains a repeated set of ReplicaSelection that should
  # be excluded from serving requests.
  # @!attribute [rw] replica_selections
  #   @return [::Array<::Google::Cloud::Spanner::V1::DirectedReadOptions::ReplicaSelection>]
  #     The directed read replica selector.
  class ExcludeReplicas
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#include_replicas::Google::Cloud::Spanner::V1::DirectedReadOptions::IncludeReplicas

Returns Include_replicas indicates the order of replicas (as they appear in this list) to process the request. If auto_failover_disabled is set to true and all replicas are exhausted without finding a healthy replica, Spanner waits for a replica in the list to become available, requests might fail due to DEADLINE_EXCEEDED errors.

Note: The following fields are mutually exclusive: include_replicas, exclude_replicas. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Spanner::V1::DirectedReadOptions::IncludeReplicas)

    Include_replicas indicates the order of replicas (as they appear in this list) to process the request. If auto_failover_disabled is set to true and all replicas are exhausted without finding a healthy replica, Spanner waits for a replica in the list to become available, requests might fail due to DEADLINE_EXCEEDED errors.

    Note: The following fields are mutually exclusive: include_replicas, exclude_replicas. If a field in that set is populated, all other fields in the set will automatically be cleared.



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'proto_docs/google/spanner/v1/spanner.rb', line 264

class DirectedReadOptions
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # The directed read replica selector.
  # Callers must provide one or more of the following fields for replica
  # selection:
  #
  #   * `location` - The location must be one of the regions within the
  #      multi-region configuration of your database.
  #   * `type` - The type of the replica.
  #
  # Some examples of using replica_selectors are:
  #
  #   * `location:us-east1` --> The "us-east1" replica(s) of any available type
  #                             is used to process the request.
  #   * `type:READ_ONLY`    --> The "READ_ONLY" type replica(s) in the nearest
  #                             available location are used to process the
  #                             request.
  #   * `location:us-east1 type:READ_ONLY` --> The "READ_ONLY" type replica(s)
  #                          in location "us-east1" is used to process
  #                          the request.
  # @!attribute [rw] location
  #   @return [::String]
  #     The location or region of the serving requests, for example, "us-east1".
  # @!attribute [rw] type
  #   @return [::Google::Cloud::Spanner::V1::DirectedReadOptions::ReplicaSelection::Type]
  #     The type of replica.
  class ReplicaSelection
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Indicates the type of replica.
    module Type
      # Not specified.
      TYPE_UNSPECIFIED = 0

      # Read-write replicas support both reads and writes.
      READ_WRITE = 1

      # Read-only replicas only support reads (not writes).
      READ_ONLY = 2
    end
  end

  # An `IncludeReplicas` contains a repeated set of `ReplicaSelection` which
  # indicates the order in which replicas should be considered.
  # @!attribute [rw] replica_selections
  #   @return [::Array<::Google::Cloud::Spanner::V1::DirectedReadOptions::ReplicaSelection>]
  #     The directed read replica selector.
  # @!attribute [rw] auto_failover_disabled
  #   @return [::Boolean]
  #     If `true`, Spanner doesn't route requests to a replica outside the
  #     <`include_replicas` list when all of the specified replicas are
  #     unavailable or unhealthy. Default value is `false`.
  class IncludeReplicas
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # An ExcludeReplicas contains a repeated set of ReplicaSelection that should
  # be excluded from serving requests.
  # @!attribute [rw] replica_selections
  #   @return [::Array<::Google::Cloud::Spanner::V1::DirectedReadOptions::ReplicaSelection>]
  #     The directed read replica selector.
  class ExcludeReplicas
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end