jackowayed-rufus-tokyo 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/CHANGELOG.txt +104 -0
  2. data/CREDITS.txt +25 -0
  3. data/README.txt +310 -0
  4. data/spec/spec.rb +9 -0
  5. metadata +66 -0
data/CHANGELOG.txt ADDED
@@ -0,0 +1,104 @@
1
+
2
+ = rufus-tokyo CHANGELOG.txt
3
+
4
+
5
+ == rufus-tokyo - 0.1.13 not yet released
6
+
7
+ - todo : added #defrag to Rufus::Tokyo::Cabinet
8
+ - todo : added :dfunit to databases that support it
9
+ - todo : added #addint and #adddouble (#int_incr and #double_incr)
10
+
11
+
12
+ == rufus-tokyo - 0.1.12 released 2009/04/07
13
+
14
+ - todo : added ext method for calling embedded Lua function (Tyrant)
15
+ - todo : added transaction support for Rufus::Tokyo::Cabinet
16
+ - todo : mimicking query.count in rufus/edo
17
+ - todo : implemented query.count (TC 1.4.12 and TT 1.1.20 only) rufus/tokyo
18
+
19
+
20
+ == rufus-tokyo - 0.1.11 released 2009/03/25
21
+
22
+ - todo : autodetecting /usr/lib/libtokyocabinet.so and
23
+ /usr/lib/libtokyotyrant.so (thanks mebaran)
24
+
25
+
26
+ == rufus-tokyo - 0.1.10 released 2009/03/19
27
+
28
+ - bug : had to adapt to TC 1.4.10 and TT 1.1.17 new "setlimit"
29
+
30
+
31
+ == rufus-tokyo - 0.1.9 released 2009/02/27
32
+
33
+ - bug : sudo gem install rufus-tokyo was failing because of
34
+ lib/tokyotyrant.rb. Fixed.
35
+
36
+
37
+ == rufus-tokyo - 0.1.8 released 2009/02/27
38
+
39
+ - added : support for Hirabayashi-san 'native' Ruby classes via Rufus::Edo
40
+ - todo : implemented #delete_keys_with_prefix (naive impl for tables)
41
+ - added : lget/ldelete and merge! to Rufus::Tokyo::Cabinet and ::Tyrant
42
+
43
+
44
+ == rufus-tokyo - 0.1.7 released 2009/02/19
45
+
46
+ - todo : Rufus::Tokyo::Cabinet.new('filename', :type => :hash) now OK (Zev)
47
+ - todo : more documentation for Rufus::Tokyo::Cabinet#new
48
+ - added : Rufus::Tokyo::Cabinet has a open method that takes a block like
49
+ File.open (Zev)
50
+ - todo : aligned Rufus::Tokyo::Table#new on ::Cabinet#new
51
+ - todo : added opts (:prefix, :limit, :native) to Rufus::Tokyo::Cabinet#keys,
52
+ Rufus::Tokyo::Table#keys and the corresponding Tyrant classes
53
+
54
+
55
+ == rufus-tokyo - 0.1.6 released 2009/02/16
56
+
57
+ - todo : Tyrant and TyrantTable now complain when used in lieu of each other
58
+ - todo : implemented Tyrant and TyrantTable #stat
59
+ - todo : made tran begin/abort/commit directly available (framework builders)
60
+ - todo : implemented Rufus::Tokyo::Table#transaction
61
+ - bug : JRuby support back in
62
+ - todo : implemented Rufus::Tokyo::Map#[] (class method)
63
+ - todo : simplified Table and TyrantTable #[]=
64
+ - bug : preventing table#[]= from segfaulting on bad input (Justin)
65
+
66
+
67
+ == rufus-tokyo - 0.1.5 released 2009/02/13
68
+
69
+ - todo : implemented set_index (cabinet / tyrant tables)
70
+ - todo : namespace simplification (Justin)
71
+ - todo : implemented Rufus::Tokyo::TyrantTable
72
+ - todo : implemented Rufus::Tokyo::Tyrant
73
+ - todo : moved tests to bacon (spec/)
74
+
75
+
76
+ == rufus-tokyo - 0.1.4 released 2009/02/02
77
+
78
+ - todo #23780 : hmethods for Rufus::Tokyo::Table
79
+
80
+
81
+ == rufus-tokyo - 0.1.3 released 2009/01/29
82
+
83
+ - todo : implemented Rufus::Tokyo::Table (and query)
84
+ - todo : implemented Rufus::Tokyo::List
85
+ - todo : implemented Rufus::Tokyo::Map
86
+ - todo : implemented Cabinet#compact_copy
87
+ - todo : implemented Cabinet#copy
88
+
89
+
90
+ == rufus-tokyo - 0.1.2 released 2009/01/23
91
+
92
+ - todo : implemented Cabinet#keys and #values
93
+
94
+
95
+ == rufus-tokyo - 0.1.1 released 2009/01/23
96
+
97
+ - bug : fixed dependency, it's ffi not ruby-ffi
98
+ - todo : implemented Cabinet#clear
99
+
100
+
101
+ == rufus-tokyo - 0.1.0 released 2009/01/23
102
+
103
+ - initial release
104
+
data/CREDITS.txt ADDED
@@ -0,0 +1,25 @@
1
+
2
+ = CREDITS.txt rufus-tokyo gem
3
+
4
+
5
+ == authors
6
+
7
+ John Mettraux http://jmettraux.wordpress.com
8
+ Zev Blut http://www.iknow.co.jp/users/zev
9
+
10
+
11
+ == contributors
12
+
13
+ Justin Reagor http://blog.kineticweb.com/
14
+ Benjami Yu http://github.com/byu
15
+ mebaran http://github.com/mebaran
16
+
17
+
18
+ == finally
19
+
20
+ many thanks to the author of Tokyo Cabinet (Mikio Hirabayashi) and
21
+ the authors of ruby-ffi
22
+
23
+ http://tokyocabinet.sourceforge.net
24
+ http://kenai.com/projects/ruby-ffi
25
+
data/README.txt ADDED
@@ -0,0 +1,310 @@
1
+
2
+ = rufus-tokyo
3
+
4
+ ruby-ffi based interface to Tokyo Cabinet and Tokyo Tyrant.
5
+
6
+ The 'abstract' and the 'table' API are covered for now.
7
+
8
+
9
+ == installation
10
+
11
+ sudo gem install rufus-tokyo
12
+
13
+ (see after 'usage' for how to install Tokyo Cabinet (and Tyrant) if required)
14
+
15
+
16
+ == Rufus::Edo
17
+
18
+ Note : Rufus::Tokyo focuses on leveraging Hirabayashi-san's C libraries via ruby-ffi, but the gem rufus-tokyo also contains Rufus::Edo which wraps the Tokyo Cabinet/Tyrant author's [native] C bindings :
19
+
20
+ http://github.com/jmettraux/rufus-tokyo/tree/master/lib/rufus/edo
21
+
22
+
23
+ == usage
24
+
25
+ hereafter TC references Tokyo Cabinet, while TT references Tokyo Tyrant.
26
+
27
+ the rdoc is at http://rufus.rubyforge.org/rufus-tokyo/
28
+
29
+
30
+ == version [mis]match
31
+
32
+ this version of rufus-tokyo works with
33
+
34
+ ffi 0.3.1, 0.3.5
35
+
36
+ ruby 1.8.6
37
+ ruby 1.9.1p0
38
+ jruby 1.1.6
39
+ jruby 1.2.0
40
+
41
+ TC 1.4.9 and TT 1.1.16
42
+ TC 1.4.10 and TT 1.1.17 (adds the offset arg to query.limit)
43
+ TC 1.4.11 and TT 1.1.18
44
+ TC 1.4.13 and TT 1.1.22 (added query.count)
45
+
46
+ tc-ruby 1.20 and tt-ruby 1.3 (Rufus::Edo)
47
+ tc-ruby 1.21 and tt-ruby 1.5 (Rufus::Edo)
48
+
49
+
50
+ === TC Abstract API
51
+
52
+ http://tokyocabinet.sourceforge.net/spex-en.html#tcadbapi
53
+
54
+ to create a hash (file named 'data.tch')
55
+
56
+ require 'rubygems'
57
+ require 'rufus/tokyo'
58
+
59
+ db = Rufus::Tokyo::Cabinet.new('data.tch')
60
+
61
+ db['nada'] = 'surf'
62
+
63
+ p db['nada'] # => 'surf'
64
+ p db['lost'] # => nil
65
+
66
+ 5000.times { |i| db[i.to_s] = "x" }
67
+
68
+ p db.inject { |r, (k, v)| k } # => 4999
69
+
70
+ db.close
71
+
72
+
73
+ === TC Table API
74
+
75
+ http://tokyocabinet.sourceforge.net/spex-en.html#tctdbapi
76
+
77
+ require 'rubygems'
78
+ require 'rufus/tokyo'
79
+
80
+ t = Rufus::Tokyo::Table.new('table.tct')
81
+
82
+ t['pk0'] = { 'name' => 'alfred', 'age' => '22' }
83
+ t['pk1'] = { 'name' => 'bob', 'age' => '18' }
84
+ t['pk2'] = { 'name' => 'charly', 'age' => '45' }
85
+ t['pk3'] = { 'name' => 'doug', 'age' => '77' }
86
+ t['pk4'] = { 'name' => 'ephrem', 'age' => '32' }
87
+
88
+ p t.query { |q|
89
+ q.add_condition 'age', :numge, '32'
90
+ q.order_by 'age'
91
+ }
92
+ # => [ {"name"=>"ephrem", :pk=>"pk4", "age"=>"32"},
93
+ # {"name"=>"charly", :pk=>"pk2", "age"=>"45"} ]
94
+
95
+ t.close
96
+
97
+ Note that the Tokyo Cabinet Table API does support transactions :
98
+
99
+ p t.size
100
+ # => 0
101
+
102
+ t.transaction do
103
+ t['pk0'] = { 'name' => 'alfred', 'age' => '22' }
104
+ t['pk1'] = { 'name' => 'bob', 'age' => '18' }
105
+ t.abort
106
+ end
107
+
108
+ p t.size
109
+ # => 0
110
+
111
+
112
+ === TT remote db
113
+
114
+ http://tokyocabinet.sourceforge.net/tyrantdoc/
115
+
116
+ to start a ttserver (backed by a hash), on the command line
117
+
118
+ ttserver -port 45001 data.tch
119
+
120
+
121
+ then, in Ruby :
122
+
123
+ require 'rubygems'
124
+ require 'rufus/tokyo/tyrant'
125
+
126
+ db = Rufus::Tokyo::Tyrant.new('localhost', 45001)
127
+
128
+ db['nada'] = 'surf'
129
+
130
+ p db['nada'] # => 'surf'
131
+ p db['lost'] # => nil
132
+
133
+ db.close
134
+
135
+
136
+ Rufus::Tokyo::Tyrant instances have a #stat method :
137
+
138
+ puts db.stat.inject('') { |s, (k, v)| s << "#{k} => #{v}\n" }
139
+ # =>
140
+ # pid => 7566
141
+ # loadavg => 0.398438
142
+ # size => 528736
143
+ # rnum => 0
144
+ # time => 1234764065.305923
145
+ # sid => 898521513
146
+ # type => hash
147
+ # bigend => 0
148
+ # ru_sys => 3.398698
149
+ # version => 1.1.15
150
+ # ru_user => 2.155215
151
+ # ru_real => 3218.451152
152
+ # fd => 7
153
+
154
+
155
+ Note that it's also OK to make a Tokyo Tyrant server listen on a unix socket :
156
+
157
+ ttserver -host /tmp/ttsocket -port 0 data.tch
158
+
159
+ and then :
160
+
161
+ require 'rubygems'
162
+ require 'rufus/tokyo/tyrant'
163
+ db = Rufus::Tokyo::Tyrant.new('/tmp/ttsocket')
164
+ db['a'] = 'alpha'
165
+ db.close
166
+
167
+
168
+ === TT remote table
169
+
170
+ to start a ttserver (backed by a table), on the command line :
171
+
172
+ ttserver -port 45002 data.tct
173
+
174
+
175
+ then, in Ruby, much like a local table :
176
+
177
+ require 'rubygems'
178
+ require 'rufus/tokyo/tyrant'
179
+
180
+ t = Rufus::Tokyo::TyrantTable.new('localhost', 45002)
181
+
182
+ t['pk0'] = { 'name' => 'alfred', 'age' => '22' }
183
+ t['pk1'] = { 'name' => 'bob', 'age' => '18' }
184
+ t['pk2'] = { 'name' => 'charly', 'age' => '45' }
185
+ t['pk3'] = { 'name' => 'doug', 'age' => '77' }
186
+ t['pk4'] = { 'name' => 'ephrem', 'age' => '32' }
187
+
188
+ p t.query { |q|
189
+ q.add_condition 'age', :numge, '32'
190
+ q.order_by 'age'
191
+ }
192
+ # => [ {"name"=>"ephrem", :pk=>"pk4", "age"=>"32"},
193
+ # {"name"=>"charly", :pk=>"pk2", "age"=>"45"} ]
194
+
195
+ t.close
196
+
197
+
198
+ Rufus::Tokyo::TyrantTable instances have a #stat method :
199
+
200
+ puts t.stat.inject('') { |s, (k, v)| s << "#{k} => #{v}\n" }
201
+ # =>
202
+ # pid => 7569
203
+ # loadavg => 0.295410
204
+ # size => 935792
205
+ # rnum => 0
206
+ # time => 1234764228.942014
207
+ # sid => 1027604232
208
+ # type => table
209
+ # bigend => 0
210
+ # ru_sys => 5.966750
211
+ # version => 1.1.15
212
+ # ru_user => 2.601947
213
+ # ru_real => 3382.084479
214
+ # fd => 10
215
+
216
+
217
+ Note that it's also OK to make a Tokyo Tyrant server listen on a unix socket :
218
+
219
+ ttserver -host /tmp/tttsocket -port 0 data.tct
220
+
221
+ and then :
222
+
223
+ require 'rubygems'
224
+ require 'rufus/tokyo/tyrant'
225
+ t = Rufus::Tokyo::TyrantTable.new('/tmp/tttsocket')
226
+ t['customer0'] = { 'name' => 'Heike no Kyomori', 'age' => '75' }
227
+ t.close
228
+
229
+
230
+ == rdoc
231
+
232
+ more in the rdoc
233
+
234
+ http://rufus.rubyforge.org/rufus-tokyo/
235
+ http://rufus.rubyforge.org/rufus-tokyo/classes/Rufus/Tokyo/Cabinet.html
236
+ http://rufus.rubyforge.org/rufus-tokyo/classes/Rufus/Tokyo/Table.html
237
+ http://rufus.rubyforge.org/rufus-tokyo/classes/Rufus/Tokyo/Tyrant.html
238
+ http://rufus.rubyforge.org/rufus-tokyo/classes/Rufus/Tokyo/TyrantTable.html
239
+
240
+ don't hesitate to "man ttserver" on the command line.
241
+
242
+ or directly in the source
243
+
244
+ http://github.com/jmettraux/rufus-tokyo/blob/master/lib/rufus/tokyo/cabinet/abstract.rb
245
+ http://github.com/jmettraux/rufus-tokyo/blob/master/lib/rufus/tokyo/cabinet/table.rb
246
+ http://github.com/jmettraux/rufus-tokyo/blob/master/lib/rufus/tokyo/tyrant/abstract.rb
247
+ http://github.com/jmettraux/rufus-tokyo/blob/master/lib/rufus/tokyo/tyrant/table.rb
248
+
249
+
250
+ == Tokyo Cabinet / Tyrant install
251
+
252
+ a compilation of notes is available at :
253
+
254
+ http://openwferu.rubyforge.org/tokyo.html
255
+
256
+
257
+ == dependencies
258
+
259
+ the ruby gem 'ffi'
260
+
261
+
262
+ == mailing list
263
+
264
+ On the rufus-ruby list :
265
+
266
+ http://groups.google.com/group/rufus-ruby
267
+
268
+
269
+ == issue tracker
270
+
271
+ http://rubyforge.org/tracker/?atid=18584&group_id=4812&func=browse
272
+
273
+
274
+ == irc
275
+
276
+ irc.freenode.net #ruote
277
+
278
+
279
+ == source
280
+
281
+ http://github.com/jmettraux/rufus-tokyo
282
+
283
+ git clone git://github.com/jmettraux/rufus-tokyo.git
284
+
285
+
286
+ == credits
287
+
288
+ many thanks to the author of Tokyo Cabinet, Mikio Hirabayashi, and to the authors of ruby-ffi
289
+
290
+ http://tokyocabinet.sourceforge.net
291
+ http://kenai.com/projects/ruby-ffi
292
+
293
+ dystopia interface developed with and sponsored by Seven Scale <http://sevenscale.com/>,
294
+ creaters of Open Syslog.
295
+
296
+ == authors
297
+
298
+ John Mettraux, jmettraux@gmail.com, http://jmettraux.wordpress.com
299
+ Zev Blut, http://www.iknow.co.jp/users/zev
300
+ Jeremy Hinegardner, jeremy@copiousfreetime.org, http://copiousfreetime.org
301
+
302
+ == the rest of Rufus
303
+
304
+ http://rufus.rubyforge.org
305
+
306
+
307
+ == license
308
+
309
+ MIT
310
+
data/spec/spec.rb ADDED
@@ -0,0 +1,9 @@
1
+
2
+ #
3
+ # specifying rufus-tokyo
4
+ #
5
+ # Sun Feb 8 13:12:54 JST 2009
6
+ #
7
+
8
+ Dir["#{File.dirname(__FILE__)}/*_spec.rb"].each { |path| load(path) }
9
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jackowayed-rufus-tokyo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.13
5
+ platform: ruby
6
+ authors:
7
+ - John Mettraux
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-16 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ffi
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description:
26
+ email: jmettraux@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.txt
33
+ - CHANGELOG.txt
34
+ - CREDITS.txt
35
+ files:
36
+ - README.txt
37
+ - CHANGELOG.txt
38
+ - CREDITS.txt
39
+ has_rdoc: true
40
+ homepage: http://rufus.rubyforge.org/
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ requirements:
59
+ - ffi
60
+ rubyforge_project: rufus
61
+ rubygems_version: 1.2.0
62
+ signing_key:
63
+ specification_version: 2
64
+ summary: ruby-ffi based lib to access Tokyo Cabinet and Tyrant
65
+ test_files:
66
+ - spec/spec.rb