Граф коммитов

1201 Коммитов

Автор SHA1 Сообщение Дата
Arthur Neves 1972228da8 remove osx patch, and just apply it 2016-03-17 10:47:33 -04:00
Arthur Neves c9443c4e6c Fix OSX compilation errors 2016-03-17 10:46:52 -04:00
Arthur Neves 625a491e30 revert to touch all files behavior 2016-03-17 10:46:03 -04:00
Arthur Neves 0dd0ebea71 Merge remote-tracking branch 'origin/master' into arthurnn/vendor_libmemcacached_1_0_18 2016-03-17 10:42:16 -04:00
Vicent Marti 82bcaf2d69 Merge pull request #165 from arthurnn/vmg/cleanup2
Cleanup part 2
2016-03-17 09:43:03 +01:00
Vicent Marti a0df206974 client: Let libmemcached pick the defaults
The library instantiates new connections with a sane set of default
already. We don't need to specify them from Ruby.
2016-03-17 09:38:07 +01:00
Vicent Marti 01a5b626b9 connection: Always call `fetch_execute`
It's necessary regardless of the fetch mode we're using
2016-03-16 18:55:24 +01:00
Vicent Marti 7cc8a95610 connection: Use `mget_execute` when in binary mode
The performance of `mget_execute` should be faster, but this API is only
available if the connection is in binary mode.
2016-03-16 15:48:54 +01:00
Vicent Marti 094d2904e7 ext: rename the native extension to `memcached`
The old `memcached_rb` name was not really descriptive. We can name the
native extension with the same name as the Gem and require it explicitly
in our initialization
2016-03-16 15:05:58 +01:00
Vicent Marti 4fff883508 server: print with Memcached's standard syntax 2016-03-16 14:49:34 +01:00
Vicent Marti f534ae435f server: Do not modify hostname when printing
The `<<` operator would modify the original hostname string for the
server when calling Server#to_s.
2016-03-16 14:48:42 +01:00
Vicent Marti 0544f5ea56 client: Use Memcached's default syntax for weight
A server's weight is now defined by an optional `/?weight` at the end of
the server string. This matches the official syntax in Memcached and
reduces ambiguities (e.g. in cases where you want to use a server
without specifying a port but specifying its weight).
2016-03-16 14:46:43 +01:00
Vicent Marti c6e00847fa client-test: Reenable the key-with-null test
This test should be working now that we're properly handling the full
length of keys using the Ruby C APi.
2016-03-16 11:53:14 +01:00
Vicent Marti 120ebd155b client-test: Remove unused tests 2016-03-16 11:53:05 +01:00
Vicent Marti d2496275f5 client: Initialize using a config string
The libmemcached APIs to add weighted servers to a client are not widely
available in all releases of libmemcached.

