right_support 2.3.3 → 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/right_support/db/cassandra_model.rb +21 -30
- data/right_support.gemspec +1 -1
- metadata +3 -3
@@ -19,9 +19,11 @@
|
|
19
19
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
20
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
begin
|
23
|
-
require 'cassandra/0.8'
|
24
22
|
|
23
|
+
|
24
|
+
# If cassandra gem is installed and 0.8 bindings are available, apply some
|
25
|
+
# monkey patches.
|
26
|
+
if require_succeeds?('cassandra/0.8')
|
25
27
|
class Cassandra
|
26
28
|
module Protocol
|
27
29
|
# Monkey patch _get_indexed_slices so that it accepts list of columns when doing indexed
|
@@ -64,47 +66,36 @@ begin
|
|
64
66
|
key_slices.inject(OrderedHash.new){|h, key_slice| h[key_slice.key] = key_slice.columns; h}
|
65
67
|
end
|
66
68
|
end
|
67
|
-
|
68
|
-
rescue LoadError => e
|
69
|
-
# Make sure we're dealing with a legitimate missing-file LoadError
|
70
|
-
raise e unless e.message =~ /^no such file to load/
|
71
|
-
# Missing 'cassandra/0.8' indicates that the cassandra gem is not installed; we can ignore this
|
72
69
|
end
|
73
70
|
|
74
|
-
# monkey patch
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
71
|
+
# If thrift gem is available and we are running JRuby, monkey patch it so it
|
72
|
+
# works!
|
73
|
+
if (RUBY_PLATFORM =~ /java/) && require_succeeds?('thrift')
|
74
|
+
module Thrift
|
75
|
+
class Socket
|
76
|
+
def open
|
77
|
+
begin
|
78
|
+
addrinfo = ::Socket::getaddrinfo(@host, @port).first
|
79
|
+
@handle = ::Socket.new(addrinfo[4], ::Socket::SOCK_STREAM, 0)
|
80
|
+
sockaddr = ::Socket.sockaddr_in(addrinfo[1], addrinfo[3])
|
81
81
|
begin
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
@handle.connect_nonblock(sockaddr)
|
83
|
+
rescue Errno::EINPROGRESS
|
84
|
+
resp = IO.select(nil, [ @handle ], nil, @timeout) # 3 lines removed here, 1 line added
|
85
85
|
begin
|
86
86
|
@handle.connect_nonblock(sockaddr)
|
87
|
-
rescue Errno::
|
88
|
-
resp = IO.select(nil, [ @handle ], nil, @timeout) # 3 lines removed here, 1 line added
|
89
|
-
begin
|
90
|
-
@handle.connect_nonblock(sockaddr)
|
91
|
-
rescue Errno::EISCONN
|
92
|
-
end
|
87
|
+
rescue Errno::EISCONN
|
93
88
|
end
|
94
|
-
@handle
|
95
|
-
rescue StandardError => e
|
96
|
-
raise TransportException.new(TransportException::NOT_OPEN, "Could not connect to #{@desc}: #{e}")
|
97
89
|
end
|
90
|
+
@handle
|
91
|
+
rescue StandardError => e
|
92
|
+
raise TransportException.new(TransportException::NOT_OPEN, "Could not connect to #{@desc}: #{e}")
|
98
93
|
end
|
99
94
|
end
|
100
95
|
end
|
101
|
-
rescue LoadError => e
|
102
|
-
# Make sure we're dealing with a legitimate missing-file LoadError
|
103
|
-
raise e unless e.message =~ /^no such file to load/
|
104
96
|
end
|
105
97
|
end
|
106
98
|
|
107
|
-
|
108
99
|
module RightSupport::DB
|
109
100
|
# Exception that indicates database configuration info is missing.
|
110
101
|
class MissingConfiguration < Exception; end
|
data/right_support.gemspec
CHANGED
@@ -7,7 +7,7 @@ spec = Gem::Specification.new do |s|
|
|
7
7
|
s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
|
8
8
|
|
9
9
|
s.name = 'right_support'
|
10
|
-
s.version = '2.3.
|
10
|
+
s.version = '2.3.4'
|
11
11
|
s.date = '2012-08-23'
|
12
12
|
|
13
13
|
s.authors = ['Tony Spataro', 'Sergey Sergyenko', 'Ryan Williamson', 'Lee Kirchhoff', 'Sergey Enin']
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 4
|
10
|
+
version: 2.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tony Spataro
|