siberite-client 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7848ea76b5512913552938cfac31d21fedce5b2
4
- data.tar.gz: 7cbdf9d5fbed9c3aa10ccd8aa917d3f882f2f8a6
3
+ metadata.gz: 19cec6243d11d059f7bfad4a2702e46b969f9296
4
+ data.tar.gz: dd21e35e459f5ab3216b64a8aca1c4ff345646cf
5
5
  SHA512:
6
- metadata.gz: 1762a60bc54881a542068783b82ffe10bfbee2f5aeaba80831e0542e5365552bb9f3e6e21c72c77e8976ad90cf159ef0a1f94c4bad9598b701e010d263836eb6
7
- data.tar.gz: c74d681cc09007725fbe9d6996e66ea4a6820c713266be633e2997cd227d04265e7c468d146b5dfdf996b2cd01abe2e7a866691d57fa010d3847f47c3d075f28
6
+ metadata.gz: 8e30ee5a79714a7fc193dc6c811104948a489f068ded661cb28c2ab5de317c1e0a53ed5ba8eb502cd70c2ebc739b45e794f33fcf082886a5f4c5be463db6397c
7
+ data.tar.gz: 81ab9257eca26190fede54f31f9db721dad780161bf04d95fd3fe5bb63087bf7999188abd88e444425d0511a49f045bb0d3bd4e5b18cdeeeb69b2b895ac5b515
data/README.md CHANGED
@@ -1,63 +1,79 @@
1
- ## siberite-client: Talk to Siberite queue server from Ruby
2
-
3
- siberite-client is a library that allows you to talk to a [Siberite](http://github.com/robey/siberite) queue server from ruby. As Siberite uses the memcache protocol, siberite-client is implemented as a wrapper around the memcached gem.
1
+ ## Talk to Siberite queue server from Ruby
4
2
 
3
+ Siberite-client is a library that allows you to talk to a [Siberite](http://github.com/bogdanovich/siberite) queue server from ruby.
4
+ As Siberite uses the memcache protocol, siberite-client is implemented as a wrapper around the memcached gem.
5
5
 
6
6
  ## Installation
7
7
 
8
- you will need to install memcached.gem, though rubygems should do this for you. just:
8
+ Add this line to your application's Gemfile:
9
9
 
10
- sudo gem install siberite-client
10
+ ```ruby
11
+ gem 'siberite-client'
12
+ ```
11
13
 
14
+ And then execute:
12
15
 
13
- ## Basic Usage
16
+ $ bundle
17
+
18
+ Or install it yourself as:
14
19
 
15
- `Siberite::Client.new` takes a list of servers and an options hash. See the [rdoc for Memcached](http://blog.evanweaver.com/files/doc/fauna/memcached/classes/Memcached.html) for an explanation of what the various options do.
20
+ $ gem install siberite-client
16
21
 
17
- require 'siberite'
22
+ ## Basic Usage
23
+
24
+ `Siberite::Client.new` takes a list of servers and an options hash.
25
+ See the [rdoc for Memcached](http://blog.evanweaver.com/files/doc/fauna/memcached/classes/Memcached.html) for an explanation of what the various options do.
18
26
 
19
- $queue = Siberite::Client.new('localhost:22133')
20
- $queue.set('a_queue', 'foo')
21
- $queue.get('a_queue') # => 'foo'
27
+ ```ruby
28
+ require 'siberite'
22
29
 
30
+ @queue = Siberite::Client.new('localhost:22133')
31
+ @queue.set('a_queue', 'foo')
32
+ @queue.get('a_queue') # => 'foo'
33
+ ```
23
34
 
24
35
  ## Client Proxies
25
36
 
26
37
  siberite-client comes with a number of decorators that change the behavior of the raw client.
27
38
 
28
- $queue = Siberite::Client.new('localhost:22133')
29
- $queue.get('empty_queue') # => nil
30
-
31
- $queue = Siberite::Client::Blocking.new(Siberite::Client.new('localhost:22133'))
32
- $queue.get('empty_queue') # does not return until it pulls something from the queue
39
+ ```ruby
40
+ @queue = Siberite::Client.new('localhost:22133')
41
+ @queue.get('empty_queue') # => nil
33
42
 
43
+ @queue = Siberite::Client::Blocking.new(Siberite::Client.new('localhost:22133'))
44
+ @queue.get('empty_queue') # does not return until it pulls something from the queue
45
+ ```
34
46
 
35
47
  ## Configuration Management
36
48
 
37
49
  Siberite::Config provides some tools for pulling queue config out of a YAML config file.
38
50
 
39
- Siberite::Config.load 'path/to/siberite.yml'
40
- Siberite::Config.environment = 'production' # defaults to development
51
+ ```ruby
52
+ Siberite::Config.load 'path/to/siberite.yml'
53
+ Siberite::Config.environment = 'production' # defaults to development
41
54
 
42
- $queue = Siberite::Config.new_client
55
+ @queue = Siberite::Config.new_client
56
+ ```
43
57
 
44
58
  This tells siberite-client to look for `path/to/siberite.yml`, and pull the client configuration out of
45
59
  the 'production' key in that file. Sample config:
46
60
 
47
- defaults: &defaults
48
- distribution: :random
49
- timeout: 2
50
- connect_timeout: 1
51
-
52
- production:
53
- <<: *defaults
54
- servers:
55
- - siberite01.example.com:22133
56
- - siberite02.example.com:22133
57
- - siberite03.example.com:22133
58
-
59
- development:
60
- <<: *defaults
61
- servers:
62
- - localhost:22133
63
- show_backtraces: true
61
+ ```yaml
62
+ defaults: &defaults
63
+ distribution: :random
64
+ timeout: 2
65
+ connect_timeout: 1
66
+
67
+ production:
68
+ <<: *defaults
69
+ servers:
70
+ - siberite01.example.com:22133
71
+ - siberite02.example.com:22133
72
+ - siberite03.example.com:22133
73
+
74
+ development:
75
+ <<: *defaults
76
+ servers:
77
+ - localhost:22133
78
+ show_backtraces: true
79
+ ```
@@ -18,9 +18,9 @@ module Siberite
18
18
  DEFAULT_OPTIONS = {
19
19
  :retry_timeout => 0,
20
20
  :exception_retry_limit => 5,
21
- :timeout => 0.25,
21
+ :timeout => 0,
22
22
  :gets_per_server => 100,
23
- :get_timeout_ms => 10
23
+ :get_timeout_ms => false
24
24
  }.freeze
25
25
 
26
26
  # Exceptions which are connection failures we retry after
@@ -1,6 +1,6 @@
1
1
  module Siberite::Client::StatsHelper
2
2
  STATS_TIMEOUT = 3
3
- QUEUE_STAT_NAMES = %w{items bytes total_items logsize expired_items mem_items mem_bytes age discarded waiters open_transactions}
3
+ QUEUE_STAT_NAMES = %w{items open_transactions}
4
4
 
5
5
  def sizeof(queue)
6
6
  stat_info = stat(queue)
@@ -1,3 +1,3 @@
1
1
  module Siberite
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
@@ -19,14 +19,14 @@ describe Siberite::Client do
19
19
 
20
20
  it "gets from the same server :gets_per_server times" do
21
21
  client = @client.instance_variable_get(:@read_client)
22
- mock(client).get("a_queue/t=10", true).times(102).returns('item')
22
+ mock(client).get("a_queue", true).times(102).returns('item')
23
23
 
24
24
  102.times { @client.get("a_queue") }
25
25
  end
26
26
 
27
27
  it "gets from a different server when the last result was nil" do
28
28
  client = @client.instance_variable_get(:@read_client)
29
- mock(client).get("a_queue/t=10", true).returns(nil).twice
29
+ mock(client).get("a_queue", true).returns(nil).twice
30
30
 
31
31
  2.times { @client.get("a_queue") }
32
32
  end
@@ -113,8 +113,8 @@ describe Siberite::Client do
113
113
  @client.set("test-queue-name", 97)
114
114
 
115
115
  stats = @client.stats
116
- %w{uptime time version curr_items total_items bytes curr_connections total_connections
117
- cmd_get cmd_set get_hits get_misses bytes_read bytes_written queues}.each do |stat|
116
+ %w{uptime time version curr_connections total_connections
117
+ cmd_get cmd_set queues}.each do |stat|
118
118
  stats[stat].should_not be_nil
119
119
  end
120
120
 
@@ -133,7 +133,9 @@ describe Siberite::Client do
133
133
  stub(@client).servers { [server] * 2 }
134
134
  stats_for_two_servers = @client.stats
135
135
 
136
- stats_for_two_servers['bytes'].should == 2*stats_for_one_server['bytes']
136
+ expect(stats_for_two_servers['cmd_get']).to eq(
137
+ 2 * stats_for_one_server['cmd_get']
138
+ )
137
139
  end
138
140
  end
139
141
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siberite-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Freels
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-11-23 00:00:00.000000000 Z
13
+ date: 2015-11-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: memcached