cassandra 0.11.2 → 0.11.3
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.
- data/CHANGELOG +3 -0
- data/cassandra.gemspec +2 -2
- data/lib/cassandra/cassandra.rb +16 -4
- metadata +4 -4
data/CHANGELOG
CHANGED
data/cassandra.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{cassandra}
|
5
|
-
s.version = "0.11.
|
5
|
+
s.version = "0.11.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = [%q{Evan Weaver, Ryan King}]
|
9
|
-
s.date = %q{2011-
|
9
|
+
s.date = %q{2011-07-05}
|
10
10
|
s.description = %q{A Ruby client for the Cassandra distributed database.}
|
11
11
|
s.email = %q{}
|
12
12
|
s.executables = [%q{cassandra_helper}]
|
data/lib/cassandra/cassandra.rb
CHANGED
@@ -116,9 +116,15 @@ class Cassandra
|
|
116
116
|
# * password
|
117
117
|
#
|
118
118
|
def login!(username, password)
|
119
|
-
|
120
|
-
|
121
|
-
client.login(
|
119
|
+
request = CassandraThrift::AuthenticationRequest.new
|
120
|
+
request.credentials = {'username' => username, 'password' => password}
|
121
|
+
ret = client.login(request)
|
122
|
+
|
123
|
+
# To avoid a double login on the initial connect, we set
|
124
|
+
# @auth_request after the first successful login.
|
125
|
+
#
|
126
|
+
@auth_request = request
|
127
|
+
ret
|
122
128
|
end
|
123
129
|
|
124
130
|
def inspect
|
@@ -1007,7 +1013,6 @@ class Cassandra
|
|
1007
1013
|
def client
|
1008
1014
|
if @client.nil? || @client.current_server.nil?
|
1009
1015
|
reconnect!
|
1010
|
-
@client.set_keyspace(@keyspace)
|
1011
1016
|
end
|
1012
1017
|
@client
|
1013
1018
|
end
|
@@ -1015,6 +1020,13 @@ class Cassandra
|
|
1015
1020
|
def reconnect!
|
1016
1021
|
@servers = all_nodes
|
1017
1022
|
@client = new_client
|
1023
|
+
@client.add_callback :post_connect do |cli|
|
1024
|
+
# Set the active keyspace after connecting
|
1025
|
+
cli.set_keyspace(@keyspace)
|
1026
|
+
|
1027
|
+
# If using an authenticated keyspace, ensure we relogin
|
1028
|
+
cli.login(@auth_request) if @auth_request
|
1029
|
+
end
|
1018
1030
|
end
|
1019
1031
|
|
1020
1032
|
def all_nodes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cassandra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 11
|
9
|
-
-
|
10
|
-
version: 0.11.
|
9
|
+
- 3
|
10
|
+
version: 0.11.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Evan Weaver, Ryan King
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-05 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: thrift_client
|