Sha256: f9ff3f1cfc2050b3f183143a04216a57a95a87c7d32a5233b17f04978e6e1d79

Contents?: true

Size: 1.45 KB

Versions: 11

Compression:

Stored size: 1.45 KB

Contents

# encoding: utf-8
# Copyright 2014 Aerospike, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Aerospike

  # Container object for client policy command.
  class ClientPolicy

    attr_accessor :user, :password
    attr_accessor :timeout, :connection_queue_size, :fail_if_not_connected

    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[:fail_if_not_connected] || true

      # user name
      @user = opt[:user]

      # password
      @password = opt[:password]
    end

    def requires_authentication
      (@user && @user != '') || (@password && @password != '')
    end

  end # class

end # module

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
aerospike-1.0.10 lib/aerospike/policy/client_policy.rb
aerospike-1.0.9 lib/aerospike/policy/client_policy.rb
aerospike-1.0.8 lib/aerospike/policy/client_policy.rb
aerospike-1.0.7 lib/aerospike/policy/client_policy.rb
aerospike-1.0.6 lib/aerospike/policy/client_policy.rb
aerospike-1.0.5 lib/aerospike/policy/client_policy.rb
aerospike-1.0.4 lib/aerospike/policy/client_policy.rb
aerospike-1.0.3 lib/aerospike/policy/client_policy.rb
aerospike-1.0.2 lib/aerospike/policy/client_policy.rb
aerospike-1.0.1 lib/aerospike/policy/client_policy.rb
aerospike-1.0.0 lib/aerospike/policy/client_policy.rb