thrift_client 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,7 @@
1
- v0.5.0 Add support for wrapping exception, so that Thrift::Foo can become Greeter::Foo.
1
+ v0.6.0 Fix bug where we'd try to mark the current server down when we didn't have a current server.
2
+ Upgrade to thrift 0.5.
3
+
4
+ v0.5.0 Add support for wrapping exceptions, so that Thrift::Foo can become Greeter::Foo.
2
5
  Make server_retry_period work the way you expect.
3
6
  Better bookkeeping around marking servers as dead.
4
7
 
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ Echoe.new("thrift_client") do |p|
7
7
  p.project = "fauna"
8
8
  p.summary = "A Thrift client wrapper that encapsulates some common failover behavior."
9
9
  p.rubygems_version = ">= 0.8"
10
- p.dependencies = ['thrift ~>0.2.0']
10
+ p.dependencies = ['thrift ~>0.5.0']
11
11
  p.ignore_pattern = /^(vendor\/thrift)/
12
12
  p.rdoc_pattern = /^(lib|bin|tasks|ext)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
13
13
  p.url = "http://blog.evanweaver.com/files/doc/fauna/thrift_client/"
data/lib/thrift_client.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- gem 'thrift', '~>0.2.0'
2
+ gem 'thrift', '~>0.5.0'
3
3
  require 'thrift'
4
4
 
5
5
  require 'rubygems'
@@ -148,7 +148,7 @@ class AbstractThriftClient
148
148
  end
149
149
 
150
150
  def disconnect_on_error!
151
- @current_server.mark_down!
151
+ @current_server.mark_down! if @current_server
152
152
  disconnect!
153
153
  end
154
154
 
@@ -55,10 +55,9 @@ module Greeter
55
55
  # HELPER FUNCTIONS AND STRUCTURES
56
56
 
57
57
  class Greeting_args
58
- include ::Thrift::Struct
58
+ include ::Thrift::Struct, ::Thrift::Struct_Union
59
59
  NAME = 1
60
60
 
61
- ::Thrift::Struct.field_accessor self, :name
62
61
  FIELDS = {
63
62
  NAME => {:type => ::Thrift::Types::STRING, :name => 'name'}
64
63
  }
@@ -68,13 +67,13 @@ module Greeter
68
67
  def validate
69
68
  end
70
69
 
70
+ ::Thrift::Struct.generate_accessors self
71
71
  end
72
72
 
73
73
  class Greeting_result
74
- include ::Thrift::Struct
74
+ include ::Thrift::Struct, ::Thrift::Struct_Union
75
75
  SUCCESS = 0
76
76
 
77
- ::Thrift::Struct.field_accessor self, :success
78
77
  FIELDS = {
79
78
  SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
80
79
  }
@@ -84,13 +83,13 @@ module Greeter
84
83
  def validate
85
84
  end
86
85
 
86
+ ::Thrift::Struct.generate_accessors self
87
87
  end
88
88
 
89
89
  class Yo_args
90
- include ::Thrift::Struct
90
+ include ::Thrift::Struct, ::Thrift::Struct_Union
91
91
  NAME = 1
92
92
 
93
- ::Thrift::Struct.field_accessor self, :name
94
93
  FIELDS = {
95
94
  NAME => {:type => ::Thrift::Types::STRING, :name => 'name'}
96
95
  }
@@ -100,10 +99,11 @@ module Greeter
100
99
  def validate
101
100
  end
102
101
 
102
+ ::Thrift::Struct.generate_accessors self
103
103
  end
104
104
 
105
105
  class Yo_result
106
- include ::Thrift::Struct
106
+ include ::Thrift::Struct, ::Thrift::Struct_Union
107
107
 
108
108
  FIELDS = {
109
109
 
@@ -114,6 +114,7 @@ module Greeter
114
114
  def validate
115
115
  end
116
116
 
117
+ ::Thrift::Struct.generate_accessors self
117
118
  end
118
119
 
119
120
  end
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path('test_helper.rb', File.dirname(__FILE__))
2
2
 
3
3
  class MultipleWorkingServersTest < Test::Unit::TestCase
4
4
  def setup
data/test/simple_test.rb CHANGED
@@ -1,5 +1,4 @@
1
-
2
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path('test_helper.rb', File.dirname(__FILE__))
3
2
 
4
3
  class SimpleTest < Test::Unit::TestCase
5
4
 
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path('test_helper.rb', File.dirname(__FILE__))
2
2
  require "thrift/server/mongrel_http_server"
3
3
 
4
4
  class ThriftClientHTTPTest < Test::Unit::TestCase
@@ -43,4 +43,4 @@ class ThriftClientHTTPTest < Test::Unit::TestCase
43
43
  end
44
44
  end
45
45
 
46
- end
46
+ end
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path('test_helper.rb', File.dirname(__FILE__))
2
2
 
3
3
  class ThriftClientTest < Test::Unit::TestCase
4
4
 
@@ -49,7 +49,7 @@ class ThriftClientTest < Test::Unit::TestCase
49
49
  # disconnect_on_error! is called every time a server related
50
50
  # connection error happens. it will be called every try (so, retries + 1)
51
51
  singleton_class.send :define_method, :disconnect_on_error! do |*args|
52
- times_called += 1; super
52
+ times_called += 1; super *args
53
53
  end
54
54
 
55
55
  assert_raises(Greeter::Client::TransportException) { client.greeting("someone") }
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{thrift_client}
5
- s.version = "0.5.0"
5
+ s.version = "0.6.0"
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, Ryan King, Jeff Hodges"]
9
- s.date = %q{2010-09-22}
9
+ s.date = %q{2010-12-08}
10
10
  s.description = %q{A Thrift client wrapper that encapsulates some common failover behavior.}
11
11
  s.email = %q{}
12
12
  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"]
@@ -24,11 +24,11 @@ Gem::Specification.new do |s|
24
24
  s.specification_version = 3
25
25
 
26
26
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_runtime_dependency(%q<thrift>, ["~> 0.2.0"])
27
+ s.add_runtime_dependency(%q<thrift>, ["~> 0.5.0"])
28
28
  else
29
- s.add_dependency(%q<thrift>, ["~> 0.2.0"])
29
+ s.add_dependency(%q<thrift>, ["~> 0.5.0"])
30
30
  end
31
31
  else
32
- s.add_dependency(%q<thrift>, ["~> 0.2.0"])
32
+ s.add_dependency(%q<thrift>, ["~> 0.5.0"])
33
33
  end
34
34
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thrift_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
8
+ - 6
9
9
  - 0
10
- version: 0.5.0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Evan Weaver, Ryan King, Jeff Hodges
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-22 00:00:00 -07:00
18
+ date: 2010-12-08 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 23
29
+ hash: 11
30
30
  segments:
31
31
  - 0
32
- - 2
32
+ - 5
33
33
  - 0
34
- version: 0.2.0
34
+ version: 0.5.0
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  description: A Thrift client wrapper that encapsulates some common failover behavior.