rufus-tokyo 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,11 @@
2
2
  = rufus-tokyo CHANGELOG.txt
3
3
 
4
4
 
5
+ == rufus-tokyo - 1.0.3 released 2009/11/16
6
+
7
+ - bug : newer versions of FFI have [undocumented] bool type. Adapted.
8
+
9
+
5
10
  == rufus-tokyo - 1.0.2 released 2009/11/01
6
11
 
7
12
  - bug : HashMethods#to_a not working right with Ruby 1.9.1. Fixed.
@@ -25,6 +25,7 @@ Mark 'mebaran' http://github.com/mebaran
25
25
 
26
26
  == feedback / support
27
27
 
28
+ Swerling http://github.com/swerling
28
29
  Alexandre Gravem
29
30
  Philippe Monnet http://blog.monnet-usa.com/
30
31
  Ilya Grigorik http://igvita.com
@@ -29,7 +29,7 @@ require 'ffi' # sudo gem install ffi
29
29
  module Rufus
30
30
  module Tokyo
31
31
 
32
- VERSION = '1.0.2'
32
+ VERSION = '1.0.3'
33
33
 
34
34
  #
35
35
  # A common error class
@@ -217,7 +217,7 @@ module Rufus::Tokyo
217
217
 
218
218
  name = name + params.collect { |k, v| "##{k}=#{v}" }.join('')
219
219
 