To work around this, we're now using the `memcached(const char*,
size_t)` API, which is recommended by the authors as the standard way to
initialize the client.

See: http://docs.libmemcached.org/libmemcached_configuration.html

The constructor for Memcached::Connection now takes a configuration
string. To keep the external API unchanged, Memcached::Client#new now
parses the array of servers and creates a configuration string that will
be passed to the connection.

Alternatively, you can pass directly a configuration string to
Client#new and that will be used in place of the array of servers.

A new static method Connection#check_config! has been added so we can
eagerly verify that user supplied config strings are valid.
2016-03-16 11:49:33 +01:00
Vicent Marti e1a162c131 behavior: move most of the behavior parsing code to Ruby
All the complex C code for turning strings into the actual Memcached
behavior constants has been ported to Ruby. The resulting APIs should be
functionally equivalent, but now users have much more freedom when
setting and using behaviors.

The following calls are all now valid and equivalent:

    conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, MEMCACHED_HASH_JENKINS)
    conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, 'MEMCACHED_HASH_JENKINS')
    conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, 'JENKINS')
    conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, 'jenkins')
    conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, 3)
    conn.set_behavior('MEMCACHED_BEHAVIOR_HASH', 3)
    conn.set_behavior('hash', 3)

    # this should be the preferred usage
    conn.set_behavior('hash', 'jenkins')
2016-03-16 11:45:48 +01:00
Vicent Marti 29d885dac9 memached_rb: add aliases for Conection#clone and Connection#exist
Although the behavior of Object#dup is not the same as Object#clone, for
our use case they are effectively equal (since our class has no tained
or frozen state). Hence, alias the two methods to our clone function.

Also alias a more idiomatic Ruby method Connection#exist?
2016-03-16 11:43:58 +01:00
Vicent Marti 4b408586d5 memcached_rb: fix C99 warning
Ruby C Extensions are compiled by default as C89, which means that
statements cannot come after declarations. GCC is lenient about this,
but it still throws a warning when compiling.
2016-03-16 11:43:14 +01:00
Vicent Marti 2608d41e3a Fix Ruby warnings
Miscellaneous warnings regarding Ruby syntax (shown in Ruby 2.1+)
2016-03-16 11:42:48 +01:00
Arthur Neves 0f82dbf0cc fix aclocal configure issue 2016-03-15 23:31:54 -04:00
Arthur Neves 6968859f54 Dont install libmemcached on travis 2016-03-15 23:24:18 -04:00
Arthur Neves bd56cd5f4c Update gitignore with libmemcached compiled files 2016-03-15 23:23:02 -04:00
Arthur Neves e3144cb61e apply .patch 2016-03-15 22:52:41 -04:00
Arthur Neves b2b870cf89 compile vendored lib 2016-03-15 22:40:09 -04:00
Arthur Neves 90a48f7676 Add osx compile fix 2016-03-15 22:38:37 -04:00
Arthur Neves 04af6ffb30 vendor libmemcached 1.0.18 2016-03-15 22:32:45 -04:00
Arthur Neves 5704f4295c Update gitignore 2016-03-15 22:31:46 -04:00
Arthur Neves c9fdb406ea Make sure we dont connect on client new 2016-03-15 20:19:47 -04:00
Arthur Neves 2d5ceaea94 Update TODOs 2016-03-15 20:13:15 -04:00
Arthur Neves ec0cb5d856 Add reset method 2016-03-15 20:12:59 -04:00
Arthur Neves 50d8171db8 Add touch method 2016-03-15 18:48:38 -04:00
Arthur Neves 726ffba7de Remove commented out code 2016-03-15 18:32:33 -04:00
Arthur Neves 63fc043da5 Add more behavior tests 2016-03-15 18:30:40 -04:00
Arthur Neves 7d3aa3e61b Add behavior tests
Add value lookup by KEY and STRING
2016-03-15 18:06:44 -04:00
Arthur Neves 15694f224f Fix merge conflict
Add missing definition
2016-03-15 17:55:50 -04:00
Arthur Neves 848723e20d Merge branch 'vmg/cleanup' 2016-03-15 17:50:39 -04:00
Arthur Neves 84bfd38f21 fix Server to_s method 2016-03-15 17:05:29 -04:00
Arthur Neves cffec2e16e Inc and dec can return negative numbers 2016-03-15 16:50:34 -04:00
Arthur Neves 0eaa496264 hostname instead of name on server 2016-03-15 16:47:26 -04:00
Arthur Neves 823b0b3c8e Remove some white spaces 2016-03-15 16:46:04 -04:00
Arthur Neves 94a731787b We need to convert floats and big ints too 2016-03-15 16:45:48 -04:00
Arthur Neves 245ee6c339 Use hostname and not server.
Server is the array we are looking up the values
2016-03-15 16:45:23 -04:00
Arthur Neves 115b89073f require client after the lib 2016-03-15 16:44:55 -04:00
Vicent Marti e8b309d555 Cleanup! 2016-03-15 18:29:23 +01:00
Arthur Neves 369984b003 Remove commented out code 2016-03-15 11:49:29 -04:00
Arthur Neves 07984cbc47 Add options back to tests. 2016-03-15 11:41:19 -04:00
Arthur Neves 7e1af9eb22 Fix clone method 2016-03-15 11:40:54 -04:00
Arthur Neves 898b008e7d Rename connection rb class 2016-03-15 11:40:17 -04:00
Arthur Neves bfd0404f87 Port consistent hashing test 2016-03-14 22:35:43 -04:00
Arthur Neves 9b28b104a7 No need to test hashing algorithm 2016-03-14 22:33:34 -04:00