@@ -51,14 +51,14 @@ defmodule RethinkDB.Connection do
5151  defmacro  __using__ ( _opts )  do 
5252    quote  location:  :keep  do 
5353      def  start_link ( opts  \\  [ ] )  do 
54-         if  Dict . has_key? ( opts ,  :name )  &&  opts [ :name ]  !=  __MODULE__  do 
54+         if  Keyword . has_key? ( opts ,  :name )  &&  opts [ :name ]  !=  __MODULE__  do 
5555          # The whole point of this macro is to provide an implicit process 
5656          # name, so subverting it is considered an error. 
5757          raise  ArgumentError . exception ( 
5858            "Process name #{ inspect  opts [ :name ] }   conflicts with implicit name #{ inspect  __MODULE__ }   provided by `use RethinkDB.Connection`" 
5959          ) 
6060        end 
61-         RethinkDB.Connection . start_link ( Dict . put_new ( opts ,  :name ,  __MODULE__ ) ) 
61+         RethinkDB.Connection . start_link ( Keyword . put_new ( opts ,  :name ,  __MODULE__ ) ) 
6262      end 
6363
6464      def  run ( query ,  opts  \\  [ ] )  do 
@@ -98,12 +98,13 @@ defmodule RethinkDB.Connection do
9898  * `profile` - whether or not to return a profile of the query’s execution (default: false). 
9999  """ 
100100  def  run ( query ,  conn ,  opts  \\  [ ] )  do 
101-     timeout  =  Dict . get ( opts ,  :timeout ,  5000 ) 
102-     conn_opts  =  Dict . drop ( opts ,  [ :timeout ] ) 
103-     noreply  =  Dict . get ( opts ,  :noreply ,  false ) 
101+     timeout  =  Keyword . get ( opts ,  :timeout ,  5000 ) 
102+     conn_opts  =  Keyword . drop ( opts ,  [ :timeout ] ) 
103+     noreply  =  Keyword . get ( opts ,  :noreply ,  false ) 
104104    conn_opts  =  Connection . call ( conn ,  :conn_opts ) 
105-                 |>  Dict . take ( [ :db ] ) 
106-                 |>  Dict . merge ( conn_opts ) 
105+                 |>  Map . to_list ( ) 
106+                 |>  Keyword . take ( [ :db ] ) 
107+                 |>  Keyword . merge ( conn_opts ) 
107108    query  =  prepare_and_encode ( query ,  conn_opts ) 
108109    msg  =  case  noreply  do 
109110      true  ->  { :query_noreply ,  query } 
@@ -170,7 +171,7 @@ defmodule RethinkDB.Connection do
170171  @ doc  """ 
171172  Start connection as a linked process 
172173
173-   Accepts a `Dict ` of options. Supported options: 
174+   Accepts a `Keyword.t ` of options. Supported options: 
174175
175176  * `:host` - hostname to use to connect to database. Defaults to `'localhost'`. 
176177  * `:port` - port on which to connect to database. Defaults to `28015`. 
@@ -182,26 +183,26 @@ defmodule RethinkDB.Connection do
182183      * `:ca_certs` - a list of file paths to cacerts. 
183184  """ 
184185  def  start_link ( opts  \\  [ ] )  do 
185-     args  =  Dict . take ( opts ,  [ :host ,  :port ,  :auth_key ,  :db ,  :sync_connect ,  :ssl ,  :max_pending ] ) 
186+     args  =  Keyword . take ( opts ,  [ :host ,  :port ,  :auth_key ,  :db ,  :sync_connect ,  :ssl ,  :max_pending ] ) 
186187    Connection . start_link ( __MODULE__ ,  args ,  opts ) 
187188  end 
188189
189190  def  init ( opts )  do 
190-     host  =  case  Dict . get ( opts ,  :host ,  'localhost' )  do 
191+     host  =  case  Keyword . get ( opts ,  :host ,  'localhost' )  do 
191192      x  when  is_binary ( x )  ->  String . to_char_list  x 
192193      x  ->  x 
193194    end 
194-     sync_connect  =  Dict . get ( opts ,  :sync_connect ,  false ) 
195-     ssl  =  Dict . get ( opts ,  :ssl ) 
196-     opts  =  Dict . put ( opts ,  :host ,  host ) 
197-       |>  Dict . put_new ( :port ,  28015 ) 
198-       |>  Dict . put_new ( :auth_key ,  "" ) 
199-       |>  Dict . put_new ( :max_pending ,  10000 ) 
200-       |>  Dict . drop ( [ :sync_connect ] ) 
195+     sync_connect  =  Keyword . get ( opts ,  :sync_connect ,  false ) 
196+     ssl  =  Keyword . get ( opts ,  :ssl ) 
197+     opts  =  Keyword . put ( opts ,  :host ,  host ) 
198+       |>  Keyword . put_new ( :port ,  28015 ) 
199+       |>  Keyword . put_new ( :auth_key ,  "" ) 
200+       |>  Keyword . put_new ( :max_pending ,  10000 ) 
201+       |>  Keyword . drop ( [ :sync_connect ] ) 
201202      |>  Enum . into ( % { } ) 
202203    { transport ,  transport_opts }  =  case  ssl  do 
203204      nil  ->  { % Transport.TCP { } ,  [ ] } 
204-       x  ->  { % Transport.SSL { } ,  Enum . map ( Dict . fetch! ( x ,  :ca_certs ) ,   & ( { :cacertfile ,  & 1 } ) )  ++  [ verify:  :verify_peer ] } 
205+       x  ->  { % Transport.SSL { } ,  Enum . map ( Keyword . fetch! ( x ,  :ca_certs ) ,   & ( { :cacertfile ,  & 1 } ) )  ++  [ verify:  :verify_peer ] } 
205206    end 
206207    state  =  % { 
207208      pending:  % { } , 
@@ -228,11 +229,11 @@ defmodule RethinkDB.Connection do
228229          :ok  -> 
229230            :ok  =  Transport . setopts ( socket ,  [ active:  :once ] ) 
230231            # TODO: investigate timeout vs hibernate 
231-             { :ok ,  Dict . put ( state ,  :socket ,  socket ) } 
232+             { :ok ,  Map . put ( state ,  :socket ,  socket ) } 
232233        end 
233234      { :error ,  :econnrefused }  -> 
234-         backoff  =  min ( Dict . get ( state ,  :timeout ,  1000 ) ,  64000 ) 
235-         { :backoff ,  backoff ,  Dict . put ( state ,  :timeout ,  backoff * 2 ) } 
235+         backoff  =  min ( Map . get ( state ,  :timeout ,  1000 ) ,  64000 ) 
236+         { :backoff ,  backoff ,  Map . put ( state ,  :timeout ,  backoff * 2 ) } 
236237    end 
237238  end 
238239
0 commit comments