moneta 1.0.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +425 -0
- data/.gitignore +3 -0
- data/.rspec +4 -0
- data/.rubocop.yml +194 -0
- data/.yardopts +6 -1
- data/CHANGES +88 -0
- data/CONTRIBUTORS +10 -2
- data/Gemfile +198 -76
- data/LICENSE +1 -1
- data/README.md +181 -83
- data/SPEC.md +70 -0
- data/feature_matrix.yaml +227 -0
- data/lib/action_dispatch/middleware/session/moneta_store.rb +1 -0
- data/lib/active_support/cache/moneta_store.rb +102 -6
- data/lib/moneta/adapter.rb +52 -0
- data/lib/moneta/adapters/activerecord.rb +284 -99
- data/lib/moneta/adapters/activesupportcache.rb +120 -0
- data/lib/moneta/adapters/cassandra.rb +303 -51
- data/lib/moneta/adapters/client.rb +72 -23
- data/lib/moneta/adapters/couch.rb +353 -49
- data/lib/moneta/adapters/datamapper.rb +11 -5
- data/lib/moneta/adapters/daybreak.rb +31 -20
- data/lib/moneta/adapters/dbm.rb +10 -16
- data/lib/moneta/adapters/file.rb +34 -13
- data/lib/moneta/adapters/fog.rb +5 -6
- data/lib/moneta/adapters/gdbm.rb +10 -16
- data/lib/moneta/adapters/hbase.rb +11 -13
- data/lib/moneta/adapters/kyotocabinet.rb +78 -17
- data/lib/moneta/adapters/leveldb.rb +35 -15
- data/lib/moneta/adapters/lmdb.rb +47 -23
- data/lib/moneta/adapters/localmemcache.rb +7 -13
- data/lib/moneta/adapters/lruhash.rb +45 -48
- data/lib/moneta/adapters/memcached/dalli.rb +67 -30
- data/lib/moneta/adapters/memcached/native.rb +33 -30
- data/lib/moneta/adapters/memcached.rb +1 -0
- data/lib/moneta/adapters/memory.rb +7 -7
- data/lib/moneta/adapters/mongo.rb +265 -6
- data/lib/moneta/adapters/null.rb +1 -2
- data/lib/moneta/adapters/pstore.rb +68 -25
- data/lib/moneta/adapters/redis.rb +101 -32
- data/lib/moneta/adapters/restclient.rb +17 -16
- data/lib/moneta/adapters/riak.rb +10 -11
- data/lib/moneta/adapters/sdbm.rb +10 -16
- data/lib/moneta/adapters/sequel/mysql.rb +66 -0
- data/lib/moneta/adapters/sequel/postgres.rb +80 -0
- data/lib/moneta/adapters/sequel/postgres_hstore.rb +240 -0
- data/lib/moneta/adapters/sequel/sqlite.rb +57 -0
- data/lib/moneta/adapters/sequel.rb +253 -52
- data/lib/moneta/adapters/sqlite.rb +103 -23
- data/lib/moneta/adapters/tdb.rb +21 -12
- data/lib/moneta/adapters/tokyocabinet.rb +24 -16
- data/lib/moneta/adapters/tokyotyrant.rb +49 -28
- data/lib/moneta/adapters/yaml.rb +1 -5
- data/lib/moneta/builder.rb +2 -3
- data/lib/moneta/cache.rb +11 -1
- data/lib/moneta/config.rb +101 -0
- data/lib/moneta/create_support.rb +21 -0
- data/lib/moneta/dbm_adapter.rb +31 -0
- data/lib/moneta/defaults.rb +320 -0
- data/lib/moneta/each_key_support.rb +27 -0
- data/lib/moneta/enumerable.rb +38 -0
- data/lib/moneta/expires.rb +112 -11
- data/lib/moneta/expires_support.rb +59 -0
- data/lib/moneta/fallback.rb +84 -0
- data/lib/moneta/hash_adapter.rb +68 -0
- data/lib/moneta/increment_support.rb +16 -0
- data/lib/moneta/lock.rb +26 -2
- data/lib/moneta/logger.rb +2 -2
- data/lib/moneta/nil_values.rb +35 -0
- data/lib/moneta/option_support.rb +51 -0
- data/lib/moneta/optionmerger.rb +0 -1
- data/lib/moneta/pool.rb +339 -28
- data/lib/moneta/proxy.rb +75 -2
- data/lib/moneta/server.rb +230 -68
- data/lib/moneta/shared.rb +36 -14
- data/lib/moneta/stack.rb +7 -7
- data/lib/moneta/synchronize.rb +5 -11
- data/lib/moneta/transformer/config.rb +64 -42
- data/lib/moneta/transformer/helper/bson.rb +7 -14
- data/lib/moneta/transformer/helper.rb +5 -5
- data/lib/moneta/transformer.rb +217 -23
- data/lib/moneta/utils.rb +3 -9
- data/lib/moneta/version.rb +1 -1
- data/lib/moneta/weak_each_key.rb +72 -0
- data/lib/moneta/wrapper.rb +30 -0
- data/lib/moneta.rb +29 -10
- data/lib/rack/cache/moneta.rb +13 -11
- data/lib/rack/moneta_rest.rb +2 -2
- data/lib/rack/session/moneta.rb +3 -4
- data/moneta.gemspec +19 -4
- data/script/benchmarks +311 -100
- data/script/contributors +11 -6
- data/script/parallel-tests +58 -83
- data/script/start-couchdb +27 -0
- data/script/start-hbase +47 -0
- data/script/start-services +5 -6
- data/script/update-feature-matrix +148 -0
- data/spec/active_support/cache_moneta_store_spec.rb +129 -106
- data/spec/features/concurrent_create.rb +42 -0
- data/spec/features/concurrent_increment.rb +39 -0
- data/spec/features/create.rb +25 -0
- data/spec/features/create_expires.rb +19 -0
- data/spec/features/default_expires.rb +14 -0
- data/spec/features/each_key.rb +119 -0
- data/spec/features/expires.rb +296 -0
- data/spec/features/features.rb +16 -0
- data/spec/features/increment.rb +98 -0
- data/spec/features/marshallable_key.rb +43 -0
- data/spec/features/marshallable_value.rb +7 -0
- data/spec/features/multiprocess.rb +8 -0
- data/spec/features/not_create.rb +7 -0
- data/spec/features/not_each_key.rb +7 -0
- data/spec/features/not_increment.rb +13 -0
- data/spec/features/not_persist.rb +9 -0
- data/spec/features/null.rb +66 -0
- data/spec/features/persist.rb +14 -0
- data/spec/features/returndifferent.rb +9 -0
- data/spec/features/returnsame.rb +9 -0
- data/spec/features/store.rb +261 -0
- data/spec/features/store_large.rb +13 -0
- data/spec/features/transform_value.rb +44 -0
- data/spec/features/transform_value_expires.rb +41 -0
- data/spec/helper.rb +345 -78
- data/spec/moneta/adapters/activerecord/adapter_activerecord_existing_connection_spec.rb +61 -0
- data/spec/moneta/adapters/activerecord/adapter_activerecord_spec.rb +126 -0
- data/spec/moneta/adapters/activerecord/standard_activerecord_spec.rb +21 -0
- data/spec/moneta/adapters/activerecord/standard_activerecord_with_expires_spec.rb +27 -0
- data/spec/moneta/adapters/activesupportcache/adapter_activesupportcache_spec.rb +54 -0
- data/spec/moneta/adapters/activesupportcache/adapter_activesupportcache_with_default_expires_spec.rb +54 -0
- data/spec/moneta/adapters/activesupportcache/standard_activesupportcache_spec.rb +14 -0
- data/spec/moneta/adapters/cassandra/adapter_cassandra_spec.rb +17 -0
- data/spec/moneta/adapters/cassandra/adapter_cassandra_with_default_expires_spec.rb +18 -0
- data/spec/moneta/adapters/cassandra/helper.rb +18 -0
- data/spec/moneta/adapters/cassandra/standard_cassandra_spec.rb +18 -0
- data/spec/moneta/adapters/client/adapter_client_spec.rb +11 -0
- data/spec/moneta/adapters/client/client_helper.rb +25 -0
- data/spec/moneta/adapters/client/standard_client_tcp_spec.rb +23 -0
- data/spec/moneta/adapters/client/standard_client_unix_spec.rb +28 -0
- data/spec/moneta/adapters/cookie/adapter_cookie_spec.rb +7 -0
- data/spec/moneta/adapters/couch/adapter_couch_spec.rb +204 -0
- data/spec/moneta/adapters/couch/standard_couch_spec.rb +15 -0
- data/spec/moneta/adapters/couch/standard_couch_with_expires_spec.rb +19 -0
- data/spec/moneta/adapters/datamapper/adapter_datamapper_spec.rb +60 -0
- data/spec/moneta/adapters/datamapper/standard_datamapper_spec.rb +21 -0
- data/spec/moneta/adapters/datamapper/standard_datamapper_with_expires_spec.rb +26 -0
- data/spec/moneta/adapters/datamapper/standard_datamapper_with_repository_spec.rb +22 -0
- data/spec/moneta/adapters/daybreak/adapter_daybreak_spec.rb +7 -0
- data/spec/moneta/adapters/daybreak/standard_daybreak_spec.rb +7 -0
- data/spec/moneta/adapters/daybreak/standard_daybreak_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/dbm/adapter_dbm_spec.rb +7 -0
- data/spec/moneta/adapters/dbm/standard_dbm_spec.rb +7 -0
- data/spec/moneta/adapters/dbm/standard_dbm_with_expires_spec.rb +12 -0
- data/spec/moneta/adapters/faraday_helper.rb +10 -0
- data/spec/moneta/adapters/file/adapter_file_spec.rb +7 -0
- data/spec/moneta/adapters/file/standard_file_spec.rb +7 -0
- data/spec/moneta/adapters/file/standard_file_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/fog/adapter_fog_spec.rb +16 -0
- data/spec/moneta/adapters/fog/standard_fog_spec.rb +15 -0
- data/spec/moneta/adapters/fog/standard_fog_with_expires_spec.rb +20 -0
- data/spec/moneta/adapters/gdbm/adapter_gdbm_spec.rb +7 -0
- data/spec/moneta/adapters/gdbm/standard_gdbm_spec.rb +7 -0
- data/spec/moneta/adapters/gdbm/standard_gdbm_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/hashfile/standard_hashfile_spec.rb +7 -0
- data/spec/moneta/adapters/hashfile/standard_hashfile_with_expires_spec.rb +12 -0
- data/spec/moneta/adapters/hbase/adapter_hbase_spec.rb +7 -0
- data/spec/moneta/adapters/hbase/standard_hbase_spec.rb +4 -0
- data/spec/moneta/adapters/hbase/standard_hbase_with_expires_spec.rb +8 -0
- data/spec/moneta/adapters/kyotocabinet/adapter_kyotocabinet_spec.rb +7 -0
- data/spec/moneta/adapters/kyotocabinet/standard_kyotocabinet_spec.rb +7 -0
- data/spec/moneta/adapters/kyotocabinet/standard_kyotocabinet_with_expires_spec.rb +14 -0
- data/spec/moneta/adapters/leveldb/adapter_leveldb_spec.rb +7 -0
- data/spec/moneta/adapters/leveldb/standard_leveldb_spec.rb +7 -0
- data/spec/moneta/adapters/leveldb/standard_leveldb_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/lmdb/adapter_lmdb_spec.rb +7 -0
- data/spec/moneta/adapters/lmdb/adapter_lmdb_with_db_spec.rb +7 -0
- data/spec/moneta/adapters/lmdb/standard_lmdb_spec.rb +7 -0
- data/spec/moneta/adapters/lmdb/standard_lmdb_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/localmemcache/adapter_localmemcache_spec.rb +7 -0
- data/spec/moneta/adapters/localmemcache/standard_localmemcache_spec.rb +7 -0
- data/spec/moneta/adapters/localmemcache/standard_localmemcache_with_expires_spec.rb +11 -0
- data/spec/moneta/{adapter_lruhash_spec.rb → adapters/lruhash/adapter_lruhash_spec.rb} +15 -33
- data/spec/moneta/adapters/lruhash/standard_lruhash_spec.rb +4 -0
- data/spec/moneta/adapters/lruhash/standard_lruhash_with_expires_spec.rb +8 -0
- data/spec/moneta/adapters/memcached/adapter_memcached_spec.rb +13 -0
- data/spec/moneta/adapters/memcached/dalli/adapter_memcached_dalli_spec.rb +25 -0
- data/spec/moneta/adapters/memcached/dalli/standard_memcached_dalli_spec.rb +11 -0
- data/spec/moneta/adapters/memcached/native/adapter_memcached_native_spec.rb +25 -0
- data/spec/moneta/adapters/memcached/native/standard_memcached_native_spec.rb +11 -0
- data/spec/moneta/adapters/memcached/standard_memcached_spec.rb +17 -0
- data/spec/moneta/adapters/memcached_helper.rb +20 -0
- data/spec/moneta/adapters/memory/adapter_memory_spec.rb +7 -0
- data/spec/moneta/adapters/memory/standard_memory_spec.rb +4 -0
- data/spec/moneta/adapters/memory/standard_memory_with_compress_spec.rb +9 -0
- data/spec/moneta/adapters/memory/standard_memory_with_expires_spec.rb +8 -0
- data/spec/moneta/adapters/memory/standard_memory_with_json_key_serializer_spec.rb +4 -0
- data/spec/moneta/adapters/memory/standard_memory_with_json_serializer_spec.rb +9 -0
- data/spec/moneta/adapters/memory/standard_memory_with_json_value_serializer_spec.rb +9 -0
- data/spec/moneta/adapters/memory/standard_memory_with_prefix_spec.rb +41 -0
- data/spec/moneta/adapters/memory/standard_memory_with_snappy_compress_spec.rb +9 -0
- data/spec/moneta/adapters/mongo/adapter_mongo_spec.rb +41 -0
- data/spec/moneta/adapters/mongo/adapter_mongo_with_default_expires_spec.rb +14 -0
- data/spec/moneta/adapters/mongo/standard_mongo_spec.rb +7 -0
- data/spec/moneta/adapters/null/null_adapter_spec.rb +7 -0
- data/spec/moneta/adapters/null/standard_null_spec.rb +4 -0
- data/spec/moneta/adapters/pstore/adapter_pstore_spec.rb +7 -0
- data/spec/moneta/adapters/pstore/standard_pstore_spec.rb +9 -0
- data/spec/moneta/adapters/pstore/standard_pstore_with_expires_spec.rb +13 -0
- data/spec/moneta/adapters/redis/adapter_redis_spec.rb +20 -0
- data/spec/moneta/adapters/redis/standard_redis_spec.rb +14 -0
- data/spec/moneta/adapters/restclient/adapter_restclient_spec.rb +13 -0
- data/spec/moneta/adapters/restclient/helper.rb +12 -0
- data/spec/moneta/adapters/restclient/standard_restclient_spec.rb +13 -0
- data/spec/moneta/adapters/riak/adapter_riak_spec.rb +14 -0
- data/spec/moneta/adapters/riak/standard_riak_spec.rb +10 -0
- data/spec/moneta/adapters/riak/standard_riak_with_expires_spec.rb +14 -0
- data/spec/moneta/adapters/sdbm/adapter_sdbm_spec.rb +7 -0
- data/spec/moneta/adapters/sdbm/standard_sdbm_spec.rb +7 -0
- data/spec/moneta/adapters/sdbm/standard_sdbm_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/sequel/adapter_sequel_spec.rb +133 -0
- data/spec/moneta/adapters/sequel/helper.rb +80 -0
- data/spec/moneta/adapters/sequel/standard_sequel_spec.rb +8 -0
- data/spec/moneta/adapters/sequel/standard_sequel_with_expires_spec.rb +18 -0
- data/spec/moneta/adapters/sqlite/adapter_sqlite_spec.rb +7 -0
- data/spec/moneta/adapters/sqlite/standard_sqlite_spec.rb +7 -0
- data/spec/moneta/adapters/sqlite/standard_sqlite_with_expires_spec.rb +15 -0
- data/spec/moneta/adapters/tdb/adapter_tdb_spec.rb +7 -0
- data/spec/moneta/adapters/tdb/standard_tdb_spec.rb +7 -0
- data/spec/moneta/adapters/tdb/standard_tdb_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/tokyocabinet/adapter_tokyocabinet_bdb_spec.rb +7 -0
- data/spec/moneta/adapters/tokyocabinet/adapter_tokyocabinet_hdb_spec.rb +7 -0
- data/spec/moneta/adapters/tokyocabinet/standard_tokyocabinet_spec.rb +7 -0
- data/spec/moneta/adapters/tokyocabinet/standard_tokyocabinet_with_expires_spec.rb +11 -0
- data/spec/moneta/adapters/tokyotyrant/adapter_tokyotyrant_spec.rb +11 -0
- data/spec/moneta/adapters/tokyotyrant/helper.rb +12 -0
- data/spec/moneta/adapters/tokyotyrant/standard_tokyotyrant_spec.rb +7 -0
- data/spec/moneta/adapters/tokyotyrant/standard_tokyotyrant_with_expires_spec.rb +12 -0
- data/spec/moneta/adapters/yaml/adapter_yaml_spec.rb +7 -0
- data/spec/moneta/adapters/yaml/standard_yaml_spec.rb +9 -0
- data/spec/moneta/adapters/yaml/standard_yaml_with_expires_spec.rb +13 -0
- data/spec/moneta/builder_spec.rb +22 -1
- data/spec/moneta/config_spec.rb +219 -0
- data/spec/moneta/mutex_spec.rb +6 -23
- data/spec/moneta/proxies/cache/cache_file_memory_spec.rb +24 -0
- data/spec/moneta/proxies/cache/cache_memory_null_spec.rb +12 -0
- data/spec/moneta/proxies/enumerable/enumerable_spec.rb +26 -0
- data/spec/moneta/proxies/expires/expires_file_spec.rb +28 -0
- data/spec/moneta/proxies/expires/expires_memory_spec.rb +15 -0
- data/spec/moneta/proxies/expires/expires_memory_with_default_expires_spec.rb +16 -0
- data/spec/moneta/proxies/fallback/fallback_spec.rb +42 -0
- data/spec/moneta/proxies/lock/lock_spec.rb +10 -0
- data/spec/moneta/{optionmerger_spec.rb → proxies/optionmerger/optionmerger_spec.rb} +2 -18
- data/spec/moneta/proxies/pool/pool_spec.rb +353 -0
- data/spec/moneta/proxies/proxy/proxy_expires_memory_spec.rb +16 -0
- data/spec/moneta/proxies/shared/shared_tcp_spec.rb +59 -0
- data/spec/moneta/proxies/shared/shared_unix_spec.rb +58 -0
- data/spec/moneta/proxies/transformer/transformer_bencode_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_bert_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_bson_spec.rb +25 -0
- data/spec/moneta/proxies/transformer/transformer_bzip2_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_json_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_key_inspect_spec.rb +17 -0
- data/spec/moneta/proxies/transformer/transformer_key_marshal_spec.rb +17 -0
- data/spec/moneta/proxies/transformer/transformer_key_to_s_spec.rb +17 -0
- data/spec/moneta/proxies/transformer/transformer_key_yaml_spec.rb +17 -0
- data/spec/moneta/proxies/transformer/transformer_lz4_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_lzma_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_lzo_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_base64_spec.rb +20 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_city128_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_city32_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_city64_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_escape_spec.rb +21 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_hex_spec.rb +20 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_hmac_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_md5_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_md5_spread_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_prefix_base64_spec.rb +33 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_prefix_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_qp_spec.rb +20 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_rmd160_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_sha1_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_sha256_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_sha384_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_sha512_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_truncate_spec.rb +15 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_urlsafe_base64_spec.rb +20 -0
- data/spec/moneta/proxies/transformer/transformer_marshal_uuencode_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_msgpack_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_ox_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_php_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_quicklz_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_snappy_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_tnet_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_value_marshal_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_value_yaml_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_yaml_spec.rb +19 -0
- data/spec/moneta/proxies/transformer/transformer_zlib_spec.rb +19 -0
- data/spec/moneta/proxies/weak_create/weak_create_spec.rb +21 -0
- data/spec/moneta/proxies/weak_each_key/weak_each_key_spec.rb +22 -0
- data/spec/moneta/proxies/weak_increment/weak_increment_spec.rb +21 -0
- data/spec/moneta/semaphore_spec.rb +6 -23
- data/spec/moneta/stack_file_memory_spec.rb +5 -29
- data/spec/moneta/stack_memory_file_spec.rb +5 -31
- data/spec/rack/session_moneta_spec.rb +44 -25
- data/spec/restserver.rb +44 -0
- data/{spec → test}/action_dispatch/fixtures/session_autoload_test/foo.rb +0 -0
- data/{spec/action_dispatch/session_moneta_store_spec.rb → test/action_dispatch/session_moneta_store_test.rb} +13 -5
- metadata +545 -369
- data/.travis.yml +0 -55
- data/lib/moneta/adapters/mongo/base.rb +0 -78
- data/lib/moneta/adapters/mongo/moped.rb +0 -107
- data/lib/moneta/adapters/mongo/official.rb +0 -117
- data/lib/moneta/mixins.rb +0 -343
- data/script/generate-specs +0 -2696
- data/script/install-kyotocabinet +0 -17
- data/spec/moneta/adapter_activerecord_exisiting_connection_spec.rb +0 -36
- data/spec/moneta/adapter_activerecord_spec.rb +0 -65
- data/spec/moneta/adapter_cassandra_spec.rb +0 -33
- data/spec/moneta/adapter_cassandra_with_default_expires_spec.rb +0 -34
- data/spec/moneta/adapter_client_spec.rb +0 -35
- data/spec/moneta/adapter_cookie_spec.rb +0 -30
- data/spec/moneta/adapter_couch_spec.rb +0 -36
- data/spec/moneta/adapter_datamapper_spec.rb +0 -64
- data/spec/moneta/adapter_daybreak_spec.rb +0 -31
- data/spec/moneta/adapter_dbm_spec.rb +0 -31
- data/spec/moneta/adapter_file_spec.rb +0 -34
- data/spec/moneta/adapter_fog_spec.rb +0 -37
- data/spec/moneta/adapter_gdbm_spec.rb +0 -31
- data/spec/moneta/adapter_hbase_spec.rb +0 -33
- data/spec/moneta/adapter_kyotocabinet_spec.rb +0 -31
- data/spec/moneta/adapter_leveldb_spec.rb +0 -31
- data/spec/moneta/adapter_lmdb_spec.rb +0 -32
- data/spec/moneta/adapter_lmdb_with_db_spec.rb +0 -32
- data/spec/moneta/adapter_localmemcache_spec.rb +0 -32
- data/spec/moneta/adapter_memcached_dalli_spec.rb +0 -36
- data/spec/moneta/adapter_memcached_dalli_with_default_expires_spec.rb +0 -37
- data/spec/moneta/adapter_memcached_native_spec.rb +0 -36
- data/spec/moneta/adapter_memcached_native_with_default_expires_spec.rb +0 -37
- data/spec/moneta/adapter_memcached_spec.rb +0 -36
- data/spec/moneta/adapter_memcached_with_default_expires_spec.rb +0 -37
- data/spec/moneta/adapter_memory_spec.rb +0 -184
- data/spec/moneta/adapter_mongo_moped_spec.rb +0 -64
- data/spec/moneta/adapter_mongo_moped_with_default_expires_spec.rb +0 -53
- data/spec/moneta/adapter_mongo_official_spec.rb +0 -64
- data/spec/moneta/adapter_mongo_official_with_default_expires_spec.rb +0 -53
- data/spec/moneta/adapter_mongo_spec.rb +0 -51
- data/spec/moneta/adapter_mongo_with_default_expires_spec.rb +0 -53
- data/spec/moneta/adapter_pstore_spec.rb +0 -250
- data/spec/moneta/adapter_redis_spec.rb +0 -36
- data/spec/moneta/adapter_redis_with_default_expires_spec.rb +0 -37
- data/spec/moneta/adapter_restclient_spec.rb +0 -33
- data/spec/moneta/adapter_riak_spec.rb +0 -36
- data/spec/moneta/adapter_sdbm_spec.rb +0 -30
- data/spec/moneta/adapter_sequel_spec.rb +0 -34
- data/spec/moneta/adapter_sqlite_spec.rb +0 -32
- data/spec/moneta/adapter_tdb_spec.rb +0 -31
- data/spec/moneta/adapter_tokyocabinet_bdb_spec.rb +0 -31
- data/spec/moneta/adapter_tokyocabinet_hdb_spec.rb +0 -31
- data/spec/moneta/adapter_tokyotyrant_spec.rb +0 -34
- data/spec/moneta/adapter_yaml_spec.rb +0 -57
- data/spec/moneta/cache_file_memory_spec.rb +0 -50
- data/spec/moneta/cache_memory_null_spec.rb +0 -35
- data/spec/moneta/expires_file_spec.rb +0 -78
- data/spec/moneta/expires_memory_spec.rb +0 -189
- data/spec/moneta/expires_memory_with_default_expires_spec.rb +0 -190
- data/spec/moneta/lock_spec.rb +0 -187
- data/spec/moneta/null_adapter_spec.rb +0 -86
- data/spec/moneta/pool_spec.rb +0 -38
- data/spec/moneta/proxy_expires_memory_spec.rb +0 -191
- data/spec/moneta/proxy_redis_spec.rb +0 -40
- data/spec/moneta/shared_tcp_spec.rb +0 -46
- data/spec/moneta/shared_unix_spec.rb +0 -46
- data/spec/moneta/standard_activerecord_spec.rb +0 -253
- data/spec/moneta/standard_activerecord_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_cassandra_spec.rb +0 -252
- data/spec/moneta/standard_client_tcp_spec.rb +0 -269
- data/spec/moneta/standard_client_unix_spec.rb +0 -254
- data/spec/moneta/standard_couch_spec.rb +0 -252
- data/spec/moneta/standard_couch_with_expires_spec.rb +0 -254
- data/spec/moneta/standard_datamapper_spec.rb +0 -254
- data/spec/moneta/standard_datamapper_with_expires_spec.rb +0 -256
- data/spec/moneta/standard_datamapper_with_repository_spec.rb +0 -254
- data/spec/moneta/standard_daybreak_spec.rb +0 -250
- data/spec/moneta/standard_daybreak_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_dbm_spec.rb +0 -250
- data/spec/moneta/standard_dbm_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_file_spec.rb +0 -253
- data/spec/moneta/standard_file_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_fog_spec.rb +0 -256
- data/spec/moneta/standard_fog_with_expires_spec.rb +0 -258
- data/spec/moneta/standard_gdbm_spec.rb +0 -250
- data/spec/moneta/standard_gdbm_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_hashfile_spec.rb +0 -253
- data/spec/moneta/standard_hashfile_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_hbase_spec.rb +0 -252
- data/spec/moneta/standard_hbase_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_kyotocabinet_spec.rb +0 -250
- data/spec/moneta/standard_kyotocabinet_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_leveldb_spec.rb +0 -250
- data/spec/moneta/standard_leveldb_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_lmdb_spec.rb +0 -251
- data/spec/moneta/standard_lmdb_with_expires_spec.rb +0 -253
- data/spec/moneta/standard_localmemcache_spec.rb +0 -251
- data/spec/moneta/standard_localmemcache_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_lruhash_spec.rb +0 -187
- data/spec/moneta/standard_lruhash_with_expires_spec.rb +0 -189
- data/spec/moneta/standard_memcached_dalli_spec.rb +0 -255
- data/spec/moneta/standard_memcached_native_spec.rb +0 -255
- data/spec/moneta/standard_memcached_spec.rb +0 -255
- data/spec/moneta/standard_memory_spec.rb +0 -187
- data/spec/moneta/standard_memory_with_compress_spec.rb +0 -187
- data/spec/moneta/standard_memory_with_expires_spec.rb +0 -189
- data/spec/moneta/standard_memory_with_json_key_serializer_spec.rb +0 -86
- data/spec/moneta/standard_memory_with_json_serializer_spec.rb +0 -49
- data/spec/moneta/standard_memory_with_json_value_serializer_spec.rb +0 -90
- data/spec/moneta/standard_memory_with_prefix_spec.rb +0 -187
- data/spec/moneta/standard_memory_with_snappy_compress_spec.rb +0 -187
- data/spec/moneta/standard_mongo_moped_spec.rb +0 -255
- data/spec/moneta/standard_mongo_official_spec.rb +0 -255
- data/spec/moneta/standard_mongo_spec.rb +0 -255
- data/spec/moneta/standard_null_spec.rb +0 -120
- data/spec/moneta/standard_pstore_spec.rb +0 -253
- data/spec/moneta/standard_pstore_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_redis_spec.rb +0 -255
- data/spec/moneta/standard_restclient_spec.rb +0 -252
- data/spec/moneta/standard_riak_spec.rb +0 -255
- data/spec/moneta/standard_riak_with_expires_spec.rb +0 -256
- data/spec/moneta/standard_sdbm_spec.rb +0 -249
- data/spec/moneta/standard_sdbm_with_expires_spec.rb +0 -251
- data/spec/moneta/standard_sequel_spec.rb +0 -253
- data/spec/moneta/standard_sequel_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_sqlite_spec.rb +0 -251
- data/spec/moneta/standard_sqlite_with_expires_spec.rb +0 -253
- data/spec/moneta/standard_tdb_spec.rb +0 -250
- data/spec/moneta/standard_tdb_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_tokyocabinet_spec.rb +0 -250
- data/spec/moneta/standard_tokyocabinet_with_expires_spec.rb +0 -252
- data/spec/moneta/standard_tokyotyrant_spec.rb +0 -253
- data/spec/moneta/standard_tokyotyrant_with_expires_spec.rb +0 -255
- data/spec/moneta/standard_yaml_spec.rb +0 -250
- data/spec/moneta/standard_yaml_with_expires_spec.rb +0 -252
- data/spec/moneta/transformer_bencode_spec.rb +0 -55
- data/spec/moneta/transformer_bert_spec.rb +0 -55
- data/spec/moneta/transformer_bson_spec.rb +0 -60
- data/spec/moneta/transformer_bzip2_spec.rb +0 -55
- data/spec/moneta/transformer_json_spec.rb +0 -55
- data/spec/moneta/transformer_key_inspect_spec.rb +0 -91
- data/spec/moneta/transformer_key_marshal_spec.rb +0 -191
- data/spec/moneta/transformer_key_to_s_spec.rb +0 -91
- data/spec/moneta/transformer_key_yaml_spec.rb +0 -191
- data/spec/moneta/transformer_lz4_spec.rb +0 -55
- data/spec/moneta/transformer_lzma_spec.rb +0 -55
- data/spec/moneta/transformer_lzo_spec.rb +0 -55
- data/spec/moneta/transformer_marshal_base64_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_city128_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_city32_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_city64_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_escape_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_hex_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_hmac_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_md5_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_md5_spread_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_prefix_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_qp_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_rmd160_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_sha1_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_sha256_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_sha384_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_sha512_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_spec.rb +0 -191
- data/spec/moneta/transformer_marshal_truncate_spec.rb +0 -194
- data/spec/moneta/transformer_marshal_uuencode_spec.rb +0 -194
- data/spec/moneta/transformer_msgpack_spec.rb +0 -55
- data/spec/moneta/transformer_ox_spec.rb +0 -191
- data/spec/moneta/transformer_php_spec.rb +0 -55
- data/spec/moneta/transformer_quicklz_spec.rb +0 -55
- data/spec/moneta/transformer_snappy_spec.rb +0 -55
- data/spec/moneta/transformer_tnet_spec.rb +0 -55
- data/spec/moneta/transformer_value_marshal_spec.rb +0 -191
- data/spec/moneta/transformer_value_yaml_spec.rb +0 -191
- data/spec/moneta/transformer_yaml_spec.rb +0 -191
- data/spec/moneta/transformer_zlib_spec.rb +0 -55
- data/spec/moneta/weak_create_spec.rb +0 -41
- data/spec/moneta/weak_increment_spec.rb +0 -41
- data/spec/monetaspecs.rb +0 -51267
- data/spec/quality_spec.rb +0 -51
data/script/parallel-tests
CHANGED
@@ -1,105 +1,80 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
def rspec(spec)
|
4
|
-
if system("rspec #{spec}")
|
5
|
-
true
|
6
|
-
elsif sig = $?.termsig
|
7
|
-
found = Signal.list.to_a.select {|name, id| id == sig }.first
|
8
|
-
puts "\e[31m########## SIG#{found ? found.first : sig} rspec #{spec} ##########\e[0m"
|
9
|
-
false
|
10
|
-
else
|
11
|
-
puts "rspec terminated with #{$?.exitstatus}"
|
12
|
-
false
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
3
|
ENV['PARALLEL_TESTS'] = 'yes'
|
17
4
|
|
18
|
-
|
5
|
+
require 'multi_json'
|
19
6
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
old_seed = srand(43)
|
24
|
-
specs.shuffle!
|
25
|
-
srand(old_seed)
|
7
|
+
def tag_args tags
|
8
|
+
tags.flat_map{ |tag| ['--tag', tag] }
|
9
|
+
end
|
26
10
|
|
27
|
-
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
#
|
33
|
-
# * PStore increment/locking doesn't work correctly on JRuby
|
34
|
-
#
|
35
|
-
unstable = %w(quicklz riak cassandra)
|
36
|
-
unstable += %w(pstore) if defined?(JRUBY_VERSION)
|
11
|
+
def example_ids tags, specs
|
12
|
+
json = `bundle exec rspec -f j --dry-run #{tag_args(tags).join(' ')} -- #{specs.join(' ')}`
|
13
|
+
data = MultiJson.load(json)
|
14
|
+
data['examples'].map{ |example| example['id'] }
|
15
|
+
end
|
37
16
|
|
38
|
-
|
39
|
-
|
40
|
-
|
17
|
+
def run(*args)
|
18
|
+
pid = spawn(*args)
|
19
|
+
Signal.trap("INT") { Process.kill("INT", pid) }
|
20
|
+
Process.wait(pid)
|
21
|
+
$? == 0
|
22
|
+
ensure
|
23
|
+
Signal.trap("INT", "DEFAULT")
|
24
|
+
end
|
41
25
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
26
|
+
tags = ARGV.take_while { |arg| arg[0] != '-' }
|
27
|
+
ARGV.shift(tags.length)
|
28
|
+
opts = []
|
29
|
+
files = nil
|
30
|
+
while arg = ARGV.shift
|
31
|
+
case arg
|
32
|
+
when '--'
|
33
|
+
files = ARGV
|
34
|
+
break
|
35
|
+
when '--remainder'
|
36
|
+
files = Dir['spec/**/*_spec.rb', 'test/**/*_test.rb']
|
37
|
+
existing = File.open('.travis.yml').each_line.flat_map do |line|
|
38
|
+
next unless matches = line.match(%r{((?:test|spec)/(?:[\w\.]+/?)*)})
|
39
|
+
path = matches[1]
|
40
|
+
path[-3..-1] == '.rb' ? path : path + '/**/*.rb'
|
41
|
+
end.compact
|
42
|
+
files -= Dir[*existing]
|
49
43
|
else
|
50
|
-
|
44
|
+
opts << arg
|
51
45
|
end
|
52
|
-
when 'unstable'
|
53
|
-
specs = unstable
|
54
|
-
else
|
55
|
-
puts "Invalid test group #{group}"
|
56
|
-
exit 1
|
57
46
|
end
|
58
47
|
|
59
|
-
|
48
|
+
files ||= Dir['spec', 'test/**/*_test.rb']
|
49
|
+
specs, tests = files.partition { |file| file.match /^spec/ }
|
60
50
|
|
61
|
-
|
62
|
-
|
63
|
-
parallel = []
|
64
|
-
%w(memcached redis client shared riak tokyotyrant couch cassandra).each do |name|
|
65
|
-
serial = specs.select { |s| s.include?(name) }
|
66
|
-
unless serial.empty?
|
67
|
-
specs -= serial
|
68
|
-
parallel << serial
|
69
|
-
end
|
70
|
-
end
|
51
|
+
puts "The following specs will be executed:\n\t#{specs.join "\n\t"}\n\n" unless specs.empty?
|
52
|
+
puts "The following tests will be executed:\n\t#{tests.join "\n\t"}\n\n" unless tests.empty?
|
71
53
|
|
72
|
-
|
73
|
-
|
74
|
-
|
54
|
+
results = []
|
55
|
+
unless specs.empty?
|
56
|
+
# run all non :isolate examples in parallel
|
57
|
+
results << run(*%w{bundle exec parallel_rspec --},
|
58
|
+
*opts,
|
59
|
+
*tag_args(tags | %w{~isolate}),
|
60
|
+
'--',
|
61
|
+
*specs)
|
75
62
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
63
|
+
# find the example IDs of the isolate examples to be run in serial
|
64
|
+
ids = example_ids(tags, specs) - example_ids(tags | %w{~isolate}, specs)
|
65
|
+
unless ids.empty?
|
66
|
+
results << run(*%w{bundle exec rspec},
|
67
|
+
*opts,
|
68
|
+
'--',
|
69
|
+
*ids)
|
70
|
+
end
|
80
71
|
end
|
81
72
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
threads = []
|
86
|
-
failed = false
|
87
|
-
parallel.each do |serial|
|
88
|
-
threads << Thread.new do
|
89
|
-
begin
|
90
|
-
serial.each do |spec|
|
91
|
-
failed = true unless rspec(spec)
|
92
|
-
end
|
93
|
-
ensure
|
94
|
-
threads.delete Thread.current
|
95
|
-
end
|
96
|
-
end
|
97
|
-
sleep 0.1
|
98
|
-
sleep 0.1 while threads.size >= 5
|
73
|
+
tests.each do |test|
|
74
|
+
results << run(*%w{bundle exec ruby}, test)
|
99
75
|
end
|
100
|
-
sleep 0.1 until threads.empty?
|
101
76
|
|
102
|
-
if
|
77
|
+
if results.any?{ |result| !result }
|
103
78
|
puts "\e[31m########## MONETA TESTSUITE FAILED ##########\e[0m"
|
104
79
|
exit 1
|
105
80
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e
|
3
|
+
|
4
|
+
# Copied from https://github.com/apache/couchdb-pkg/blob/master/debian/README.Debian
|
5
|
+
COUCHDB_PASSWORD=password
|
6
|
+
echo "couchdb couchdb/mode select standalone
|
7
|
+
couchdb couchdb/mode seen true
|
8
|
+
couchdb couchdb/bindaddress string 127.0.0.1
|
9
|
+
couchdb couchdb/bindaddress seen true
|
10
|
+
couchdb couchdb/adminpass password ${COUCHDB_PASSWORD}
|
11
|
+
couchdb couchdb/adminpass seen true
|
12
|
+
couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD}
|
13
|
+
couchdb couchdb/adminpass_again seen true" | sudo debconf-set-selections
|
14
|
+
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --force-yes couchdb
|
15
|
+
|
16
|
+
# Reconfigure CouchDB to use delayed commits for speed: http://guide.couchdb.org/draft/performance.html
|
17
|
+
sudo sed -i '/\[couchdb\]/a delayed_commits = true' /etc/couchdb/local.ini
|
18
|
+
|
19
|
+
# (Re)start couchdb
|
20
|
+
sudo systemctl restart couchdb
|
21
|
+
|
22
|
+
# Display some info about CouchDB
|
23
|
+
sudo systemctl status couchdb
|
24
|
+
until curl http://localhost:5984/; do
|
25
|
+
sleep 1
|
26
|
+
done
|
27
|
+
|
data/script/start-hbase
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
set -e
|
3
|
+
|
4
|
+
cd $(dirname $(dirname $0))
|
5
|
+
|
6
|
+
mkdir -p hbase
|
7
|
+
mkdir -p zookeeper
|
8
|
+
mkdir -p downloads
|
9
|
+
root=$(pwd)
|
10
|
+
|
11
|
+
version=$(curl -sS https://downloads.apache.org/hbase/stable/RELEASENOTES.md | grep -oP '(?<=# HBASE\s\s)(\d+\.?)+' | head -n1)
|
12
|
+
|
13
|
+
echo HBase stable version is $version
|
14
|
+
|
15
|
+
if [ ! -f downloads/hbase-$version-bin.tar.gz ]; then
|
16
|
+
echo Downloading HBase ...
|
17
|
+
wget -P downloads https://downloads.apache.org/hbase/stable/hbase-$version-bin.tar.gz
|
18
|
+
fi
|
19
|
+
|
20
|
+
echo Extracting HBase ...
|
21
|
+
cd hbase
|
22
|
+
tar -zxf $root/downloads/hbase-$version-bin.tar.gz
|
23
|
+
|
24
|
+
echo Configuring HBase ...
|
25
|
+
echo "export JAVA_HOME=/usr" >> hbase-$version/conf/hbase-env.sh
|
26
|
+
tee <<-EOF > hbase-$version/conf/hbase-site.xml
|
27
|
+
<configuration>
|
28
|
+
<property>
|
29
|
+
<name>hbase.rootdir</name>
|
30
|
+
<value>file://$root/hbase</value>
|
31
|
+
</property>
|
32
|
+
<property>
|
33
|
+
<name>hbase.zookeeper.property.dataDir</name>
|
34
|
+
<value>$root/zookeeper</value>
|
35
|
+
</property>
|
36
|
+
<property>
|
37
|
+
<name>hbase.unsafe.stream.capability.enforce</name>
|
38
|
+
<value>false</value>
|
39
|
+
</property>
|
40
|
+
</configuration>
|
41
|
+
EOF
|
42
|
+
|
43
|
+
echo Launching HBase ...
|
44
|
+
./hbase-$version/bin/start-hbase.sh
|
45
|
+
./hbase-$version/bin/hbase-daemon.sh start thrift
|
46
|
+
|
47
|
+
cd $root
|
data/script/start-services
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# Install and start CouchDB
|
4
|
+
$(dirname $0)/start-couchdb
|
5
|
+
|
6
|
+
# Install and start HBase
|
7
|
+
$(dirname $0)/start-hbase
|
5
8
|
|
6
9
|
# Waiting for servers to start
|
7
10
|
sleep 3
|
8
|
-
|
9
|
-
echo 'TokyoTyrant status'
|
10
|
-
ps aux | grep ttserver
|
11
|
-
cat /tmp/ttserver.log
|
@@ -0,0 +1,148 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler/setup'
|
6
|
+
Bundler.require(:doc)
|
7
|
+
|
8
|
+
require 'yaml'
|
9
|
+
|
10
|
+
output = "<table>\n"
|
11
|
+
output << <<-TAB.lines.map(&:strip).join
|
12
|
+
<tr>
|
13
|
+
<th>Adapter</th><th>Required gems</th>
|
14
|
+
<th style="writing-mode:tb">MRI support<sup>1</sup></th>
|
15
|
+
<th style="writing-mode:tb">JRuby support<sup>1</sup></th>
|
16
|
+
<th style="writing-mode:tb">Multi-thread safe<sup>2</sup></th>
|
17
|
+
<th style="writing-mode:tb">Multi-process safe<sup>3</sup></th>
|
18
|
+
<th style="writing-mode:tb">Atomic increment<sup>4</sup></th>
|
19
|
+
<th style="writing-mode:tb">Atomic create<sup>5</sup></th>
|
20
|
+
<th style="writing-mode:tb">Native expires<sup>6</sup></th>
|
21
|
+
<th style="writing-mode:tb">Persistent</th>
|
22
|
+
<th style="writing-mode:tb">Key Traversal</th>
|
23
|
+
<th style="writing-mode:tb">Bulk read<sup>7</sup></th>
|
24
|
+
<th style="writing-mode:tb">Bulk write<sup>8</sup></th>
|
25
|
+
<th>Description</th>
|
26
|
+
</tr>
|
27
|
+
TAB
|
28
|
+
output << "\n\n"
|
29
|
+
|
30
|
+
footnotes = {
|
31
|
+
"platform" => <<-EOF,
|
32
|
+
Indicates that the adapter is expected to work on this platform. Most adapters will at least
|
33
|
+
work on MRI, but some are curently considered unstable, in which case they are not supported
|
34
|
+
on any platform.
|
35
|
+
EOF
|
36
|
+
"multi-thread safe" => <<-EOF,
|
37
|
+
Make adapters thread-safe by using `Moneta::Lock` or by passing the option `threadsafe: true` to
|
38
|
+
`Moneta#new`. There is also `Moneta::Pool` which can be used to share a store between multiple
|
39
|
+
threads if the store is multi-process safe. I recommend to add the option `:threadsafe` to
|
40
|
+
ensure thread-safety since for example under JRuby and Rubinius even the basic datastructures
|
41
|
+
are not thread safe due to the lack of a global interpreter lock (GIL). This differs from MRI
|
42
|
+
where some adapters might appear thread safe already but only due to the GIL.
|
43
|
+
EOF
|
44
|
+
"multi-process safe" => <<-EOF,
|
45
|
+
Share a Moneta store between multiple processes using `Moneta::Shared` (See below).
|
46
|
+
EOF
|
47
|
+
"atomic increment" => <<-EOF,
|
48
|
+
If a store provides atomic increment it can be used with `Moneta::Semaphore`. You can add weak
|
49
|
+
`#increment` support using the `Moneta::WeakIncrement` proxy.
|
50
|
+
EOF
|
51
|
+
"atomic create" => <<-EOF,
|
52
|
+
If a store provides atomic creation it can be used with `Moneta::Mutex`. You can add weak
|
53
|
+
`#create` support using the `Moneta::WeakCreate` proxy.
|
54
|
+
EOF
|
55
|
+
"native expires" => <<-EOF,
|
56
|
+
Add expiration support by using `Moneta::Expires` or by passing the option `expires: true` to
|
57
|
+
`Moneta#new`.
|
58
|
+
EOF
|
59
|
+
"bulk read" => <<-EOF,
|
60
|
+
This indicates that there is some performance gain when fetching
|
61
|
+
multiple values at once using `#values_at`/`#fetch_values` or `#slice`.
|
62
|
+
For instance, the `MGET` instruction in Redis, or the ability to retrieve
|
63
|
+
several rows in one query in SQL.
|
64
|
+
EOF
|
65
|
+
"bulk write" => <<-EOF
|
66
|
+
This indicates that there is some performance gain when storing multiple
|
67
|
+
key/value pairs at once using `#merge!`/`#update`.
|
68
|
+
EOF
|
69
|
+
}
|
70
|
+
|
71
|
+
YAML.parse_stream(File.read(File.join(File.dirname(File.dirname(__FILE__)), 'feature_matrix.yaml'))) do |document|
|
72
|
+
feature_group = document.to_ruby
|
73
|
+
|
74
|
+
output << %{<tr><th colspan="2">#{feature_group['group']}</th><th colspan="12"></th></tr>\n\n}
|
75
|
+
|
76
|
+
feature_group['notes'].each do |k,v|
|
77
|
+
footnotes[k] = v
|
78
|
+
end
|
79
|
+
|
80
|
+
feature_group['backends'].each do |backend|
|
81
|
+
output << '<tr>'
|
82
|
+
output << "<td>#{backend['adapter']}</td>"
|
83
|
+
output << "<td>#{backend['gems'] || '-'}</td>"
|
84
|
+
|
85
|
+
features = backend['features'] | (feature_group['features'] || [])
|
86
|
+
features += backend['platforms'] || []
|
87
|
+
%w{MRI JRuby threadsafe multiprocess increment create expires persist each_key bulk_read bulk_write}.each do |feature|
|
88
|
+
supported = if features.include? feature
|
89
|
+
"yes"
|
90
|
+
elsif backend['unknown'] && backend['unknown'].include?(feature)
|
91
|
+
"unknown"
|
92
|
+
else
|
93
|
+
"no"
|
94
|
+
end
|
95
|
+
|
96
|
+
note = if backend['notes'] && backend['notes'][feature]
|
97
|
+
"<sup>#{footnotes.keys.index(backend['notes'][feature]) + 1}</sup>"
|
98
|
+
else
|
99
|
+
''
|
100
|
+
end
|
101
|
+
|
102
|
+
mark = case supported
|
103
|
+
when "yes"
|
104
|
+
"✓"
|
105
|
+
when "no"
|
106
|
+
"✗"
|
107
|
+
when "unknown"
|
108
|
+
'?'
|
109
|
+
end
|
110
|
+
|
111
|
+
colour = case supported
|
112
|
+
when "yes"
|
113
|
+
'#5F5'
|
114
|
+
when "no"
|
115
|
+
'#F44'
|
116
|
+
when "unknown"
|
117
|
+
'#55F'
|
118
|
+
end
|
119
|
+
|
120
|
+
output << %{<td style="text-align:center;background:#{colour}">#{mark}#{note}</td>}
|
121
|
+
end
|
122
|
+
|
123
|
+
html_description = if backend['description']
|
124
|
+
Kramdown::Document.new(backend['description']).to_html.match('<p>(.*)</p>')[1]
|
125
|
+
else
|
126
|
+
''
|
127
|
+
end
|
128
|
+
output << "<td>#{html_description}</td>"
|
129
|
+
|
130
|
+
output << '</tr>'
|
131
|
+
output << "\n\n"
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
output << "</table>\n\n"
|
138
|
+
|
139
|
+
footnotes.each_value.each_with_index do |note, idx|
|
140
|
+
output << "#{idx+1}. #{note.lines.map(&:strip).join(" ")}\n"
|
141
|
+
end
|
142
|
+
|
143
|
+
readme = File.open('README.md', 'r+')
|
144
|
+
new_readme = readme.read.sub(/(name="backend-matrix".*?\n).*?(------)/m, "\\1\n#{output}\n\\2")
|
145
|
+
readme.rewind
|
146
|
+
readme << new_readme
|
147
|
+
readme.truncate(readme.tell)
|
148
|
+
|