right_support 2.3.2 → 2.3.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/lib/right_support/db/cassandra_model.rb +55 -0
- data/right_support.gemspec +2 -2
- metadata +4 -4
@@ -313,6 +313,61 @@ module RightSupport::DB
|
|
313
313
|
rows
|
314
314
|
end
|
315
315
|
|
316
|
+
# This method is an attempt to circumvent the Cassandra gem limitation of returning only 100 columns for wide rows
|
317
|
+
# This method returns only columns that are within the result set specified by a secondary index equality query
|
318
|
+
# This method will iterate through chunks of rows of the resultset and it will yield to the caller all of the
|
319
|
+
# columns in chunks of 1,000 until all of the columns have been retrieved
|
320
|
+
#
|
321
|
+
# == Parameters:
|
322
|
+
# @param [String] index column name
|
323
|
+
# @param [String] index column value
|
324
|
+
#
|
325
|
+
# == Yields:
|
326
|
+
# @yield [Array<String, Array<CassandraThrift::ColumnOrSuperColumn>>] irray containing ndex column value passed in and an array of columns matching the index query
|
327
|
+
def stream_all_indexed_slices(index, key)
|
328
|
+
expr = do_op(:create_idx_expr, index, key, "EQ")
|
329
|
+
|
330
|
+
start_row = ''
|
331
|
+
row_count = 10
|
332
|
+
has_more_rows = true
|
333
|
+
|
334
|
+
while (start_row != nil)
|
335
|
+
clause = do_op(:create_idx_clause, [expr], start_row, row_count)
|
336
|
+
|
337
|
+
rows = self.conn.get_indexed_slices(column_family, clause, 'account_id',
|
338
|
+
:key_count => row_count, :key_start => start_row)
|
339
|
+
rows = rows.keys
|
340
|
+
rows.shift unless start_row == ''
|
341
|
+
start_row = rows.last
|
342
|
+
|
343
|
+
rows.each do |row|
|
344
|
+
start_column = ''
|
345
|
+
column_count = 1_000
|
346
|
+
has_more_columns = true
|
347
|
+
|
348
|
+
while has_more_columns
|
349
|
+
clause = do_op(:create_idx_clause, [expr], row, 1)
|
350
|
+
chunk = self.conn.get_indexed_slices(column_family, clause, nil,
|
351
|
+
:start => start_column,
|
352
|
+
:count => column_count)
|
353
|
+
|
354
|
+
key = chunk.keys.first
|
355
|
+
columns = chunk.values.first
|
356
|
+
columns.shift unless start_column == ''
|
357
|
+
yield(key, columns) unless chunk.empty?
|
358
|
+
|
359
|
+
if columns.size >= column_count - 1
|
360
|
+
#Assume there are more columns, use last column as start of next slice
|
361
|
+
start_column = columns.last.column.name
|
362
|
+
column_count = 1_001
|
363
|
+
else
|
364
|
+
has_more_columns = false
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
316
371
|
# Get all rows for specified secondary key
|
317
372
|
#
|
318
373
|
# === Parameters
|
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.3.
|
11
|
-
s.date = '2012-08-
|
10
|
+
s.version = '2.3.3'
|
11
|
+
s.date = '2012-08-23'
|
12
12
|
|
13
13
|
s.authors = ['Tony Spataro', 'Sergey Sergyenko', 'Ryan Williamson', 'Lee Kirchhoff', 'Sergey Enin']
|
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: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 3
|
10
|
+
version: 2.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tony Spataro
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2012-08-
|
22
|
+
date: 2012-08-23 00:00:00 -07:00
|
23
23
|
default_executable:
|
24
24
|
dependencies: []
|
25
25
|
|