Module: Aws::ActiveSdb::ActiveSdbConnect

Included in:
Aws::ActiveSdb, Base
Defined in:
lib/sdb/active_sdb.rb

Instance Method Summary collapse

Instance Method Details

#close_connectionObject



125
126
127
# File 'lib/sdb/active_sdb.rb', line 125

def close_connection
    @connection.close_connection unless @connection.nil?
end

#connectionObject



99
100
101
# File 'lib/sdb/active_sdb.rb', line 99

def connection
    @connection || raise(ActiveSdbError.new('Connection to SDB is not established'))
end

#establish_connection(aws_access_key_id = nil, aws_secret_access_key = nil, params = {}) ⇒ Object

Create a new handle to an Sdb account. All handles share the same per process or per thread HTTP connection to Amazon Sdb. Each handle is for a specific account. The params are passed through as-is to Aws::SdbInterface.new Params:

{ :server       => 'sdb.amazonaws.com'  # Amazon service host: 'sdb.amazonaws.com'(default)
  :port         => 443                  # Amazon service port: 80 or 443(default)
  :protocol     => 'https'              # Amazon service protocol: 'http' or 'https'(default)
  :signature_version => '2'             # The signature version : '0', '1' or '2' (default)
  DEPRECATED :multi_thread => true|false           # Multi-threaded (connection per each thread): true or false(default)
  :connection_mode  => :default         # options are :default (will use best known option, may change in the future)
                                              :per_request (opens and closes a connection on every request to SDB)
                                              :single (same as old multi_thread=>false)
                                              :per_thread (same as old multi_thread=>true)
                                              :pool (uses a connection pool with a maximum number of connections - NOT IMPLEMENTED YET)
  :logger       => Logger Object        # Logger instance: logs to STDOUT if omitted
  :nil_representation => 'mynil'}       # interpret Ruby nil as this string value; i.e. use this string in SDB to represent Ruby nils (default is the string 'nil')
  :service_endpoint	=> '/'		 # Set this to /mdb/request.mgwsi for usage with M/DB


121
122
123
# File 'lib/sdb/active_sdb.rb', line 121

def establish_connection(aws_access_key_id=nil, aws_secret_access_key=nil, params={})
    @connection = Aws::SdbInterface.new(aws_access_key_id, aws_secret_access_key, params)
end