ntalbott-rufus-tokyo 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGELOG.txt +112 -0
  2. data/CREDITS.txt +27 -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,112 @@
1
+
2
+ = rufus-tokyo CHANGELOG.txt
3
+
4
+
5
+ == rufus-tokyo - 0.1.14 not yet released
6
+
7
+ - issue #2 : query#add with no_index=false by default
8
+ - issue #1 : added query#delete and table#query_delete
9
+
10
+
11
+ == rufus-tokyo - 0.1.13 released 2009/06/02
12
+
13
+ - todo : putkeep implementation (by Kamal)
14
+ - todo : support for binary data (map, list, cabinet, table, tokyo/edo)
15
+ - todo : added #defrag to Rufus::Tokyo::Cabinet
16
+ - todo : added :dfunit to databases that support it
17
+ - todo : added #addint and #adddouble (#incr)
18
+
19
+
20
+ == rufus-tokyo - 0.1.12 released 2009/04/07
21
+
22
+ - todo : added ext method for calling embedded Lua function (Tyrant)
23
+ - todo : added transaction support for Rufus::Tokyo::Cabinet
24
+ - todo : mimicking query.count in rufus/edo
25
+ - todo : implemented query.count (TC 1.4.12 and TT 1.1.20 only) rufus/tokyo
26
+
27
+
28
+ == rufus-tokyo - 0.1.11 released 2009/03/25
29
+
30
+ - todo : autodetecting /usr/lib/libtokyocabinet.so and
31
+ /usr/lib/libtokyotyrant.so (thanks mebaran)
32
+
33
+
34
+ == rufus-tokyo - 0.1.10 released 2009/03/19
35
+
36
+ - bug : had to adapt to TC 1.4.10 and TT 1.1.17 new "setlimit"
37
+
38
+
39
+ == rufus-tokyo - 0.1.9 released 2009/02/27
40
+
41
+ - bug : sudo gem install rufus-tokyo was failing because of
42
+ lib/tokyotyrant.rb. Fixed.
43
+
44
+
45
+ == rufus-tokyo - 0.1.8 released 2009/02/27
46
+
47
+ - added : support for Hirabayashi-san 'native' Ruby classes via Rufus::Edo
48
+ - todo : implemented #delete_keys_with_prefix (naive impl for tables)
49
+ - added : lget/ldelete and merge! to Rufus::Tokyo::Cabinet and ::Tyrant
50
+
51
+
52
+ == rufus-tokyo - 0.1.7 released 2009/02/19
53
+
54
+ - todo : Rufus::Tokyo::Cabinet.new('filename', :type => :hash) now OK (Zev)
55
+ - todo : more documentation for Rufus::Tokyo::Cabinet#new
56
+ - added : Rufus::Tokyo::Cabinet has a open method that takes a block like
57
+ File.open (Zev)
58
+ - todo : aligned Rufus::Tokyo::Table#new on ::Cabinet#new
59
+ - todo : added opts (:prefix, :limit, :native) to Rufus::Tokyo::Cabinet#keys,
60
+ Rufus::Tokyo::Table#keys and the corresponding Tyrant classes
61
+
62
+
63
+ == rufus-tokyo - 0.1.6 released 2009/02/16
64
+
65
+ - todo : Tyrant and TyrantTable now complain when used in lieu of each other
66
+ - todo : implemented Tyrant and TyrantTable #stat
67
+ - todo : made tran begin/abort/commit directly available (framework builders)
68
+ - todo : implemented Rufus::Tokyo::Table#transaction
69
+ - bug : JRuby support back in
70
+ - todo : implemented Rufus::Tokyo::Map#[] (class method)
71
+ - todo : simplified Table and TyrantTable #[]=
72
+ - bug : preventing table#[]= from segfaulting on bad input (Justin)
73
+
74
+
75
+ == rufus-tokyo - 0.1.5 released 2009/02/13
76
+
77
+ - todo : implemented set_index (cabinet / tyrant tables)
78
+ - todo : namespace simplification (Justin)
79
+ - todo : implemented Rufus::Tokyo::TyrantTable
80
+ - todo : implemented Rufus::Tokyo::Tyrant
81
+ - todo : moved tests to bacon (spec/)
82
+
83
+
84
+ == rufus-tokyo - 0.1.4 released 2009/02/02
85
+
86
+ - todo #23780 : hmethods for Rufus::Tokyo::Table
87
+
88
+
89
+ == rufus-tokyo - 0.1.3 released 2009/01/29
90
+
91
+ - todo : implemented Rufus::Tokyo::Table (and query)
92
+ - todo : implemented Rufus::Tokyo::List
93
+ - todo : implemented Rufus::Tokyo::Map
94
+ - todo : implemented Cabinet#compact_copy
95
+ - todo : implemented Cabinet#copy
96
+
97
+
98
+ == rufus-tokyo - 0.1.2 released 2009/01/23
99
+
100
+ - todo : implemented Cabinet#keys and #values
101
+
102
+
103
+ == rufus-tokyo - 0.1.1 released 2009/01/23
104
+
105
+ - bug : fixed dependency, it's ffi not ruby-ffi
106
+ - todo : implemented Cabinet#clear
107
+
108
+
109
+ == rufus-tokyo - 0.1.0 released 2009/01/23
110
+
111
+ - initial release
112
+
data/CREDITS.txt ADDED
@@ -0,0 +1,27 @@
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
+ Matthew King http://github.com/automatthew
14
+ Kamal Fariz Mahyuddin http://github.com/kamal
15
+ Justin Reagor http://blog.kineticweb.com/
16
+ Benjami Yu http://github.com/byu
17
+ Mark 'mebaran' http://github.com/mebaran
18
+
19
+
20
+ == finally
21
+
22
+ many thanks to the author of Tokyo Cabinet (Mikio Hirabayashi) and
23
+ the authors of ruby-ffi
24
+
25
+ http://tokyocabinet.sourceforge.net
26
+ http://kenai.com/projects/ruby-ffi
27
+
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
+ TC 1.4.21 and TT 1.1.27
46
+
47
+ tc-ruby 1.20 and tt-ruby 1.3 (Rufus::Edo)
48
+ tc-ruby 1.21 and tt-ruby 1.5 (Rufus::Edo)
49
+ tc-ruby 1.21 and tt-ruby 1.7 (Rufus::Edo)
50
+
51
+
52
+ === TC Abstract API
53
+
54
+ http://tokyocabinet.sourceforge.net/spex-en.html#tcadbapi
55
+
56
+ to create a hash (file named 'data.tch')
57
+
58
+ require 'rubygems'
59
+ require 'rufus/tokyo'
60
+
61
+ db = Rufus::Tokyo::Cabinet.new('data.tch')
62
+
63
+ db['nada'] = 'surf'
64
+
65
+ p db['nada'] # => 'surf'
66
+ p db['lost'] # => nil
67
+
68
+ 5000.times { |i| db[i.to_s] = "x" }
69
+
70
+ p db.inject { |r, (k, v)| k } # => 4999
71
+
72
+ db.close
73
+
74
+
75
+ === TC Table API
76
+
77
+ http://tokyocabinet.sourceforge.net/spex-en.html#tctdbapi
78
+
79
+ require 'rubygems'
80
+ require 'rufus/tokyo'
81
+
82
+ t = Rufus::Tokyo::Table.new('table.tct')
83
+
84
+ t['pk0'] = { 'name' => 'alfred', 'age' => '22' }
85
+ t['pk1'] = { 'name' => 'bob', 'age' => '18' }
86
+ t['pk2'] = { 'name' => 'charly', 'age' => '45' }
87
+ t['pk3'] = { 'name' => 'doug', 'age' => '77' }
88
+ t['pk4'] = { 'name' => 'ephrem', 'age' => '32' }
89
+
90
+ p t.query { |q|
91
+ q.add_condition 'age', :numge, '32'
92
+ q.order_by 'age'
93
+ }
94
+ # => [ {"name"=>"ephrem", :pk=>"pk4", "age"=>"32"},
95
+ # {"name"=>"charly", :pk=>"pk2", "age"=>"45"} ]
96
+
97
+ t.close
98
+
99
+ Note that the Tokyo Cabinet Table API does support transactions :
100
+
101
+ p t.size
102
+ # => 0
103
+
104
+ t.transaction do
105
+ t['pk0'] = { 'name' => 'alfred', 'age' => '22' }
106
+ t['pk1'] = { 'name' => 'bob', 'age' => '18' }
107
+ t.abort
108
+ end
109
+
110
+ p t.size
111
+ # => 0
112
+
113
+
114
+ === TT remote db
115
+
116
+ http://tokyocabinet.sourceforge.net/tyrantdoc/
117
+
118
+ to start a ttserver (backed by a hash), on the command line
119
+
120
+ ttserver -port 45001 data.tch
121
+
122
+
123
+ then, in Ruby :
124
+
125
+ require 'rubygems'
126
+ require 'rufus/tokyo/tyrant'
127
+
128
+ db = Rufus::Tokyo::Tyrant.new('localhost', 45001)
129
+
130
+ db['nada'] = 'surf'
131
+
132
+ p db['nada'] # => 'surf'
133
+ p db['lost'] # => nil
134
+
135
+ db.close
136
+
137
+
138
+ Rufus::Tokyo::Tyrant instances have a #stat method :
139
+
140
+ puts db.stat.inject('') { |s, (k, v)| s << "#{k} => #{v}\n" }
141
+ # =>
142
+ # pid => 7566
143
+ # loadavg => 0.398438
144
+ # size => 528736
145
+ # rnum => 0
146
+ # time => 1234764065.305923
147
+ # sid => 898521513
148
+ # type => hash
149
+ # bigend => 0
150
+ # ru_sys => 3.398698
151
+ # version => 1.1.15
152
+ # ru_user => 2.155215
153
+ # ru_real => 3218.451152
154
+ # fd => 7
155
+
156
+
157
+ Note that it's also OK to make a Tokyo Tyrant server listen on a unix socket :
158
+
159
+ ttserver -host /tmp/ttsocket -port 0 data.tch
160
+
161
+ and then :
162
+
163
+ require 'rubygems'
164
+ require 'rufus/tokyo/tyrant'
165
+ db = Rufus::Tokyo::Tyrant.new('/tmp/ttsocket')
166
+ db['a'] = 'alpha'
167
+ db.close
168
+
169
+
170
+ === TT remote table
171
+
172
+ to start a ttserver (backed by a table), on the command line :
173
+
174
+ ttserver -port 45002 data.tct
175
+
176
+
177
+ then, in Ruby, much like a local table :
178
+
179
+ require 'rubygems'
180
+ require 'rufus/tokyo/tyrant'
181
+
182
+ t = Rufus::Tokyo::TyrantTable.new('localhost', 45002)
183
+
184
+ t['pk0'] = { 'name' => 'alfred', 'age' => '22' }
185
+ t['pk1'] = { 'name' => 'bob', 'age' => '18' }
186
+ t['pk2'] = { 'name' => 'charly', 'age' => '45' }
187
+ t['pk3'] = { 'name' => 'doug', 'age' => '77' }
188
+ t['pk4'] = { 'name' => 'ephrem', 'age' => '32' }
189
+
190
+ p t.query { |q|
191
+ q.add_condition 'age', :numge, '32'
192
+ q.order_by 'age'
193
+ }
194
+ # => [ {"name"=>"ephrem", :pk=>"pk4", "age"=>"32"},
195
+ # {"name"=>"charly", :pk=>"pk2", "age"=>"45"} ]
196
+
197
+ t.close
198
+
199
+
200
+ Rufus::Tokyo::TyrantTable instances have a #stat method :
201
+
202
+ puts t.stat.inject('') { |s, (k, v)| s << "#{k} => #{v}\n" }
203
+ # =>
204
+ # pid => 7569
205
+ # loadavg => 0.295410
206
+ # size => 935792
207
+ # rnum => 0
208
+ # time => 1234764228.942014
209
+ # sid => 1027604232
210
+ # type => table
211
+ # bigend => 0
212
+ # ru_sys => 5.966750
213
+ # version => 1.1.15
214
+ # ru_user => 2.601947
215
+ # ru_real => 3382.084479
216
+ # fd => 10
217
+
218
+
219
+ Note that it's also OK to make a Tokyo Tyrant server listen on a unix socket :
220
+
221
+ ttserver -host /tmp/tttsocket -port 0 data.tct
222
+
223
+ and then :
224
+
225
+ require 'rubygems'
226
+ require 'rufus/tokyo/tyrant'
227
+ t = Rufus::Tokyo::TyrantTable.new('/tmp/tttsocket')
228
+ t['customer0'] = { 'name' => 'Heike no Kyomori', 'age' => '75' }
229
+ t.close
230
+
231
+
232
+ == rdoc
233
+
234
+ more in the rdoc
235
+
236
+ http://rufus.rubyforge.org/rufus-tokyo/
237
+ http://rufus.rubyforge.org/rufus-tokyo/classes/Rufus/Tokyo/Cabinet.html
238
+ http://rufus.rubyforge.org/rufus-tokyo/classes/Rufus/Tokyo/Table.html
239
+ http://rufus.rubyforge.org/rufus-tokyo/classes/Rufus/Tokyo/Tyrant.html
240
+ http://rufus.rubyforge.org/rufus-tokyo/classes/Rufus/Tokyo/TyrantTable.html
241
+
242
+ don't hesitate to "man ttserver" on the command line.
243
+
244
+ or directly in the source
245
+
246
+ http://github.com/jmettraux/rufus-tokyo/blob/master/lib/rufus/tokyo/cabinet/abstract.rb
247
+ http://github.com/jmettraux/rufus-tokyo/blob/master/lib/rufus/tokyo/cabinet/table.rb
248
+ http://github.com/jmettraux/rufus-tokyo/blob/master/lib/rufus/tokyo/tyrant/abstract.rb
249
+ http://github.com/jmettraux/rufus-tokyo/blob/master/lib/rufus/tokyo/tyrant/table.rb
250
+
251
+
252
+ == Tokyo Cabinet / Tyrant install
253
+
254
+ a compilation of notes is available at :
255
+
256
+ http://openwferu.rubyforge.org/tokyo.html
257
+
258
+
259
+ == dependencies
260
+
261
+ the ruby gem 'ffi'
262
+
263
+
264
+ == mailing list
265
+
266
+ On the rufus-ruby list :
267
+
268
+ http://groups.google.com/group/rufus-ruby
269
+
270
+
271
+ == issue tracker
272
+
273
+ http://github.com/jmettraux/rufus-tokyo/issues/
274
+
275
+
276
+ == irc
277
+
278
+ irc.freenode.net #ruote
279
+
280
+
281
+ == source
282
+
283
+ http://github.com/jmettraux/rufus-tokyo
284
+
285
+ git clone git://github.com/jmettraux/rufus-tokyo.git
286
+
287
+
288
+ == credits
289
+
290
+ many thanks to the author of Tokyo Cabinet, Mikio Hirabayashi, and to the authors of ruby-ffi
291
+
292
+ http://tokyocabinet.sourceforge.net
293
+ http://kenai.com/projects/ruby-ffi
294
+
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
+
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: ntalbott-rufus-tokyo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.14
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