right_support 2.6.10 → 2.6.11
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 +23 -5
- data/right_support.gemspec +2 -2
- metadata +4 -4
@@ -124,7 +124,7 @@ module RightSupport::DB
|
|
124
124
|
|
125
125
|
METHODS_TO_LOG = [:multi_get, :get, :get_indexed_slices, :get_columns, :insert, :remove, 'multi_get', 'get', 'get_indexed_slices', 'get_columns', 'insert', 'remove']
|
126
126
|
|
127
|
-
#
|
127
|
+
# Deprecate usage of CassandraModel under Ruby < 1.9
|
128
128
|
def inherited(base)
|
129
129
|
raise UnsupportedRubyVersion, "Support only Ruby >= 1.9" unless RUBY_VERSION >= "1.9"
|
130
130
|
end
|
@@ -144,20 +144,38 @@ module RightSupport::DB
|
|
144
144
|
@@config = normalize_config(value) unless value.nil?
|
145
145
|
end
|
146
146
|
|
147
|
-
#
|
147
|
+
# Compute the token for a given row key, which can provide information on the progress of very large
|
148
|
+
# "each" operations, e.g. iterating over all rows of a column family.
|
149
|
+
#
|
150
|
+
# @param [String] key byte-vector (binary String) representation of the row key
|
151
|
+
# @return [Integer] the 128-bit token for a given row key, as used by Cassandra's RandomPartitioner
|
152
|
+
def calculate_random_partitioner_token(key)
|
153
|
+
number = Digest::MD5.hexdigest(key).to_i(16)
|
154
|
+
|
155
|
+
if number >= (2**127)
|
156
|
+
# perform two's complement, basically this takes the absolute value of the number as
|
157
|
+
# if it were a 128-bit signed number. Equivalent to Java BigInteger.abs() operation.
|
158
|
+
result = (number ^ (2**128)-1) + 1
|
159
|
+
else
|
160
|
+
# we're good
|
161
|
+
result = number
|
162
|
+
end
|
163
|
+
|
164
|
+
result
|
165
|
+
end
|
166
|
+
|
167
|
+
# Return current keyspace names as Array of String (any keyspace that has been used this session).
|
148
168
|
#
|
149
169
|
# === Return
|
150
170
|
# (Array):: keyspaces names
|
151
|
-
|
152
171
|
def keyspaces
|
153
172
|
@@connections.keys
|
154
173
|
end
|
155
174
|
|
156
|
-
#
|
175
|
+
# Return current active keyspace.
|
157
176
|
#
|
158
177
|
# === Return
|
159
178
|
# keyspace(String):: current_keyspace or default_keyspace
|
160
|
-
|
161
179
|
def keyspace
|
162
180
|
@@current_keyspace || @@default_keyspace
|
163
181
|
end
|
data/right_support.gemspec
CHANGED
@@ -7,8 +7,8 @@ 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.6.
|
11
|
-
s.date = '2013-01-
|
10
|
+
s.version = '2.6.11'
|
11
|
+
s.date = '2013-01-02'
|
12
12
|
|
13
13
|
s.authors = ['Tony Spataro', 'Sergey Sergyenko', 'Ryan Williamson', 'Lee Kirchhoff', 'Sergey Enin', 'Alexey Karpik', 'Scott Messier']
|
14
14
|
s.email = 'support@rightscale.com'
|
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: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 2.6.
|
9
|
+
- 11
|
10
|
+
version: 2.6.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tony Spataro
|
@@ -21,7 +21,7 @@ autorequire:
|
|
21
21
|
bindir: bin
|
22
22
|
cert_chain: []
|
23
23
|
|
24
|
-
date: 2013-01-
|
24
|
+
date: 2013-01-02 00:00:00 -08:00
|
25
25
|
default_executable:
|
26
26
|
dependencies: []
|
27
27
|
|