Class: Aerospike::QueryPolicy

Inherits:
Policy
  • Object
show all
Defined in:
lib/aerospike/policy/query_policy.rb

Overview

Container object for query policy command.

Instance Attribute Summary collapse

Attributes inherited from Policy

#consistency_level, #fail_on_filtered_out, #filter_exp, #max_retries, #priority, #read_touch_ttl_percent, #replica, #sleep_between_retries, #timeout, #use_compression

Instance Method Summary collapse

Constructor Details

#initialize(opt = {}) ⇒ QueryPolicy

Returns a new instance of QueryPolicy.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/aerospike/policy/query_policy.rb', line 28

def initialize(opt={})
  super

  # Indicates if bin data is retrieved. If false, only record digests (and
  # user keys if stored on the server) are retrieved.
  # Default is true.
  @include_bin_data = opt.fetch(:include_bin_data, true)

  # Approximates the number of records to return to the client. This number is divided by the
  # number of nodes involved in the query. The actual number of records returned
  # may be less than MaxRecords if node record counts are small and unbalanced across
  # nodes.
  #
  # This field is supported on server versions >= 4.9.
  #
  # Default: 0 (do not limit record count)
  @max_records = opt.fetch(:max_records) { 0 }

  # Issue scan requests in parallel or serially.
  @concurrent_nodes = opt.fetch(:concurrent_nodes) { true }

  # Determines network timeout for each attempt.
  #
  # If socket_timeout is not zero and socket_timeout is reached before an attempt completes,
  # the Timeout above is checked. If Timeout is not exceeded, the transaction
  # is retried. If both socket_timeout and Timeout are non-zero, socket_timeout must be less
  # than or equal to Timeout, otherwise Timeout will also be used for socket_timeout.
  #
  # Default: 30s
  @socket_timeout = opt[:socket_timeout] || 30000

  # Number of records to place in queue before blocking. Records received
  # from multiple server nodes will be placed in a queue. A separate thread
  # consumes these records in parallel. If the queue is full, the producer
  # threads will block until records are consumed.
  # Default is 5000.
  @record_queue_size = opt[:record_queue_size] || 5000

  # Limit returned records per second (rps) rate for each server.
  # Will not apply rps limit if records_per_second is zero.
  # Currently only applicable to a query without a defined filter (scan).
  # Default is 0
  @records_per_second = opt[:records_per_second] || 0

  # Expected query duration. The server treats the query in different ways depending on the expected duration.
  # This field is ignored for aggregation queries, background queries and server versions < 6.0.
  #
  # Default: QueryDuration::LONG
  @expected_duration = opt[:expected_duration] || QueryDuration::LONG

  # DEPRECATED
  # Detemine wether query expected to return less than 100 records.
  # If true, the server will optimize the query for a small record set.
  # This field is ignored for aggregation queries, background queries
  # and server versions 6.0+.
  #
  # This field is deprecated and will eventually be removed. Use {expected_duration} instead.
  # For backwards compatibility: If ShortQuery is true, the query is treated as a short query and
  # {expected_duration} is ignored. If {short_query} is false, {expected_duration} is used as defaults to {Policy#QueryDuration#LONG}.
  # Default: false
  @short_query = opt[:short_query] ||false

  self
end

Instance Attribute Details

#concurrent_nodesObject

Returns the value of attribute concurrent_nodes.



26
27
28
# File 'lib/aerospike/policy/query_policy.rb', line 26

def concurrent_nodes
  @concurrent_nodes
end

#expected_durationObject

Returns the value of attribute expected_duration.



26
27
28
# File 'lib/aerospike/policy/query_policy.rb', line 26

def expected_duration
  @expected_duration
end

#include_bin_dataObject

Returns the value of attribute include_bin_data.



26
27
28
# File 'lib/aerospike/policy/query_policy.rb', line 26

def include_bin_data
  @include_bin_data
end

#max_recordsObject

Returns the value of attribute max_records.



26
27
28
# File 'lib/aerospike/policy/query_policy.rb', line 26

def max_records
  @max_records
end

#record_queue_sizeObject

Returns the value of attribute record_queue_size.



26
27
28
# File 'lib/aerospike/policy/query_policy.rb', line 26

def record_queue_size
  @record_queue_size
end

#records_per_secondObject

Returns the value of attribute records_per_second.



26
27
28
# File 'lib/aerospike/policy/query_policy.rb', line 26

def records_per_second
  @records_per_second
end

#short_queryObject

Returns the value of attribute short_query.



26
27
28
# File 'lib/aerospike/policy/query_policy.rb', line 26

def short_query
  @short_query
end

#socket_timeoutObject

Returns the value of attribute socket_timeout.



26
27
28
# File 'lib/aerospike/policy/query_policy.rb', line 26

def socket_timeout
  @socket_timeout
end