thrift_client 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.4.2 Allow per-method overrides of retries. Fix several bugs with EventMachine.
2
+
1
3
  v0.4.1 Making ThriftClient decoratable. Able to add new functionality a class definition.
2
4
 
3
5
  v0.4.0. Add new EventMachine transport. This requires two layers of transport
data/Manifest CHANGED
@@ -21,4 +21,3 @@ test/simple_test.rb
21
21
  test/test_helper.rb
22
22
  test/thrift_client_http_test.rb
23
23
  test/thrift_client_test.rb
24
- thrift_client.gemspec
@@ -26,6 +26,10 @@ class AbstractThriftClient
26
26
  end
27
27
  end
28
28
 
29
+ def inspect
30
+ "<#{self.class}(#{client_class}) @current_server=#{@current_server}>"
31
+ end
32
+
29
33
  # Force the client to connect to the server. Not necessary to be
30
34
  # called as the connection will be made on the first RPC method
31
35
  # call.
@@ -85,12 +89,13 @@ class AbstractThriftClient
85
89
  :randomize_server_list => true,
86
90
  :retries => nil,
87
91
  :server_retry_period => 1,
88
- :server_max_requests => nil
92
+ :server_max_requests => nil,
93
+ :retry_overrides => {}
89
94
  }.freeze
90
95
 
91
96
  def initialize(client_class, servers, options = {})
92
97
  super
93
- @options = RETRYING_DEFAULTS.merge(@options)
98
+ @options = RETRYING_DEFAULTS.merge(@options) # @options is set by super
94
99
  @retries = options[:retries] || @server_list.size
95
100
  @request_count = 0
96
101
  @max_requests = @options[:server_max_requests]
@@ -146,7 +151,7 @@ class AbstractThriftClient
146
151
  super
147
152
  rescue *@options[:exception_classes] => e
148
153
  disconnect_on_error!
149
- tries ||= @retries
154
+ tries ||= (@options[:retry_overrides][method_name.to_sym] || @retries)
150
155
  tries -= 1
151
156
  tries == 0 ? handle_exception(e, method_name, args) : retry
152
157
  end
@@ -21,6 +21,11 @@ class ThriftClientTest < Test::Unit::TestCase
21
21
  Process.wait
22
22
  end
23
23
 
24
+ def test_inspect
25
+ client = ThriftClient.new(Greeter::Client, @servers.last, @options)
26
+ assert_equal "<ThriftClient(Greeter::Client) @current_server=127.0.0.1:1463>", client.inspect
27
+ end
28
+
24
29
  def test_live_server
25
30
  assert_nothing_raised do
26
31
  ThriftClient.new(Greeter::Client, @servers.last, @options).greeting("someone")
@@ -2,11 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{thrift_client}
5
- s.version = "0.4.1"
5
+ s.version = "0.4.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evan Weaver"]
9
- s.date = %q{2010-03-30}
9
+ s.cert_chain = ["/Users/ryan/.gemkeys/gem-public_cert.pem"]
10
+ s.date = %q{2010-04-08}
10
11
  s.description = %q{A Thrift client wrapper that encapsulates some common failover behavior.}
11
12
  s.email = %q{}
12
13
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.rdoc", "lib/thrift_client.rb", "lib/thrift_client/abstract_thrift_client.rb", "lib/thrift_client/connection.rb", "lib/thrift_client/connection/base.rb", "lib/thrift_client/connection/factory.rb", "lib/thrift_client/connection/http.rb", "lib/thrift_client/connection/socket.rb", "lib/thrift_client/event_machine.rb", "lib/thrift_client/simple.rb", "lib/thrift_client/thrift.rb"]
@@ -15,7 +16,8 @@ Gem::Specification.new do |s|
15
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Thrift_client", "--main", "README.rdoc"]
16
17
  s.require_paths = ["lib"]
17
18
  s.rubyforge_project = %q{fauna}
18
- s.rubygems_version = %q{1.3.6}
19
+ s.rubygems_version = %q{1.3.5}
20
+ s.signing_key = %q{/Users/ryan/.gemkeys/gem-private_key.pem}
19
21
  s.summary = %q{A Thrift client wrapper that encapsulates some common failover behavior.}
20
22
  s.test_files = ["test/multiple_working_servers_test.rb", "test/simple_test.rb", "test/test_helper.rb", "test/thrift_client_http_test.rb", "test/thrift_client_test.rb"]
