Class: Aerospike::ClientPolicy
- Inherits:
-
Object
- Object
- Aerospike::ClientPolicy
- Defined in:
- lib/aerospike/policy/client_policy.rb
Overview
Container object for client policy command.
Instance Attribute Summary collapse
-
#cluster_name ⇒ Object
Returns the value of attribute cluster_name.
-
#connection_queue_size ⇒ Object
Returns the value of attribute connection_queue_size.
-
#fail_if_not_connected ⇒ Object
Returns the value of attribute fail_if_not_connected.
-
#password ⇒ Object
Returns the value of attribute password.
-
#policies ⇒ Object
Returns the value of attribute policies.
-
#tend_interval ⇒ Object
Returns the value of attribute tend_interval.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#tls ⇒ Object
Returns the value of attribute tls.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(opt = {}) ⇒ ClientPolicy
constructor
A new instance of ClientPolicy.
- #requires_authentication ⇒ Object
Constructor Details
#initialize(opt = {}) ⇒ ClientPolicy
Returns a new instance of ClientPolicy.
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 |
# File 'lib/aerospike/policy/client_policy.rb', line 31 def initialize(opt={}) # Initial host connection timeout in seconds. The timeout when opening a connection # to the server host for the first time. @timeout = opt[:timeout] || 1.0 # 1 second # Size of the Connection Queue cache. @connection_queue_size = opt[:connection_queue_size] || 64 # Throw exception if host connection fails during add_host. @fail_if_not_connected = opt.has_key?(:fail_if_not_connected) ? opt[:fail_if_not_connected] : true # Tend interval in milliseconds; determines the interval at # which the client checks for cluster state changes. Minimum interval is 10ms. self.tend_interval = opt[:tend_interval] || 1000 # 1 second # user name @user = opt[:user] # password @password = opt[:password] # Cluster Name @cluster_name = opt[:cluster_name] @tls = opt[:tls] || opt[:ssl_options] # Default Policies @policies = opt.fetch(:policies) { Hash.new } end |
Instance Attribute Details
#cluster_name ⇒ Object
Returns the value of attribute cluster_name.
27 28 29 |
# File 'lib/aerospike/policy/client_policy.rb', line 27 def cluster_name @cluster_name end |
#connection_queue_size ⇒ Object
Returns the value of attribute connection_queue_size.
26 27 28 |
# File 'lib/aerospike/policy/client_policy.rb', line 26 def connection_queue_size @connection_queue_size end |
#fail_if_not_connected ⇒ Object
Returns the value of attribute fail_if_not_connected.
26 27 28 |
# File 'lib/aerospike/policy/client_policy.rb', line 26 def fail_if_not_connected @fail_if_not_connected end |
#password ⇒ Object
Returns the value of attribute password.
25 26 27 |
# File 'lib/aerospike/policy/client_policy.rb', line 25 def password @password end |
#policies ⇒ Object
Returns the value of attribute policies.
29 30 31 |
# File 'lib/aerospike/policy/client_policy.rb', line 29 def policies @policies end |
#tend_interval ⇒ Object
Returns the value of attribute tend_interval.
26 27 28 |
# File 'lib/aerospike/policy/client_policy.rb', line 26 def tend_interval @tend_interval end |
#timeout ⇒ Object
Returns the value of attribute timeout.
26 27 28 |
# File 'lib/aerospike/policy/client_policy.rb', line 26 def timeout @timeout end |
#tls ⇒ Object
Returns the value of attribute tls.
28 29 30 |
# File 'lib/aerospike/policy/client_policy.rb', line 28 def tls @tls end |
#user ⇒ Object
Returns the value of attribute user.
25 26 27 |
# File 'lib/aerospike/policy/client_policy.rb', line 25 def user @user end |
Instance Method Details
#requires_authentication ⇒ Object
61 62 63 |
# File 'lib/aerospike/policy/client_policy.rb', line 61 def requires_authentication (@user && @user != '') || (@password && @password != '') end |