220
- (lib.tcadbopen(@db, name) != 0) || raise(
220
+ lib.tcadbopen(@db, name) || raise(
221
221
  TokyoError.new("failed to open/create db '#{name}' #{params.inspect}"))
222
222
 
223
223
  #
@@ -273,8 +273,7 @@ module Rufus::Tokyo
273
273
 
274
274
  k = k.to_s; v = v.to_s
275
275
 
276
- (lib.abs_putkeep(
277
- @db, k, Rufus::Tokyo.blen(k), v, Rufus::Tokyo.blen(v)) == 1)
276
+ lib.abs_putkeep(@db, k, Rufus::Tokyo.blen(k), v, Rufus::Tokyo.blen(v))
278
277
  end
279
278
 
280
279
  # Appends the given string at the end of the current string value for key k.
@@ -286,8 +285,7 @@ module Rufus::Tokyo
286
285
 
287
286
  k = k.to_s; v = v.to_s
288
287
 
289
- (lib.abs_putcat(
290
- @db, k, Rufus::Tokyo.blen(k), v, Rufus::Tokyo.blen(v)) == 1)
288
+ lib.abs_putcat(@db, k, Rufus::Tokyo.blen(k), v, Rufus::Tokyo.blen(v))
291
289
  end
292
290
 
293
291
  # (The actual #[] method is provided by HashMethods
@@ -309,7 +307,7 @@ module Rufus::Tokyo
309
307
 
310
308
  v = self[k]
311
309
 
312
- (lib.abs_out(@db, k, Rufus::Tokyo.blen(k)) == 1) ? v : nil
310
+ lib.abs_out(@db, k, Rufus::Tokyo.blen(k)) ? v : nil
313
311
  end
314
312
 
315
313
  # Returns the number of records in the 'cabinet'
@@ -345,7 +343,7 @@ module Rufus::Tokyo
345
343
  result = lib.abs_close(@db)
346
344
  lib.abs_del(@db)
347
345
 
348
- (result == 1)
346
+ result
349
347
  end
350
348
 
351
349
  # Copies the current cabinet to a new file.
@@ -354,7 +352,7 @@ module Rufus::Tokyo
354
352
  #
355
353
  def copy (target_path)
356
354
 
357
- (lib.abs_copy(@db, target_path) == 1)
355
+ lib.abs_copy(@db, target_path)
358
356
  end
359
357
 
360
358
  # Copies the current cabinet to a new file.
@@ -374,7 +372,7 @@ module Rufus::Tokyo
374
372
  #
375
373
  def sync
376
374
 
377
- (lib.abs_sync(@db) == 1)
375
+ lib.abs_sync(@db)
378
376
  end
379
377
 
380
378
  # Returns an array with all the keys in the databse
@@ -641,7 +639,7 @@ module Rufus::Tokyo
641
639
  def libcall (lib_method, *args)
642
640
 
643
641
  raise TokyoError.new("call to #{lib_method} failed") \
644
- unless lib.send(lib_method, @db, *args) == 1
642
+ unless lib.send(lib_method, @db, *args)
645
643
  end
646
644
 
647
645
  end
@@ -69,34 +69,34 @@ module Rufus::Tokyo
69
69
  #
70
70
  # tcadb functions
71
71
  #
72
- # http://tokyocabinet.sourceforge.net/spex-en.html#tcadbapi
72
+ # http://1978th.net/tokyocabinet/spex-en.html#tcadbapi
73
73
 
74
74
  attfunc :tcadbnew, [], :pointer
75
75
 
76
- attfunc :tcadbopen, [ :pointer, :string ], :int
77
- attfunc :abs_close, :tcadbclose, [ :pointer ], :int
76
+ attfunc :tcadbopen, [ :pointer, :string ], :bool
77
+ attfunc :abs_close, :tcadbclose, [ :pointer ], :bool
78
78
 
79
79
  attfunc :abs_del, :tcadbdel, [ :pointer ], :void
80
80
 
81
81
  attfunc :abs_rnum, :tcadbrnum, [ :pointer ], :uint64
82
82
  attfunc :abs_size, :tcadbsize, [ :pointer ], :uint64
83
83
 
84
- attfunc :abs_put, :tcadbput, [ :pointer, :pointer, :int, :pointer, :int ], :int
84
+ attfunc :abs_put, :tcadbput, [ :pointer, :pointer, :int, :pointer, :int ], :bool
85
85
 
86
86
  attfunc :abs_get, :tcadbget, [ :pointer, :pointer, :int, :pointer ], :pointer
87
87
 
88
- attfunc :abs_out, :tcadbout, [ :pointer, :pointer, :int ], :int
88
+ attfunc :abs_out, :tcadbout, [ :pointer, :pointer, :int ], :bool
89
89
 
90
- attfunc :abs_putkeep, :tcadbputkeep, [ :pointer, :pointer, :int, :pointer, :int ], :int
91
- attfunc :abs_putcat, :tcadbputcat, [ :pointer, :pointer, :int, :pointer, :int ], :int
90
+ attfunc :abs_putkeep, :tcadbputkeep, [ :pointer, :pointer, :int, :pointer, :int ], :bool
91
+ attfunc :abs_putcat, :tcadbputcat, [ :pointer, :pointer, :int, :pointer, :int ], :bool
92
92
 
93
- attfunc :abs_iterinit, :tcadbiterinit, [ :pointer ], :int
93
+ attfunc :abs_iterinit, :tcadbiterinit, [ :pointer ], :bool
94
94
  attfunc :abs_iternext, :tcadbiternext, [ :pointer, :pointer ], :pointer
95
95
 
96
- attfunc :abs_vanish, :tcadbvanish, [ :pointer ], :int
96
+ attfunc :abs_vanish, :tcadbvanish, [ :pointer ], :bool
97
97
 
98
- attfunc :abs_sync, :tcadbsync, [ :pointer ], :int
99
- attfunc :abs_copy, :tcadbcopy, [ :pointer, :string ], :int
98
+ attfunc :abs_sync, :tcadbsync, [ :pointer ], :bool
99
+ attfunc :abs_copy, :tcadbcopy, [ :pointer, :string ], :bool
100
100
 
101
101
  attfunc :abs_fwmkeys, :tcadbfwmkeys, [ :pointer, :pointer, :int, :int ], :pointer
102
102
 
@@ -108,41 +108,41 @@ module Rufus::Tokyo
108
108
  attfunc :tcadbreveal, [ :pointer ], :pointer
109
109
 
110
110
  # since TC 1.4.13
111
- attfunc :tcadbtranbegin, [ :pointer ], :int
112
- attfunc :tcadbtrancommit, [ :pointer ], :int
113
- attfunc :tcadbtranabort, [ :pointer ], :int
111
+ attfunc :tcadbtranbegin, [ :pointer ], :bool
112
+ attfunc :tcadbtrancommit, [ :pointer ], :bool
113
+ attfunc :tcadbtranabort, [ :pointer ], :bool
114
114
 
115
115
  #
116
116
  # tctdb functions
117
117
  #
118
- # http://tokyocabinet.sourceforge.net/spex-en.html#tctdbapi
118
+ # http://1978th.net/tokyocabinet/spex-en.html#tctdbapi
119
119
 
120
120
  attfunc :tctdbnew, [], :pointer
121
- attfunc :tctdbsetmutex, [ :pointer ], :int
122
- attfunc :tctdbtune, [ :pointer, :uint64, :uint8, :uint8, :uint8 ], :int
123
- attfunc :tctdbsetcache, [ :pointer, :uint32, :uint32, :uint32 ], :int
124
- attfunc :tctdbsetxmsiz, [ :pointer, :uint64 ], :int
121
+ attfunc :tctdbsetmutex, [ :pointer ], :bool
122
+ attfunc :tctdbtune, [ :pointer, :uint64, :uint8, :uint8, :uint8 ], :bool
123
+ attfunc :tctdbsetcache, [ :pointer, :uint32, :uint32, :uint32 ], :bool
124
+ attfunc :tctdbsetxmsiz, [ :pointer, :uint64 ], :bool
125
125
 
126
126
  # since TC 1.4.21
127
- attfunc :tctdbsetdfunit, [ :pointer, :uint32 ], :int
127
+ attfunc :tctdbsetdfunit, [ :pointer, :uint32 ], :bool
128
128
 
129
- attfunc :tctdbopen, [ :pointer, :string, :int ], :int
129
+ attfunc :tctdbopen, [ :pointer, :string, :int ], :bool
130
130
 
131
- attfunc :tab_close, :tctdbclose, [ :pointer ], :int
131
+ attfunc :tab_close, :tctdbclose, [ :pointer ], :bool
132
132
 
133
133
  attfunc :tab_genuid, :tctdbgenuid, [ :pointer ], :int64
134
134
 
135
135
  attfunc :tab_get, :tctdbget, [ :pointer, :pointer, :int ], :pointer
136
136
 
137
- attfunc :tab_iterinit, :tctdbiterinit, [ :pointer ], :int
137
+ attfunc :tab_iterinit, :tctdbiterinit, [ :pointer ], :bool
138
138
  attfunc :tab_iternext, :tctdbiternext, [ :pointer, :pointer ], :pointer
139
139
 
140
- attfunc :tab_put, :tctdbput, [ :pointer, :pointer, :int, :pointer ], :int
140
+ attfunc :tab_put, :tctdbput, [ :pointer, :pointer, :int, :pointer ], :bool
141
141
 
142
142
  #attfunc :tctdbput3, [ :pointer, :string, :string ], :int
143
143
  # not using it anymore, Ruby can turn an array into a hash so easily
144
144
 
145
- attfunc :tab_out, :tctdbout, [ :pointer, :string, :int ], :int
145
+ attfunc :tab_out, :tctdbout, [ :pointer, :string, :int ], :bool
146
146
 
147
147
  attfunc :tab_ecode, :tctdbecode, [ :pointer ], :int
148
148
  attfunc :tab_errmsg, :tctdberrmsg, [ :int ], :string
@@ -151,13 +151,13 @@ module Rufus::Tokyo
151
151
 
152
152
  attfunc :tab_rnum, :tctdbrnum, [ :pointer ], :uint64
153
153
 
154
- attfunc :tab_vanish, :tctdbvanish, [ :pointer ], :int
154
+ attfunc :tab_vanish, :tctdbvanish, [ :pointer ], :bool
155
155
 
156
- attfunc :tab_setindex, :tctdbsetindex, [ :pointer, :string, :int ], :int
156
+ attfunc :tab_setindex, :tctdbsetindex, [ :pointer, :string, :int ], :bool
157
157
 
158
- attfunc :tctdbtranbegin, [ :pointer ], :int
159
- attfunc :tctdbtrancommit, [ :pointer ], :int
160
- attfunc :tctdbtranabort, [ :pointer ], :int
158
+ attfunc :tctdbtranbegin, [ :pointer ], :bool
159
+ attfunc :tctdbtrancommit, [ :pointer ], :bool
160
+ attfunc :tctdbtranabort, [ :pointer ], :bool
161
161
 
162
162
  attfunc :tab_fwmkeys, :tctdbfwmkeys, [ :pointer, :pointer, :int, :int ], :pointer
163
163
 
@@ -166,7 +166,7 @@ module Rufus::Tokyo
166
166
  #
167
167
  # tctdbqry functions
168
168
  #
169
- # http://tokyocabinet.sourceforge.net/spex-en.html#tctdbapi
169
+ # http://1978th.net/tokyocabinet/spex-en.html#tctdbapi
170
170
 
171
171
  attfunc :qry_new, :tctdbqrynew, [ :pointer ], :pointer
172
172
  attfunc :qry_del, :tctdbqrydel, [ :pointer ], :void
@@ -175,7 +175,7 @@ module Rufus::Tokyo
175
175
  attfunc :qry_setorder, :tctdbqrysetorder, [ :pointer, :string, :int ], :void
176
176
 
177
177
  callback :TDBQRYPROC, [:pointer, :int, :pointer, :pointer], :int
178
- attfunc :qry_proc, :tctdbqryproc, [ :pointer, :TDBQRYPROC, :pointer], :int
178
+ attfunc :qry_proc, :tctdbqryproc, [ :pointer, :TDBQRYPROC, :pointer], :bool
179
179
 
180
180
 
181
181
  begin # since TC 1.4.10
@@ -185,7 +185,7 @@ module Rufus::Tokyo
185
185
  end
186
186
 
187
187
  attfunc :qry_search, :tctdbqrysearch, [ :pointer ], :pointer
188
- attfunc :qry_searchout, :tctdbqrysearchout, [ :pointer ], :int
188
+ attfunc :qry_searchout, :tctdbqrysearchout, [ :pointer ], :bool
189
189
 
190
190
  # since TC 1.4.12
191
191
  attfunc :qry_count, :tctdbqrycount, [ :pointer ], :int
@@ -193,9 +193,9 @@ module Rufus::Tokyo
193
193
  #
194
194
  # tcbdb functions
195
195
  #
196
- # http://tokyocabinet.sourceforge.net/spex-en.html#tcbdbapi
196
+ # http://1978th.net/tokyocabinet/spex-en.html#tcbdbapi
197
197
 
198
- attfunc :tcbdbputdup, [ :pointer, :pointer, :int, :pointer, :int ], :int
198
+ attfunc :tcbdbputdup, [ :pointer, :pointer, :int, :pointer, :int ], :bool
199
199
  attfunc :tcbdbget4, [ :pointer, :pointer, :int ], :pointer
200
200
 
201
201
  #
@@ -212,7 +212,7 @@ module Rufus::Tokyo
212
212
 
213
213
  attfunc :tcmapnew, [], :pointer
214
214
  attfunc :tcmapput, [ :pointer, :pointer, :int, :pointer, :int ], :void
215
- attfunc :tcmapout, [ :pointer, :pointer, :int ], :int
215
+ attfunc :tcmapout, [ :pointer, :pointer, :int ], :bool
216
216
  attfunc :tcmapclear, [ :pointer ], :void
217
217
  attfunc :tcmapdel, [ :pointer ], :void
218
218
  attfunc :tcmapget, [ :pointer, :pointer, :int, :pointer ], :pointer
@@ -223,7 +223,7 @@ module Rufus::Tokyo
223
223
  #
224
224
  # tclist functions
225
225
  #
226
- # http://tokyocabinet.sourceforge.net/spex-en.html#tcutilapi
226
+ # http://1978th.net/tokyocabinet/spex-en.html#tcutilapi
227
227
 
228
228
  attfunc :tclistnew, [], :pointer
229
229
  attfunc :tclistnum, [ :pointer ], :int
@@ -182,7 +182,7 @@ module Rufus::Tokyo
182
182
  result = lib.tab_close(@db)
183
183
  lib.tab_del(@db)
184
184
 
185
- (result == 1)
185
+ result
186
186
  end
187
187
 
188
188
  # Generates a unique id (in the context of this Table instance)
@@ -230,7 +230,7 @@ module Rufus::Tokyo
230
230
 
231
231
  ii = types.inject(0) { |i, t| i = i | INDEX_TYPES[t]; i }
232
232
 
233
- (lib.tab_setindex(@db, column_name, ii) == 1)
233
+ lib.tab_setindex(@db, column_name, ii)
234
234
  end
235
235
 
236
236
  # Inserts a record in the table db
@@ -255,7 +255,7 @@ module Rufus::Tokyo
255
255
 
256
256
  m.free
257
257
 
258
- (r == 1) || raise_error # raising potential error after freeing map
258
+ r || raise_error # raising potential error after freeing map
259
259
 
260
260
  h_or_a
261
261
  end
@@ -575,7 +575,7 @@ module Rufus::Tokyo
575
575
 
576
576
  def libcall (lib_method, *args)
577
577
 
578
- (lib.send(lib_method, @db, *args) == 1) or raise_error
578
+ lib.send(lib_method, @db, *args) || raise_error
579
579
  # stack level too deep with JRuby 1.1.6 :(
580
580
 
581
581
  #(eval(%{ lib.#{lib_method}(@db, *args) }) == 1) or raise_error
@@ -109,7 +109,7 @@ module Rufus::Tokyo
109
109
  v = self[k]
110
110
  return nil unless v
111
111
 
112
- (clib.tcmapout(pointer_or_raise, k, Rufus::Tokyo::blen(k)) == 1) ||
112
+ clib.tcmapout(pointer_or_raise, k, Rufus::Tokyo::blen(k)) ||
113
113
  raise("failed to remove key '#{k}'")
114
114
 
115
115
  v
@@ -89,19 +89,16 @@ module Rufus::Tokyo::Dystopia
89
89
 
90
90
  @db = lib.tcidbnew()
91
91
 
92
- rc = lib.tcidbopen( @db, path, mode_bits | lock_bits )
93
- raise_error unless rc == 1
92
+ lib.tcidbopen( @db, path, mode_bits | lock_bits ) || raise_error
94
93
  end
95
94
 
96
95
  #
97
96
  # Close and detach from the database. This instance can not be used anymore
98
97
  #
99
98
  def close
100
- rc = lib.tcidbclose( @db )
101
- raise_error unless rc == 1
99
+ lib.tcidbclose( @db ) || raise_error
102
100
 
103
101
  lib.tcidbdel( @db )
104
- raise_error unless rc == 1
105
102
 
106
103
  @db = nil
107
104
  end
@@ -110,16 +107,14 @@ module Rufus::Tokyo::Dystopia
110
107
  # Add a new document to the database
111
108
  #
112
109
  def store( id, text )
113
- rc = lib.tcidbput( @db, id, text )
114
- raise_error unless rc == 1
110
+ lib.tcidbput( @db, id, text ) || raise_error
115
111
  end
116
112
 
117
113
  #
118
114
  # Remove the given document from the index
119
115
  #
120
116
  def delete( id )
121
- rc = lib.tcidbout( @db, id )
122
- raise_error unless rc == 1
117
+ lib.tcidbout( @db, id ) || raise_error
123
118
  end
124
119
 
125
120
  #
@@ -46,7 +46,7 @@ module Rufus::Tokyo
46
46
  #
47
47
  # tcidb functions - The Core API
48
48
  #
49
- # http://tokyocabinet.sourceforge.net/dystopiadoc/#dystopiaapi
49
+ # http://1978th.net/tokyodystopia/spex.html#dystopiaapi
50
50
 
51
51
  # tuning options <dystopia.h>
52
52
  LARGE = 1 << 0
@@ -76,41 +76,41 @@ module Rufus::Tokyo
76
76
  attach_function :tcidbecode, [ :pointer ], :int
77
77
 
78
78
  attach_function :tcidbnew, [], :pointer
79
- attach_function :tcidbopen, [ :pointer, :pointer, :int ], :int
80
- attach_function :tcidbclose, [ :pointer ], :int
79
+ attach_function :tcidbopen, [ :pointer, :pointer, :int ], :bool
80
+ attach_function :tcidbclose, [ :pointer ], :bool
81
81
  attach_function :tcidbdel, [ :pointer ], :void
82
- attach_function :tcidbvanish, [ :pointer ], :int
82
+ attach_function :tcidbvanish, [ :pointer ], :bool
83
83
 
84
84
  # TODO
85
- #attach_function :tcidbtune, [ :pointer, :int64, :int64, :int64, :int8 ], :int
86
- #attach_function :tcidbsetcache, [ :pointer, :int64, :int32 ], :int
87
- #attach_function :tcidbsetfwmmax, [ :pointer, :uint32 ], :int
88
- #attach_function :tcidbsync, [ :pointer ], :int
89
- #attach_function :tcidboptimize, [ :pointer ], :int
90
- #attach_function :tcidbcopy, [ :pointer, :pointer ], :int
85
+ #attach_function :tcidbtune, [ :pointer, :int64, :int64, :int64, :int8 ], :bool
86
+ #attach_function :tcidbsetcache, [ :pointer, :int64, :int32 ], :bool
87
+ #attach_function :tcidbsetfwmmax, [ :pointer, :uint32 ], :bool
88
+ #attach_function :tcidbsync, [ :pointer ], :bool
89
+ #attach_function :tcidboptimize, [ :pointer ], :bool
90
+ #attach_function :tcidbcopy, [ :pointer, :pointer ], :bool
91
91
 
92
92
  attach_function :tcidbpath, [ :pointer ], :string
93
93
  attach_function :tcidbrnum, [ :pointer ], :uint64
94
94
  attach_function :tcidbfsiz, [ :pointer ], :uint64
95
95
 
96
- attach_function :tcidbput, [ :pointer, :int64, :string ], :int
97
- attach_function :tcidbout, [ :pointer, :int64 ], :int
96
+ attach_function :tcidbput, [ :pointer, :int64, :string ], :bool
97
+ attach_function :tcidbout, [ :pointer, :int64 ], :bool
98
98
  attach_function :tcidbget, [ :pointer, :int64 ], :string
99
99
  #attach_function :tcidbsearch, [ :pointer, :pointer, :int, :pointer ], :pointer
100
100
  attach_function :tcidbsearch2, [ :pointer, :string, :pointer], :pointer
101
- #attach_function :tcidbiterinit, [ :pointer ], :int
101
+ #attach_function :tcidbiterinit, [ :pointer ], :bool
102
102
  #attach_function :tcidbiternext, [ :pointer ], :uint64
103
103
 
104
104
 
105
105
  #
106
106
  # tcwdb functions - The Word Database API
107
107
  #
108
- # http://tokyocabinet.sourceforge.net/dystopiadoc/#tcwdbapi
108
+ # http://1978th.net/tokyodystopia/spex.html#tcwdbapi
109
109
 
110
110
  attach_function :tcwdbnew, [], :pointer
111
111
 
112
- attach_function :tcwdbopen, [ :pointer, :string, :int ], :int
113
- attach_function :tcwdbclose, [ :pointer ], :int
112
+ attach_function :tcwdbopen, [ :pointer, :string, :int ], :bool
113
+ attach_function :tcwdbclose, [ :pointer ], :bool
114
114
 
115
115
  attach_function :tcwdbecode, [ :pointer ], :int
116
116
 
@@ -56,7 +56,7 @@ module Rufus::Tokyo::Dystopia
56
56
 
57
57
  @db = dlib.tcwdbnew
58
58
 
59
- (dlib.tcwdbopen(@db, path, mode) == 1) || raise_error
59
+ dlib.tcwdbopen(@db, path, mode) || raise_error
60
60
  end
61
61
 
62
62
  protected
@@ -97,7 +97,7 @@ module Rufus::Tokyo
97
97
  @host = host
98
98
  @port = port
99
99
 
100
- (lib.tcrdbopen(@db, host, port) != 0) || raise(
100
+ lib.tcrdbopen(@db, host, port) || raise(
101
101
  TokyoError.new("couldn't connect to tyrant at #{host}:#{port}"))
102
102
 
103
103
  if self.stat['type'] == 'table'
@@ -134,7 +134,7 @@ module Rufus::Tokyo
134
134
  #
135
135
  def copy (target_path)
136
136
 
137
- (lib.abs_copy(@db, target_path) == 1) || raise_error
137
+ lib.abs_copy(@db, target_path) || raise_error
138
138
  end
139
139
 
140
140
  # Tyrant databases DO NOT support the 'defrag' call. Calling this method
@@ -54,6 +54,8 @@ module Rufus::Tokyo
54
54
  alias :attfunc :attach_function
55
55
  end
56
56
 
57
+ # http://1978th.net/tokyotyrant/spex.html#tcrdbapi
58
+
57
59
  #
58
60
  # tcrdb functions
59
61
 
@@ -61,8 +63,8 @@ module Rufus::Tokyo
61
63
 
62
64
  attfunc :tcrdbstat, [ :pointer ], :string
63
65
 
64
- attfunc :tcrdbopen, [ :pointer, :string, :int ], :int
65
- attfunc :abs_close, :tcrdbclose, [ :pointer ], :int
66
+ attfunc :tcrdbopen, [ :pointer, :string, :int ], :bool
67
+ attfunc :abs_close, :tcrdbclose, [ :pointer ], :bool
66
68
 
67
69
  attfunc :abs_ecode, :tcrdbecode, [ :pointer ], :int
68
70
  attfunc :abs_errmsg, :tcrdberrmsg, [ :pointer, :int ], :string
@@ -73,20 +75,20 @@ module Rufus::Tokyo
73
75
  attfunc :abs_size, :tcrdbsize, [ :pointer ], :uint64
74
76
 
75
77
  attfunc :abs_get, :tcrdbget, [ :pointer, :pointer, :int, :pointer ], :pointer
76
- attfunc :abs_put, :tcrdbput, [ :pointer, :pointer, :int, :pointer, :int ], :int
78
+ attfunc :abs_put, :tcrdbput, [ :pointer, :pointer, :int, :pointer, :int ], :bool
77
79
 
78
- attfunc :abs_out, :tcrdbout, [ :pointer, :pointer, :int ], :int
80
+ attfunc :abs_out, :tcrdbout, [ :pointer, :pointer, :int ], :bool
79
81
 
80
- attfunc :abs_putkeep, :tcrdbputkeep, [ :pointer, :pointer, :int, :pointer, :int ], :int
81
- attfunc :abs_putcat, :tcrdbputcat, [ :pointer, :pointer, :int, :pointer, :int ], :int
82
+ attfunc :abs_putkeep, :tcrdbputkeep, [ :pointer, :pointer, :int, :pointer, :int ], :bool
83
+ attfunc :abs_putcat, :tcrdbputcat, [ :pointer, :pointer, :int, :pointer, :int ], :bool
82
84
 
83
- attfunc :abs_iterinit, :tcrdbiterinit, [ :pointer ], :int
85
+ attfunc :abs_iterinit, :tcrdbiterinit, [ :pointer ], :bool
84
86
  attfunc :abs_iternext, :tcrdbiternext, [ :pointer, :pointer ], :pointer
85
87
 
86
- attfunc :abs_vanish, :tcrdbvanish, [ :pointer ], :int
88
+ attfunc :abs_vanish, :tcrdbvanish, [ :pointer ], :bool
87
89
 
88
- attfunc :abs_sync, :tcrdbsync, [ :pointer ], :int
89
- attfunc :abs_copy, :tcrdbcopy, [ :pointer, :string ], :int
90
+ attfunc :abs_sync, :tcrdbsync, [ :pointer ], :bool
91
+ attfunc :abs_copy, :tcrdbcopy, [ :pointer, :string ], :bool
90
92
 
91
93
  attfunc :abs_fwmkeys, :tcrdbfwmkeys, [ :pointer, :pointer, :int, :int ], :pointer
92
94
  attfunc :tcrdbmisc, [ :pointer, :string, :int, :pointer ], :pointer
@@ -99,18 +101,18 @@ module Rufus::Tokyo
99
101
  #
100
102
  # table functions
101
103
 
102
- attfunc :tab_close, :tcrdbclose, [ :pointer ], :int
104
+ attfunc :tab_close, :tcrdbclose, [ :pointer ], :bool
103
105
 
104
106
  attfunc :tab_genuid, :tcrdbtblgenuid, [ :pointer ], :int64
105
107
 
106
108
  attfunc :tab_get, :tcrdbtblget, [ :pointer, :pointer, :int ], :pointer
107
109
 
108
- attfunc :tab_iterinit, :tcrdbiterinit, [ :pointer ], :int
110
+ attfunc :tab_iterinit, :tcrdbiterinit, [ :pointer ], :bool
109
111
  attfunc :tab_iternext, :tcrdbiternext, [ :pointer, :pointer ], :pointer
110
112
 
111
- attfunc :tab_put, :tcrdbtblput, [ :pointer, :pointer, :int, :pointer ], :int
113
+ attfunc :tab_put, :tcrdbtblput, [ :pointer, :pointer, :int, :pointer ], :bool
112
114
 
113
- attfunc :tab_out, :tcrdbtblout, [ :pointer, :string, :int ], :int
115
+ attfunc :tab_out, :tcrdbtblout, [ :pointer, :string, :int ], :bool
114
116
 
115
117
  attfunc :tab_ecode, :tcrdbecode, [ :pointer ], :int
116
118
  attfunc :tab_errmsg, :tcrdberrmsg, [ :pointer, :int ], :string
@@ -119,9 +121,9 @@ module Rufus::Tokyo
119
121
 
120
122
  attfunc :tab_rnum, :tcrdbrnum, [ :pointer ], :uint64
121
123
 
122
- attfunc :tab_vanish, :tcrdbvanish, [ :pointer ], :int
124
+ attfunc :tab_vanish, :tcrdbvanish, [ :pointer ], :bool
123
125
 
124
- attfunc :tab_setindex, :tcrdbtblsetindex, [ :pointer, :string, :int ], :int
126
+ attfunc :tab_setindex, :tcrdbtblsetindex, [ :pointer, :string, :int ], :bool
125
127
 
126
128
  attfunc :tab_fwmkeys, :tcrdbfwmkeys, [ :pointer, :pointer, :int, :int ], :pointer
127
129
 
@@ -143,7 +145,7 @@ module Rufus::Tokyo
143
145
  end
144
146
 
145
147
  attfunc :qry_search, :tcrdbqrysearch, [ :pointer ], :pointer
146
- attfunc :qry_searchout, :tcrdbqrysearchout, [ :pointer ], :int
148
+ attfunc :qry_searchout, :tcrdbqrysearchout, [ :pointer ], :bool
147
149
 
148
150
  # since TC 1.4.21
149
151
  attfunc :qry_count, :tcrdbqrysearchcount, [ :pointer ], :int
@@ -22,7 +22,6 @@
22
22
  # Made in Japan.
23
23
  #++
24
24
 
25
-
26
25
  require 'rufus/tokyo/ttcommons'
27
26
 
28
27
 
@@ -83,7 +82,7 @@ module Rufus::Tokyo
83
82
  @host = host
84
83
  @port = port
85
84
 
86
- (lib.tcrdbopen(@db, host, port) != 0) ||
85
+ lib.tcrdbopen(@db, host, port) ||
87
86
  raise(TokyoError.new("couldn't connect to tyrant at #{host}:#{port}"))
88
87
 
89
88
  if self.stat['type'] != 'table'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-tokyo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2009-11-01 00:00:00 +09:00
15
+ date: 2009-11-16 00:00:00 +09:00
16
16
  default_executable:
17
17
  dependencies: []
18
18