Skip to content

Commit

Permalink
Tokyo Tyrant reconnect stuff is in, but well, it's useless...
Browse files Browse the repository at this point in the history
  • Loading branch information
jmettraux committed Nov 18, 2009
1 parent 91f3b0e commit c57749f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Expand Up @@ -2,6 +2,11 @@
= rufus-tokyo CHANGELOG.txt = rufus-tokyo CHANGELOG.txt




== rufus-tokyo - 1.0.4 not yet released

- todo : Rufus::Tokyo::Tyrant and TyrantTable now reconnets (120 seconds)


== rufus-tokyo - 1.0.3 released 2009/11/16 == rufus-tokyo - 1.0.3 released 2009/11/16


- bug : newer versions of FFI have [undocumented] bool type. Adapted. - bug : newer versions of FFI have [undocumented] bool type. Adapted.
Expand Down
8 changes: 8 additions & 0 deletions lib/rufus/tokyo/tyrant/abstract.rb
Expand Up @@ -114,6 +114,14 @@ def initialize (host, port=0, params={})


self.default = params[:default] self.default = params[:default]
@default_proc ||= params[:default_proc] @default_proc ||= params[:default_proc]

#
# timeout and reconnect

# defaults to two minutes

timeout = params[:timeout] || 120.0
lib.tcrdbtune(@db, timeout, 1)
end end


# Using the tyrant lib # Using the tyrant lib
Expand Down
2 changes: 2 additions & 0 deletions lib/rufus/tokyo/tyrant/lib.rb
Expand Up @@ -63,6 +63,8 @@ class << self


attfunc :tcrdbstat, [ :pointer ], :string attfunc :tcrdbstat, [ :pointer ], :string


attfunc :tcrdbtune, [ :pointer, :double, :int ], :bool

attfunc :tcrdbopen, [ :pointer, :string, :int ], :bool attfunc :tcrdbopen, [ :pointer, :string, :int ], :bool
attfunc :abs_close, :tcrdbclose, [ :pointer ], :bool attfunc :abs_close, :tcrdbclose, [ :pointer ], :bool


Expand Down
10 changes: 9 additions & 1 deletion lib/rufus/tokyo/tyrant/table.rb
Expand Up @@ -75,7 +75,7 @@ class TyrantTable < Table
# t['client0'] = { 'name' => 'Theodore Roosevelt', 'country' => 'usa' } # t['client0'] = { 'name' => 'Theodore Roosevelt', 'country' => 'usa' }
# t.close # t.close
# #
def initialize (host, port=0) def initialize (host, port=0, params={})


@db = lib.tcrdbnew @db = lib.tcrdbnew


Expand All @@ -95,6 +95,14 @@ def initialize (host, port=0)
end end


@default_proc = nil @default_proc = nil

#
# timeout and reconnect

# defaults to two minutes

timeout = params[:timeout] || 120.0
lib.tcrdbtune(@db, timeout, 1)
end end


# #
Expand Down

0 comments on commit c57749f

Please sign in to comment.