21
23
 
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,34 +1,48 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thrift_client
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 4
8
- - 1
9
- version: 0.4.1
4
+ version: 0.4.2
10
5
  platform: ruby
11
6
  authors:
12
7
  - Evan Weaver
13
8
  autorequire:
14
9
  bindir: bin
15
- cert_chain: []
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMQ0wCwYDVQQDDARyeWFu
14
+ MRswGQYKCZImiZPyLGQBGRYLdGhlcnlhbmtpbmcxEzARBgoJkiaJk/IsZAEZFgNj
15
+ b20wHhcNMTAwMTA4MTc1MDM0WhcNMTEwMTA4MTc1MDM0WjBBMQ0wCwYDVQQDDARy
16
+ eWFuMRswGQYKCZImiZPyLGQBGRYLdGhlcnlhbmtpbmcxEzARBgoJkiaJk/IsZAEZ
17
+ FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDLPp+0PtRT3qCI
18
+ 02sMsADSn7Uf1GpyXUtk4Fb94LqUO6Scl91YDmbFMpjzrQwQvBYMIVreWcwSish6
19
+ nip6WEk9lqXcOeDmex/qY2/FVXG8ffqjFHiNiN9vpWrWj5VMICequ+ftzWLKsPIS
20
+ DGJ4o+Z6wEYRuirgaRPCYAUDPglsaqctJ56wPuycryMe5+ApSkOS9iLWMprQKEAq
21
+ j2R2OBV0dSARdbtzuKwrP7sLDo7uPa0egFBUlcZ+nujGr4LvmpryB8scNRNmZK1w
22
+ 1rEI7O06CbULj08qYxEhnKmFE7LbBoN/HrmvZLVQK5mWuiZQhtmJuhBfStJsaDux
23
+ 5tBEkYZVAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
+ BBSnLarDEo5eBE2arSMrBdOOhtrnPTANBgkqhkiG9w0BAQUFAAOCAQEANER07s4K
25
+ Pvc1DSduliRDMUax/VSfLzDTtTAQwuSAPDrWAYXKugcJtOZOXjDbGL7c5zoWmy9u
26
+ Fn5vEVdm/93J+84D/IMaaof3BwX/NNEYH01CeZEIGMfc5AFFha7dabzP/uiPpb/c
27
+ GSvomC9IzyN37+eWwOS16cC+5XnBT6KRCaXYg2Fh6WpTgde67OVgXr4Q58HXlaZ+
28
+ /2BB3wq9lZ4JskvlpYpYnlPAUyiyc6R2Mjts1pURz5nkW4SuS7Kd1KCOOyr1McDH
29
+ VP12sTSjJclmI17BjDGQpAF0n9v5ExhJxWpeOjeBUPQsOin3ypEM1KkckLmOKvH6
30
+ zyKMYVRO0z/58g==
31
+ -----END CERTIFICATE-----
16
32
 
17
- date: 2010-03-30 00:00:00 -07:00
33
+ date: 2010-04-08 00:00:00 -07:00
18
34
  default_executable:
19
35
  dependencies:
20
36
  - !ruby/object:Gem::Dependency
21
37
  name: thrift
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
38
+ type: :runtime
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
24
41
  requirements:
25
42
  - - ">="
26
43
  - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
44
  version: "0"
30
- type: :runtime
31
- version_requirements: *id001
45
+ version:
32
46
  description: A Thrift client wrapper that encapsulates some common failover behavior.
33
47
  email: ""
34
48
  executables: []
@@ -92,21 +106,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - ">="
94
108
  - !ruby/object:Gem::Version
95
- segments:
96
- - 0
97
109
  version: "0"
110
+ version:
98
111
  required_rubygems_version: !ruby/object:Gem::Requirement
99
112
  requirements:
100
113
  - - ">="
101
114
  - !ruby/object:Gem::Version
102
- segments:
103
- - 0
104
- - 8
105
115
  version: "0.8"
116
+ version:
106
117
  requirements: []
107
118
 
108
119
  rubyforge_project: fauna
109
- rubygems_version: 1.3.6
120
+ rubygems_version: 1.3.5
110
121
  signing_key:
111
122
  specification_version: 3
112
123
  summary: A Thrift client wrapper that encapsulates some common failover behavior.
metadata.gz.sig ADDED
Binary file