moneta 0.7.10 → 0.7.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/CHANGES +8 -0
- data/Gemfile +7 -2
- data/README.md +7 -7
- data/Rakefile +35 -31
- data/lib/moneta/adapters/cassandra.rb +4 -0
- data/lib/moneta/adapters/couch.rb +36 -24
- data/lib/moneta/adapters/hbase.rb +5 -0
- data/lib/moneta/adapters/restclient.rb +11 -19
- data/lib/moneta/adapters/tokyotyrant.rb +27 -16
- data/lib/moneta/logger.rb +24 -7
- data/lib/moneta/transformer/config.rb +1 -0
- data/lib/moneta/version.rb +1 -1
- data/lib/rack/moneta_rest.rb +1 -1
- data/script/benchmarks +27 -27
- data/script/generate-specs +18 -9
- data/script/start-services +9 -1
- data/spec/moneta/adapter_activerecord_spec.rb +0 -4
- data/spec/moneta/adapter_cassandra_spec.rb +0 -4
- data/spec/moneta/adapter_cassandra_with_default_expires_spec.rb +0 -4
- data/spec/moneta/adapter_client_spec.rb +0 -4
- data/spec/moneta/adapter_cookie_spec.rb +0 -4
- data/spec/moneta/adapter_couch_spec.rb +0 -4
- data/spec/moneta/adapter_datamapper_spec.rb +0 -4
- data/spec/moneta/adapter_daybreak_spec.rb +0 -4
- data/spec/moneta/adapter_dbm_spec.rb +0 -4
- data/spec/moneta/adapter_file_spec.rb +0 -4
- data/spec/moneta/adapter_fog_spec.rb +0 -4
- data/spec/moneta/adapter_gdbm_spec.rb +0 -4
- data/spec/moneta/adapter_hbase_spec.rb +0 -4
- data/spec/moneta/adapter_kyotocabinet_spec.rb +0 -4
- data/spec/moneta/adapter_leveldb_spec.rb +0 -4
- data/spec/moneta/adapter_localmemcache_spec.rb +0 -4
- data/spec/moneta/adapter_lruhash_spec.rb +0 -4
- data/spec/moneta/adapter_memcached_dalli_spec.rb +0 -4
- data/spec/moneta/adapter_memcached_dalli_with_default_expires_spec.rb +0 -4
- data/spec/moneta/adapter_memcached_native_spec.rb +0 -4
- data/spec/moneta/adapter_memcached_native_with_default_expires_spec.rb +0 -4
- data/spec/moneta/adapter_memcached_spec.rb +0 -4
- data/spec/moneta/adapter_memcached_with_default_expires_spec.rb +0 -4
- data/spec/moneta/adapter_memory_spec.rb +0 -4
- data/spec/moneta/adapter_mongo_spec.rb +0 -4
- data/spec/moneta/adapter_mongo_with_default_expires_spec.rb +0 -4
- data/spec/moneta/adapter_pstore_spec.rb +0 -4
- data/spec/moneta/adapter_redis_spec.rb +0 -4
- data/spec/moneta/adapter_redis_with_default_expires_spec.rb +0 -4
- data/spec/moneta/adapter_restclient_spec.rb +0 -4
- data/spec/moneta/adapter_riak_spec.rb +0 -4
- data/spec/moneta/adapter_sdbm_spec.rb +0 -4
- data/spec/moneta/adapter_sequel_spec.rb +0 -4
- data/spec/moneta/adapter_sqlite_spec.rb +0 -4
- data/spec/moneta/adapter_tdb_spec.rb +0 -4
- data/spec/moneta/adapter_tokyocabinet_bdb_spec.rb +0 -4
- data/spec/moneta/adapter_tokyocabinet_hdb_spec.rb +0 -4
- data/spec/moneta/adapter_tokyotyrant_spec.rb +0 -4
- data/spec/moneta/adapter_yaml_spec.rb +0 -4
- data/spec/moneta/cache_file_memory_spec.rb +0 -4
- data/spec/moneta/cache_memory_null_spec.rb +0 -4
- data/spec/moneta/expires_file_spec.rb +0 -4
- data/spec/moneta/expires_memory_spec.rb +0 -4
- data/spec/moneta/expires_memory_with_default_expires_spec.rb +0 -4
- data/spec/moneta/lock_spec.rb +0 -4
- data/spec/moneta/mutex_spec.rb +1 -5
- data/spec/moneta/null_adapter_spec.rb +0 -4
- data/spec/moneta/optionmerger_spec.rb +1 -5
- data/spec/moneta/pool_spec.rb +0 -4
- data/spec/moneta/proxy_expires_memory_spec.rb +0 -4
- data/spec/moneta/proxy_redis_spec.rb +0 -4
- data/spec/moneta/semaphore_spec.rb +1 -5
- data/spec/moneta/shared_tcp_spec.rb +0 -4
- data/spec/moneta/shared_unix_spec.rb +0 -4
- data/spec/moneta/simple_activerecord_spec.rb +1 -5
- data/spec/moneta/simple_activerecord_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_cassandra_spec.rb +1 -5
- data/spec/moneta/simple_client_tcp_spec.rb +1 -5
- data/spec/moneta/simple_client_unix_spec.rb +1 -5
- data/spec/moneta/simple_couch_spec.rb +1 -5
- data/spec/moneta/simple_couch_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_datamapper_spec.rb +1 -5
- data/spec/moneta/simple_datamapper_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_datamapper_with_repository_spec.rb +1 -5
- data/spec/moneta/simple_daybreak_spec.rb +1 -5
- data/spec/moneta/simple_daybreak_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_dbm_spec.rb +1 -5
- data/spec/moneta/simple_dbm_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_file_spec.rb +1 -5
- data/spec/moneta/simple_file_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_fog_spec.rb +1 -5
- data/spec/moneta/simple_fog_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_gdbm_spec.rb +1 -5
- data/spec/moneta/simple_gdbm_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_hashfile_spec.rb +1 -5
- data/spec/moneta/simple_hashfile_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_hbase_spec.rb +1 -5
- data/spec/moneta/simple_hbase_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_kyotocabinet_spec.rb +1 -5
- data/spec/moneta/simple_kyotocabinet_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_leveldb_spec.rb +1 -5
- data/spec/moneta/simple_leveldb_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_localmemcache_spec.rb +1 -5
- data/spec/moneta/simple_localmemcache_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_lruhash_spec.rb +1 -5
- data/spec/moneta/simple_lruhash_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_memcached_dalli_spec.rb +1 -5
- data/spec/moneta/simple_memcached_native_spec.rb +1 -5
- data/spec/moneta/simple_memcached_spec.rb +1 -5
- data/spec/moneta/simple_memory_spec.rb +1 -5
- data/spec/moneta/simple_memory_with_compress_spec.rb +1 -5
- data/spec/moneta/simple_memory_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_memory_with_json_key_serializer_spec.rb +1 -5
- data/spec/moneta/simple_memory_with_json_serializer_spec.rb +1 -5
- data/spec/moneta/simple_memory_with_json_value_serializer_spec.rb +1 -5
- data/spec/moneta/simple_memory_with_prefix_spec.rb +1 -5
- data/spec/moneta/simple_memory_with_snappy_compress_spec.rb +1 -5
- data/spec/moneta/simple_mongo_spec.rb +1 -5
- data/spec/moneta/simple_null_spec.rb +1 -5
- data/spec/moneta/simple_pstore_spec.rb +1 -5
- data/spec/moneta/simple_pstore_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_redis_spec.rb +1 -5
- data/spec/moneta/simple_restclient_spec.rb +1 -5
- data/spec/moneta/simple_riak_spec.rb +1 -5
- data/spec/moneta/simple_riak_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_sdbm_spec.rb +1 -5
- data/spec/moneta/simple_sdbm_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_sequel_spec.rb +1 -5
- data/spec/moneta/simple_sequel_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_sqlite_spec.rb +1 -5
- data/spec/moneta/simple_sqlite_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_tdb_spec.rb +1 -5
- data/spec/moneta/simple_tdb_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_tokyocabinet_spec.rb +1 -5
- data/spec/moneta/simple_tokyocabinet_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_tokyotyrant_spec.rb +1 -5
- data/spec/moneta/simple_tokyotyrant_with_expires_spec.rb +1 -5
- data/spec/moneta/simple_yaml_spec.rb +1 -5
- data/spec/moneta/simple_yaml_with_expires_spec.rb +1 -5
- data/spec/moneta/stack_file_memory_spec.rb +0 -4
- data/spec/moneta/stack_memory_file_spec.rb +0 -4
- data/spec/moneta/transformer_bencode_spec.rb +0 -4
- data/spec/moneta/transformer_bert_spec.rb +0 -4
- data/spec/moneta/transformer_bson_spec.rb +0 -4
- data/spec/moneta/transformer_bzip2_spec.rb +0 -4
- data/spec/moneta/transformer_json_spec.rb +0 -4
- data/spec/moneta/transformer_key_inspect_spec.rb +0 -4
- data/spec/moneta/transformer_key_marshal_spec.rb +0 -4
- data/spec/moneta/transformer_key_to_s_spec.rb +0 -4
- data/spec/moneta/transformer_key_yaml_spec.rb +0 -4
- data/spec/moneta/transformer_lzma_spec.rb +0 -4
- data/spec/moneta/transformer_lzo_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_base64_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_escape_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_hmac_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_md5_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_md5_spread_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_prefix_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_qp_spec.rb +122 -0
- data/spec/moneta/transformer_marshal_rmd160_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_sha1_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_sha256_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_sha384_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_sha512_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_truncate_spec.rb +0 -4
- data/spec/moneta/transformer_marshal_uuencode_spec.rb +0 -4
- data/spec/moneta/transformer_msgpack_spec.rb +0 -4
- data/spec/moneta/transformer_ox_spec.rb +0 -4
- data/spec/moneta/transformer_quicklz_spec.rb +0 -4
- data/spec/moneta/transformer_snappy_spec.rb +0 -4
- data/spec/moneta/transformer_tnet_spec.rb +0 -4
- data/spec/moneta/transformer_value_marshal_spec.rb +0 -4
- data/spec/moneta/transformer_value_yaml_spec.rb +0 -4
- data/spec/moneta/transformer_yaml_spec.rb +0 -4
- data/spec/moneta/transformer_zlib_spec.rb +0 -4
- data/spec/moneta/weak_create_spec.rb +0 -4
- data/spec/moneta/weak_increment_spec.rb +0 -4
- data/spec/monetaspecs.rb +4 -4
- metadata +4 -2
data/.travis.yml
CHANGED
data/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
0.7.11
|
2
|
+
|
3
|
+
* Logger: Add option :file
|
4
|
+
* Adapters::TokyoTyrant supports both native (ruby-tokyotyrant) and pure-ruby tokyotyrant gems
|
5
|
+
* Adapters::Couch use Faraday directly instead of buggy CouchRest
|
6
|
+
* Adapters::RestClient use Faraday
|
7
|
+
* Transformer: add quoted printable encoding (:qp)
|
8
|
+
|
1
9
|
0.7.10
|
2
10
|
|
3
11
|
* Adapters::TokyoTyrant added
|
data/Gemfile
CHANGED
@@ -25,6 +25,7 @@ gem 'snappy', :platforms => :ruby
|
|
25
25
|
gem 'qlzruby', :platforms => :ruby
|
26
26
|
|
27
27
|
# Backends
|
28
|
+
gem 'faraday'
|
28
29
|
gem 'daybreak'
|
29
30
|
gem 'dm-core'
|
30
31
|
gem 'dm-migrations'
|
@@ -33,18 +34,22 @@ gem 'fog'
|
|
33
34
|
gem 'activerecord', '>= 3.2.9'
|
34
35
|
gem 'redis'
|
35
36
|
gem 'mongo'
|
36
|
-
gem 'couchrest'
|
37
37
|
gem 'sequel'
|
38
38
|
gem 'dalli'
|
39
39
|
gem 'riak-client'
|
40
40
|
gem 'cassandra'
|
41
41
|
gem 'tokyotyrant'
|
42
|
+
#gem 'ruby-tokyotyrant', :platforms => :ruby
|
42
43
|
#gem 'hbaserb'
|
43
44
|
#gem 'localmemcache'
|
44
45
|
gem 'tdb', :platforms => :ruby
|
45
46
|
gem 'leveldb-ruby', :platforms => :ruby
|
46
47
|
gem 'tokyocabinet', :platforms => :ruby
|
47
|
-
|
48
|
+
unless defined?(JRUBY_VERSION)
|
49
|
+
# FIXME: We have to check manually for jruby
|
50
|
+
# otherwise bundle install --deployment doesn't work
|
51
|
+
gem 'kyotocabinet-ruby', :github => 'minad/kyotocabinet-ruby'
|
52
|
+
end
|
48
53
|
gem 'memcached', :platforms => :ruby
|
49
54
|
gem 'jruby-memcached', :platforms => :jruby
|
50
55
|
gem 'sqlite3', :platforms => :ruby
|
data/README.md
CHANGED
@@ -148,7 +148,7 @@ __NOTE:__ <a name="backend-matrix">The backend matrix</a> is much more readable
|
|
148
148
|
|
149
149
|
<tr><td>PStore</td><td>-</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://ruby-doc.org/stdlib/libdoc/pstore/rdoc/PStore.html">PStore</a> store</td></tr>
|
150
150
|
|
151
|
-
<tr><td>TokyoTyrant</td><td>
|
151
|
+
<tr><td>TokyoTyrant</td><td>tokyotyrant or ruby-tokyotyrant</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://fallabs.com/tokyotyrant/">TokyoTyrant</a> database</td></tr>
|
152
152
|
|
153
153
|
<tr><td>YAML</td><td>-</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/YAML/Store.html">YAML</a> store</td></tr>
|
154
154
|
|
@@ -164,22 +164,22 @@ __NOTE:__ <a name="backend-matrix">The backend matrix</a> is much more readable
|
|
164
164
|
|
165
165
|
<tr><td>TDB</td><td>tdb</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://tdb.samba.org/">TDB</a> database</td></tr>
|
166
166
|
|
167
|
-
<tr><td>KyotoCabinet</td><td>
|
167
|
+
<tr><td>KyotoCabinet</td><td>kyotocabinet</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://fallabs.com/kyotocabinet/">KyotoCabinet</a> database</td></tr>
|
168
168
|
|
169
|
-
<tr><td>TokyoCabinet</td><td>
|
169
|
+
<tr><td>TokyoCabinet</td><td>tokyocabinet</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://fallabs.com/tokyocabinet/">TokyoCabinet</a> database</td></tr>
|
170
170
|
|
171
171
|
<tr><td>DataMapper</td><td>dm-core, dm-migrations</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://datamapper.org/">DataMapper</a> ORM</td></tr>
|
172
172
|
|
173
|
+
<tr><td>HBase</td><td>hbaserb</td><td style="text-align:center;background:#55F">?</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://hbase.apache.org/">HBase</a> database</td></tr>
|
174
|
+
|
173
175
|
<tr><td>Cassandra</td><td>cassandra</td><td style="text-align:center;background:#55F">?</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://cassandra.apache.org/">Cassandra</a> distributed database</td></tr>
|
174
176
|
|
175
177
|
<tr><td>LocalMemCache</td><td>localmemcache</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://localmemcache.rubyforge.org/">LocalMemCache</a> database</td></tr>
|
176
178
|
|
177
|
-
<tr><td>Couch</td><td>
|
179
|
+
<tr><td>Couch</td><td>faraday, multi_json</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://couchdb.apache.org/">CouchDB</a> database</td></tr>
|
178
180
|
|
179
181
|
<tr><td>Fog</td><td>fog</td><td style="text-align:center;background:#55F">?</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://fog.io/">Fog</a> cloud store</td></tr>
|
180
182
|
|
181
|
-
<tr><td>HBase</td><td>hbase</td><td style="text-align:center;background:#55F">?</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://hbase.apache.org/">HBase</a> database</td></tr>
|
182
|
-
|
183
183
|
<tr><td>Riak</td><td>riak-client</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td><a href="http://docs.basho.com/">Riak</a> database</td></tr>
|
184
184
|
|
185
185
|
<tr><th colspan="2">Non persistent stores</th><th colspan="7"></th></tr>
|
@@ -200,7 +200,7 @@ __NOTE:__ <a name="backend-matrix">The backend matrix</a> is much more readable
|
|
200
200
|
|
201
201
|
<tr><td>Client</td><td>-</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#55F">?<sup>[5]</sup></td><td style="text-align:center;background:#55F">?<sup>[5]</sup></td><td style="text-align:center;background:#55F">?<sup>[5]</sup></td><td style="text-align:center;background:#55F">?<sup>[5]</sup></td><td>Moneta client adapter</td></tr>
|
202
202
|
|
203
|
-
<tr><td>RestClient</td><td
|
203
|
+
<tr><td>RestClient</td><td>faraday</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#5F5">✓</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#F44">✗</td><td style="text-align:center;background:#55F">?<sup>[5]</sup></td><td>Moneta REST client adapter</td></tr>
|
204
204
|
|
205
205
|
</table>
|
206
206
|
|
data/Rakefile
CHANGED
@@ -18,53 +18,60 @@ end
|
|
18
18
|
task :test do
|
19
19
|
specs = Dir['spec/*/*_spec.rb'].sort
|
20
20
|
|
21
|
+
# Shuffle specs to ensure equal distribution over the test groups
|
22
|
+
# We have to shuffle with the same seed every time because rake is started
|
23
|
+
# multiple times!
|
24
|
+
old_seed = srand(42)
|
25
|
+
specs.shuffle!
|
26
|
+
srand(old_seed)
|
27
|
+
|
28
|
+
group = ENV['TEST_GROUP'] || '1/1'
|
29
|
+
|
21
30
|
# FIXME:
|
22
31
|
#
|
23
32
|
# * QuickLZ segfaults because of an assertion
|
24
33
|
# QuickLZ is also not maintained on Github, but on Bitbucket
|
25
34
|
# and I don't know where the issue tracker is.
|
26
35
|
#
|
27
|
-
# * Cassandra show spurious failures
|
28
|
-
#
|
29
36
|
# * action_dispatch cannot be required for an unknown reason
|
30
|
-
|
31
|
-
|
32
|
-
# We have to shuffle with the same seed every time because rake is started
|
33
|
-
# multiple times!
|
34
|
-
old_seed = srand(42)
|
35
|
-
specs.shuffle!
|
36
|
-
srand(old_seed)
|
37
|
-
|
38
|
-
unstable = specs.select {|s| s =~ /quicklz|action_dispatch/ }
|
39
|
-
specs -= unstable
|
40
|
-
end
|
41
|
-
|
42
|
-
# Memcached and Redis specs cannot be used in parallel
|
43
|
-
# because of flushing and lacking namespaces
|
44
|
-
parallel = specs.reject {|s| s =~ /memcached|redis|client|shared|riak|tokyotyrant|couch|cassandra/ }
|
45
|
-
serial = specs - parallel
|
37
|
+
unstable = specs.select {|s| s =~ /quicklz|action_dispatch/ }
|
38
|
+
specs -= unstable
|
46
39
|
|
47
|
-
if
|
40
|
+
if group =~ /^(\d+)\/(\d+)$/
|
48
41
|
n = $1.to_i
|
49
42
|
max = $2.to_i
|
50
43
|
if n == max
|
51
|
-
|
52
|
-
serial = serial[(n-1)*(serial.size/max)..-1]
|
44
|
+
specs = specs[(n-1)*(specs.size/max)..-1]
|
53
45
|
else
|
54
|
-
|
55
|
-
serial = serial[(n-1)*(serial.size/max), serial.size/max]
|
46
|
+
specs = specs[(n-1)*(specs.size/max), specs.size/max]
|
56
47
|
end
|
57
|
-
elsif
|
58
|
-
|
59
|
-
|
48
|
+
elsif group == 'unstable'
|
49
|
+
specs = unstable
|
50
|
+
else
|
51
|
+
puts "Invalid test group #{group}"
|
52
|
+
exit 1
|
60
53
|
end
|
61
54
|
|
55
|
+
# Memcached and Redis specs cannot be used in parallel
|
56
|
+
# because of flushing and lacking namespaces
|
57
|
+
parallel = []
|
58
|
+
%w(memcached redis client shared riak tokyotyrant couch cassandra).each do |name|
|
59
|
+
serial = specs.select { |s| s.include?(name) }
|
60
|
+
unless serial.empty?
|
61
|
+
specs -= serial
|
62
|
+
parallel << serial
|
63
|
+
end
|
64
|
+
end
|
65
|
+
parallel += specs.map {|s| [s] }
|
66
|
+
|
62
67
|
threads = []
|
63
68
|
failed = false
|
64
|
-
parallel.each do |
|
69
|
+
parallel.each do |serial|
|
65
70
|
threads << Thread.new do
|
66
71
|
begin
|
67
|
-
|
72
|
+
serial.each do |spec|
|
73
|
+
failed = true unless rspec(spec)
|
74
|
+
end
|
68
75
|
ensure
|
69
76
|
threads.delete Thread.current
|
70
77
|
end
|
@@ -73,9 +80,6 @@ task :test do
|
|
73
80
|
sleep 0.1 while threads.size >= 10
|
74
81
|
end
|
75
82
|
sleep 0.1 until threads.empty?
|
76
|
-
serial.each do |spec|
|
77
|
-
failed = true unless rspec(spec)
|
78
|
-
end
|
79
83
|
if failed
|
80
84
|
fail "\e[31m########## MONETA TESTSUITE FAILED ##########\e[0m"
|
81
85
|
else
|
@@ -74,6 +74,10 @@ module Moneta
|
|
74
74
|
def store(key, value, options = {})
|
75
75
|
@backend.insert(@cf, key, {'value' => value}, :ttl => expires_value(options) || nil)
|
76
76
|
value
|
77
|
+
rescue
|
78
|
+
# FIXME: We get spurious cassandra transport exceptions
|
79
|
+
tries ||= 0
|
80
|
+
(tries += 1) < 10 ? retry : raise
|
77
81
|
end
|
78
82
|
|
79
83
|
# (see Proxy#delete)
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'faraday'
|
2
|
+
require 'multi_json'
|
2
3
|
|
3
4
|
module Moneta
|
4
5
|
module Adapters
|
@@ -10,56 +11,67 @@ module Moneta
|
|
10
11
|
attr_reader :backend
|
11
12
|
|
12
13
|
# @param [Hash] options
|
13
|
-
# @option options [String] :host ('
|
14
|
+
# @option options [String] :host ('127.0.0.1') Couch host
|
15
|
+
# @option options [String] :port (5984) Couch port
|
14
16
|
# @option options [String] :db ('moneta') Couch database
|
15
|
-
# @option options [
|
17
|
+
# @option options [Faraday connection] :backend Use existing backend instance
|
16
18
|
def initialize(options = {})
|
17
|
-
|
18
|
-
@
|
19
|
+
url = "http://#{options[:host] || '127.0.0.1'}:#{options[:port] || 5984}/#{options[:db] || 'moneta'}"
|
20
|
+
@backend = options[:backend] || ::Faraday.new(:url => url)
|
21
|
+
create_db
|
19
22
|
end
|
20
23
|
|
21
24
|
# (see Proxy#key?)
|
22
25
|
def key?(key, options = {})
|
23
|
-
@
|
24
|
-
rescue ::RestClient::ResourceNotFound
|
25
|
-
false
|
26
|
+
@backend.head(key).status == 200
|
26
27
|
end
|
27
28
|
|
28
29
|
# (see Proxy#load)
|
29
30
|
def load(key, options = {})
|
30
|
-
@
|
31
|
-
|
32
|
-
nil
|
31
|
+
response = @backend.get(key)
|
32
|
+
response.status == 200 ? MultiJson.load(response.body)['value'] : nil
|
33
33
|
end
|
34
34
|
|
35
35
|
# (see Proxy#store)
|
36
36
|
def store(key, value, options = {})
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
@db.save_doc(doc)
|
37
|
+
response = @backend.head(key)
|
38
|
+
doc = { 'value' => value }
|
39
|
+
doc['_rev'] = response['etag'][1..-2] if response.status == 200
|
40
|
+
response = @backend.put(key, MultiJson.dump(doc), 'Content-Type' => 'application/json')
|
41
|
+
raise "HTTP error #{response.status}" unless response.status == 201
|
43
42
|
value
|
44
|
-
rescue
|
43
|
+
rescue
|
45
44
|
tries ||= 0
|
46
45
|
(tries += 1) < 10 ? retry : raise
|
47
46
|
end
|
48
47
|
|
49
48
|
# (see Proxy#delete)
|
50
49
|
def delete(key, options = {})
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
response = @backend.get(key)
|
51
|
+
if response.status == 200
|
52
|
+
value = MultiJson.load(response.body)['value']
|
53
|
+
response = @backend.delete("#{key}?rev=#{response['etag'][1..-2]}")
|
54
|
+
raise "HTTP error #{response.status}" unless response.status == 200
|
55
|
+
value
|
56
|
+
end
|
57
|
+
rescue
|
58
|
+
tries ||= 0
|
59
|
+
(tries += 1) < 10 ? retry : raise
|
56
60
|
end
|
57
61
|
|
58
62
|
# (see Proxy#clear)
|
59
63
|
def clear(options = {})
|
60
|
-
@
|
64
|
+
@backend.delete ''
|
65
|
+
create_db
|
61
66
|
self
|
62
67
|
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def create_db
|
72
|
+
response = @backend.put '', ''
|
73
|
+
raise "HTTP error #{response.status}" unless response.status == 201 || response.status == 412
|
74
|
+
end
|
63
75
|
end
|
64
76
|
end
|
65
77
|
end
|
@@ -9,6 +9,11 @@ module Moneta
|
|
9
9
|
|
10
10
|
attr_reader :backend
|
11
11
|
|
12
|
+
# TODO: Add create support using checkAndPut if added to thrift api
|
13
|
+
# https://issues.apache.org/jira/browse/HBASE-3307
|
14
|
+
# https://github.com/bmuller/hbaserb/issues/2
|
15
|
+
supports :increment
|
16
|
+
|
12
17
|
# @param [Hash] options
|
13
18
|
# @option options [String] :host ('127.0.0.1') Server host name
|
14
19
|
# @option options [Integer] :port (9090) Server port
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'faraday'
|
2
2
|
|
3
3
|
module Moneta
|
4
4
|
module Adapters
|
@@ -11,49 +11,41 @@ module Moneta
|
|
11
11
|
|
12
12
|
# @param [Hash] options
|
13
13
|
# @option options [String] :url URL
|
14
|
-
# @option options [
|
14
|
+
# @option options [Faraday connection] :backend Use existing backend instance
|
15
15
|
def initialize(options = {})
|
16
16
|
raise ArgumentError, 'Option :url is required' unless url = options[:url]
|
17
|
-
|
18
|
-
@path = url.path
|
19
|
-
@backend = options[:backend] || ::Net::HTTP.start(url.host, url.port)
|
17
|
+
@backend = options[:backend] || ::Faraday.new(:url => url)
|
20
18
|
end
|
21
19
|
|
22
20
|
# (see Proxy#key?)
|
23
21
|
def key?(key, options = {})
|
24
|
-
|
25
|
-
response.code == '200'
|
22
|
+
@backend.head(key).status == 200
|
26
23
|
end
|
27
24
|
|
28
25
|
# (see Proxy#load)
|
29
26
|
def load(key, options = {})
|
30
|
-
response = @backend.
|
31
|
-
response.
|
27
|
+
response = @backend.get(key)
|
28
|
+
response.status == 200 ? response.body : nil
|
32
29
|
end
|
33
30
|
|
34
31
|
# (see Proxy#store)
|
35
32
|
def store(key, value, options = {})
|
36
|
-
response = @backend.
|
37
|
-
raise "HTTP error #{response.
|
33
|
+
response = @backend.post(key, value)
|
34
|
+
raise "HTTP error #{response.status}" unless response.status == 200
|
38
35
|
value
|
39
36
|
end
|
40
37
|
|
41
38
|
# (see Proxy#delete)
|
42
39
|
def delete(key, options = {})
|
43
|
-
response = @backend.
|
44
|
-
response.
|
40
|
+
response = @backend.delete(key)
|
41
|
+
response.status == 200 ? response.body : nil
|
45
42
|
end
|
46
43
|
|
47
44
|
# (see Proxy#clear)
|
48
45
|
def clear(options = {})
|
49
|
-
@backend.
|
46
|
+
@backend.delete ''
|
50
47
|
self
|
51
48
|
end
|
52
|
-
|
53
|
-
def close
|
54
|
-
@backend.finish
|
55
|
-
nil
|
56
|
-
end
|
57
49
|
end
|
58
50
|
end
|
59
51
|
end
|
@@ -1,4 +1,10 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
# Native client
|
3
|
+
require 'tokyo_tyrant'
|
4
|
+
rescue LoadError
|
5
|
+
# Ruby client
|
6
|
+
require 'tokyotyrant'
|
7
|
+
end
|
2
8
|
|
3
9
|
module Moneta
|
4
10
|
module Adapters
|
@@ -6,6 +12,7 @@ module Moneta
|
|
6
12
|
# @api public
|
7
13
|
class TokyoTyrant
|
8
14
|
include Defaults
|
15
|
+
include HashAdapter
|
9
16
|
|
10
17
|
supports :create, :increment
|
11
18
|
attr_reader :backend
|
@@ -15,24 +22,25 @@ module Moneta
|
|
15
22
|
# @option options [Integer] :port (1978) Server port
|
16
23
|
# @option options [::TokyoTyrant::RDB] :backend Use existing backend instance
|
17
24
|
def initialize(options = {})
|
25
|
+
options[:host] ||= '127.0.0.1'
|
26
|
+
options[:port] ||= 1978
|
18
27
|
if options[:backend]
|
19
28
|
@backend = options[:backend]
|
20
|
-
|
29
|
+
elsif defined?(::TokyoTyrant::RDB)
|
30
|
+
# Use ruby client
|
21
31
|
@backend = ::TokyoTyrant::RDB.new
|
22
|
-
@backend.open(options[:host]
|
23
|
-
|
32
|
+
@backend.open(options[:host], options[:port]) or raise @backend.errmsg(@backend.ecode)
|
33
|
+
else
|
34
|
+
# Use native client
|
35
|
+
@backend = ::TokyoTyrant::DB.new(options[:host], options[:port])
|
24
36
|
end
|
37
|
+
@native = @backend.class.name != 'TokyoTyrant::RDB'
|
25
38
|
probe = '__tokyotyrant_endianness_probe'
|
26
39
|
@backend.delete(probe)
|
27
40
|
@backend.addint(probe, 1)
|
28
41
|
@pack = @backend.delete(probe) == [1].pack('l>') ? 'l>' : 'l<'
|
29
42
|
end
|
30
43
|
|
31
|
-
# (see Proxy#key?)
|
32
|
-
def key?(key, options = {})
|
33
|
-
@backend.has_key?(key)
|
34
|
-
end
|
35
|
-
|
36
44
|
# (see Proxy#load)
|
37
45
|
def load(key, options = {})
|
38
46
|
value = @backend[key]
|
@@ -61,13 +69,16 @@ module Moneta
|
|
61
69
|
|
62
70
|
# (see Proxy#create)
|
63
71
|
def create(key, value, options = {})
|
64
|
-
@
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
72
|
+
if @native
|
73
|
+
begin
|
74
|
+
# Native client throws an exception
|
75
|
+
@backend.putkeep(key, pack(value))
|
76
|
+
rescue TokyoTyrantError
|
77
|
+
false
|
78
|
+
end
|
79
|
+
else
|
80
|
+
@backend.putkeep(key, pack(value))
|
81
|
+
end
|
71
82
|
end
|
72
83
|
|
73
84
|
# (see Proxy#close)
|
data/lib/moneta/logger.rb
CHANGED
@@ -7,13 +7,23 @@ module Moneta
|
|
7
7
|
class Format
|
8
8
|
def initialize(options)
|
9
9
|
@prefix = options[:prefix] || 'Moneta '
|
10
|
-
|
10
|
+
if options[:file]
|
11
|
+
@close = true
|
12
|
+
@out = File.open(options[:file], 'a')
|
13
|
+
else
|
14
|
+
@close = options[:close]
|
15
|
+
@out = options[:out] || STDOUT
|
16
|
+
end
|
11
17
|
end
|
12
18
|
|
13
|
-
def
|
19
|
+
def log(entry)
|
14
20
|
@out.write(format(entry))
|
15
21
|
end
|
16
22
|
|
23
|
+
def close
|
24
|
+
@out.close if @close
|
25
|
+
end
|
26
|
+
|
17
27
|
protected
|
18
28
|
|
19
29
|
def format(entry)
|
@@ -35,22 +45,29 @@ module Moneta
|
|
35
45
|
|
36
46
|
# @param [Moneta store] adapter The underlying store
|
37
47
|
# @param [Hash] options
|
38
|
-
# @option options [Object] :logger (Moneta::Logger::Format)
|
39
|
-
# @option options [String] :
|
40
|
-
# @option options [
|
48
|
+
# @option options [Object] :logger (Moneta::Logger::Format) Logger object
|
49
|
+
# @option options [String] :prefix ('Moneta ') Prefix string
|
50
|
+
# @option options [File] :file Log file
|
51
|
+
# @option options [IO] :out (STDOUT) Output
|
41
52
|
def initialize(adapter, options = {})
|
42
53
|
super
|
43
54
|
@logger = options[:logger] || Format.new(options)
|
44
55
|
end
|
45
56
|
|
57
|
+
def close
|
58
|
+
super
|
59
|
+
@logger.close
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
|
46
63
|
protected
|
47
64
|
|
48
65
|
def wrap(method, *args)
|
49
66
|
ret = yield
|
50
|
-
@logger.
|
67
|
+
@logger.log(:method => method, :args => args, :return => (method == :clear ? 'self' : ret))
|
51
68
|
ret
|
52
69
|
rescue Exception => error
|
53
|
-
@logger.
|
70
|
+
@logger.log(:method => method, :args => args, :error => error)
|
54
71
|
raise
|
55
72
|
end
|
56
73
|
end
|
@@ -18,6 +18,7 @@ module Moneta
|
|
18
18
|
:snappy => [ :compress, '::Snappy.inflate(%s)', '::Snappy.deflate(%s)', 'snappy' ],
|
19
19
|
:quicklz => [ :compress, '::QuickLZ.decompress(%s)', '::QuickLZ.compress(%s)', 'qlzruby' ],
|
20
20
|
:zlib => [ :compress, '::Zlib::Inflate.inflate(%s)', '::Zlib::Deflate.deflate(%s)', 'zlib' ],
|
21
|
+
:qp => [ :encode, "%s.unpack('M').first", "[%s].pack('M').strip" ],
|
21
22
|
:uuencode => [ :encode, "%s.unpack('u').first", "[%s].pack('u').strip" ],
|
22
23
|
:base64 => RUBY_VERSION > '1.9' ?
|
23
24
|
[ :encode, "%s.unpack('m0').first", "[%s].pack('m0')" ] :
|
data/lib/moneta/version.rb
CHANGED
data/lib/rack/moneta_rest.rb
CHANGED
data/script/benchmarks
CHANGED
@@ -31,10 +31,9 @@ class MonetaBenchmarks
|
|
31
31
|
FileUtils.mkpath(DIR)
|
32
32
|
|
33
33
|
STORES = {
|
34
|
-
# SDBM is unstable,
|
34
|
+
# SDBM is unstable, YAML is too slow
|
35
35
|
# :SDBM => { :file => "#{DIR}/sdbm" },
|
36
36
|
# :YAML => { :file => "#{DIR}/yaml" },
|
37
|
-
# :RestClient => { :url => 'http://localhost:8808/' },
|
38
37
|
:ActiveRecord => { :connection => { :adapter => 'sqlite3', :database => ':memory:' } },
|
39
38
|
:Cassandra => {},
|
40
39
|
:Client => {},
|
@@ -56,6 +55,7 @@ class MonetaBenchmarks
|
|
56
55
|
:Mongo => {},
|
57
56
|
:PStore => { :file => "#{DIR}/pstore" },
|
58
57
|
:Redis => {},
|
58
|
+
:RestClient => { :url => 'http://localhost:8808/' },
|
59
59
|
:Riak => {},
|
60
60
|
:Sequel => { :db => 'sqlite:/' },
|
61
61
|
:Sqlite => { :file => ':memory:' },
|
@@ -188,31 +188,31 @@ class MonetaBenchmarks
|
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
191
|
+
parallel do
|
192
|
+
begin
|
193
|
+
require 'rack'
|
194
|
+
require 'webrick'
|
195
|
+
require 'rack/moneta_rest'
|
196
|
+
|
197
|
+
# Keep webrick quiet
|
198
|
+
::WEBrick::HTTPServer.class_eval do
|
199
|
+
def access_log(config, req, res); end
|
200
|
+
end
|
201
|
+
::WEBrick::BasicLog.class_eval do
|
202
|
+
def log(level, data); end
|
203
|
+
end
|
204
|
+
|
205
|
+
Rack::Server.start(:app => Rack::Builder.app do
|
206
|
+
use Rack::Lint
|
207
|
+
run Rack::MonetaRest.new(:store => :Memory)
|
208
|
+
end,
|
209
|
+
:environment => :none,
|
210
|
+
:server => :webrick,
|
211
|
+
:Port => 8808)
|
212
|
+
rescue Exception => ex
|
213
|
+
puts "\e[31mFailed to start Rack server - #{ex.message}\e[0m"
|
214
|
+
end
|
215
|
+
end
|
216
216
|
|
217
217
|
sleep 1 # Wait for servers
|
218
218
|
end
|