cassandra 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +25 -2
- data/cassandra.gemspec +2 -2
- data/ext/cassandra_native.c +0 -0
- data/ext/extconf.rb +0 -0
- data/lib/cassandra/batch.rb +0 -0
- data/lib/cassandra/cassandra.rb +8 -7
- data/lib/cassandra/composite.rb +0 -0
- data/lib/cassandra/dynamic_composite.rb +0 -0
- data/lib/cassandra/protocol.rb +17 -0
- data/test/composite_type_test.rb +0 -0
- data/vendor/1.1/gen-rb/cassandra.rb +0 -0
- data/vendor/1.1/gen-rb/cassandra_constants.rb +0 -0
- data/vendor/1.1/gen-rb/cassandra_types.rb +0 -0
- metadata +97 -101
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
v0.17.0
|
2
|
+
- multi_get_columns with only one query (courtesy @christian-blades-cb)
|
3
|
+
- documentation fixes for get and multi_get (issue #136, courtesy @christian-blades-cb)
|
4
|
+
|
1
5
|
v0.16.0
|
2
6
|
- New :queue_size option for batch mode (courtesy @vicentllongo)
|
3
7
|
- Cassandra 1.1 support (courtesy @hawknewton)
|
data/Rakefile
CHANGED
@@ -78,18 +78,39 @@ def running?(pid_file = nil)
|
|
78
78
|
false
|
79
79
|
end
|
80
80
|
|
81
|
+
def listening?(host, port)
|
82
|
+
TCPSocket.new(host, port).close
|
83
|
+
true
|
84
|
+
rescue Errno::ECONNREFUSED => e
|
85
|
+
false
|
86
|
+
end
|
87
|
+
|
81
88
|
namespace :cassandra do
|
82
89
|
desc "Start Cassandra"
|
83
90
|
task :start, [:daemonize] => :java do |t, args|
|
84
91
|
args.with_defaults(:daemonize => true)
|
85
92
|
|
86
93
|
setup_cassandra_version
|
87
|
-
|
88
94
|
env = setup_environment
|
89
95
|
|
90
96
|
Dir.chdir(File.join(CASSANDRA_HOME, "cassandra-#{CASSANDRA_VERSION}")) do
|
91
97
|
sh("env #{env} bin/cassandra #{'-f' unless args.daemonize} -p #{CASSANDRA_PIDFILE}")
|
92
98
|
end
|
99
|
+
|
100
|
+
if args.daemonize
|
101
|
+
end_time = Time.now + 30
|
102
|
+
host = '127.0.0.1'
|
103
|
+
port = 9160
|
104
|
+
|
105
|
+
until Time.now >= end_time || listening?(host, port)
|
106
|
+
puts "waiting for 127.0.0.1:9160"
|
107
|
+
sleep 0.1
|
108
|
+
end
|
109
|
+
|
110
|
+
unless listening?(host, port)
|
111
|
+
raise "timed out waiting for cassandra to start"
|
112
|
+
end
|
113
|
+
end
|
93
114
|
end
|
94
115
|
|
95
116
|
desc "Stop Cassandra"
|
@@ -118,7 +139,9 @@ end
|
|
118
139
|
|
119
140
|
desc "Check Java version"
|
120
141
|
task :java do
|
121
|
-
|
142
|
+
is_java16 = `java -version 2>&1`.split("\n").first =~ /java version "1.6/
|
143
|
+
|
144
|
+
if ['0.6', '0.7'].include?(CASSANDRA_VERSION) && !java16
|
122
145
|
puts "You need to configure your environment for Java 1.6."
|
123
146
|
puts "If you're on OS X, just export the following environment variables:"
|
124
147
|
puts ' JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"'
|
data/cassandra.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "cassandra"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.17.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"]
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cassandra", "--main", "README.md"]
|
18
18
|
s.require_paths = ["lib", "ext"]
|
19
19
|
s.rubyforge_project = "cassandra"
|
20
|
-
s.rubygems_version = "1.8.
|
20
|
+
s.rubygems_version = "1.8.17"
|
21
21
|
s.summary = "A Ruby client for the Cassandra distributed database."
|
22
22
|
s.test_files = ["test/cassandra_client_test.rb", "test/cassandra_mock_test.rb", "test/cassandra_test.rb", "test/comparable_types_test.rb", "test/composite_type_test.rb", "test/eventmachine_test.rb", "test/ordered_hash_test.rb", "test/test_helper.rb"]
|
23
23
|
|
data/ext/cassandra_native.c
CHANGED
File without changes
|
data/ext/extconf.rb
CHANGED
File without changes
|
data/lib/cassandra/batch.rb
CHANGED
File without changes
|
data/lib/cassandra/cassandra.rb
CHANGED
@@ -570,9 +570,10 @@ class Cassandra
|
|
570
570
|
# * options - Valid options are:
|
571
571
|
# * :consistency - Uses the default read consistency if none specified.
|
572
572
|
#
|
573
|
-
|
574
|
-
|
575
|
-
|
573
|
+
def multi_get_columns(column_family, keys, *columns_and_options)
|
574
|
+
column_family, columns, sub_columns, options =
|
575
|
+
extract_and_validate_params(column_family, keys, columns_and_options, READ_DEFAULTS)
|
576
|
+
_multi_get_columns(column_family, keys, columns, sub_columns, options[:consistency])
|
576
577
|
end
|
577
578
|
|
578
579
|
##
|
@@ -582,8 +583,8 @@ class Cassandra
|
|
582
583
|
#
|
583
584
|
# * column_family - The column_family that you are inserting into.
|
584
585
|
# * key - The row key to insert.
|
585
|
-
# *
|
586
|
-
# *
|
586
|
+
# * column - Either a single super_column or single column.
|
587
|
+
# * sub_column - A single sub_column to select.
|
587
588
|
# * options - Valid options are:
|
588
589
|
# * :count - The number of columns requested to be returned.
|
589
590
|
# * :start - The starting value for selecting a range of columns.
|
@@ -607,8 +608,8 @@ class Cassandra
|
|
607
608
|
#
|
608
609
|
# * column_family - The column_family that you are inserting into.
|
609
610
|
# * keys - An array of keys to select.
|
610
|
-
# *
|
611
|
-
# *
|
611
|
+
# * column - Either a single super_column or a single column.
|
612
|
+
# * sub_column - A single ub_columns to select.
|
612
613
|
# * options - Valid options are:
|
613
614
|
# * :count - The number of columns requested to be returned.
|
614
615
|
# * :start - The starting value for selecting a range of columns.
|
data/lib/cassandra/composite.rb
CHANGED
File without changes
|
File without changes
|
data/lib/cassandra/protocol.rb
CHANGED
@@ -48,6 +48,23 @@ class Cassandra
|
|
48
48
|
klass = column_name_class(column_family)
|
49
49
|
(sub_columns || columns).map { |name| result[klass.new(name)] }
|
50
50
|
end
|
51
|
+
|
52
|
+
def _multi_get_columns(column_family, keys, columns, sub_columns, consistency)
|
53
|
+
result = if is_super(column_family) and sub_columns
|
54
|
+
predicate = CassandraThrift::SlicePredicate.new(:column_names => sub_columns)
|
55
|
+
column_parent = CassandraThrift::ColumnParent.new(
|
56
|
+
:column_family => column_family,
|
57
|
+
:super_column => columns.kind_of?(Array) ? columns[0] : columns )
|
58
|
+
multi_sub_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
|
59
|
+
else
|
60
|
+
predicate = CassandraThrift::SlicePredicate.new(:column_names => columns)
|
61
|
+
column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
|
62
|
+
multi_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
|
63
|
+
end
|
64
|
+
|
65
|
+
klass = column_name_class(column_family)
|
66
|
+
OrderedHash[result.keys.map { |key| [key, (sub_columns || columns).map { |column| result[key][klass.new(column)] }] }]
|
67
|
+
end
|
51
68
|
|
52
69
|
def _multiget(column_family, keys, column, sub_column, count, start, finish, reversed, consistency)
|
53
70
|
# Single values; count and range parameters have no effect
|
data/test/composite_type_test.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,109 +1,99 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: cassandra
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 17
|
8
|
+
- 0
|
9
|
+
version: 0.17.0
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Evan Weaver, Ryan King
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2012-09-26 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: thrift_client
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 0.7.0
|
22
|
-
- - <
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '0.9'
|
25
|
-
type: :runtime
|
26
22
|
prerelease: false
|
27
|
-
|
28
|
-
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.7.0
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
33
25
|
- - <
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
|
36
|
-
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 9
|
30
|
+
version: "0.9"
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
segments:
|
34
|
+
- 0
|
35
|
+
- 7
|
36
|
+
- 0
|
37
|
+
version: 0.7.0
|
44
38
|
type: :runtime
|
39
|
+
version_requirements: *id001
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: json
|
45
42
|
prerelease: false
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
name: rake
|
54
|
-
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
|
-
requirements:
|
57
|
-
- - ! '>='
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '0'
|
43
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
60
50
|
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: rake
|
61
54
|
prerelease: false
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
name: simple_uuid
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.2.0
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
76
62
|
type: :runtime
|
63
|
+
version_requirements: *id003
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: simple_uuid
|
77
66
|
prerelease: false
|
78
|
-
|
79
|
-
|
80
|
-
requirements:
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
81
69
|
- - ~>
|
82
|
-
- !ruby/object:Gem::Version
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
- 2
|
74
|
+
- 0
|
83
75
|
version: 0.2.0
|
84
|
-
|
76
|
+
type: :runtime
|
77
|
+
version_requirements: *id004
|
78
|
+
- !ruby/object:Gem::Dependency
|
85
79
|
name: echoe
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
|
-
requirements:
|
89
|
-
- - ! '>='
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '0'
|
92
|
-
type: :development
|
93
80
|
prerelease: false
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
type: :development
|
89
|
+
version_requirements: *id005
|
100
90
|
description: A Ruby client for the Cassandra distributed database.
|
101
|
-
email:
|
102
|
-
executables:
|
91
|
+
email: ""
|
92
|
+
executables:
|
103
93
|
- cassandra_helper
|
104
|
-
extensions:
|
94
|
+
extensions:
|
105
95
|
- ext/extconf.rb
|
106
|
-
extra_rdoc_files:
|
96
|
+
extra_rdoc_files:
|
107
97
|
- CHANGELOG
|
108
98
|
- LICENSE
|
109
99
|
- README.md
|
@@ -148,7 +138,7 @@ extra_rdoc_files:
|
|
148
138
|
- lib/cassandra/ordered_hash.rb
|
149
139
|
- lib/cassandra/protocol.rb
|
150
140
|
- lib/cassandra/time.rb
|
151
|
-
files:
|
141
|
+
files:
|
152
142
|
- CHANGELOG
|
153
143
|
- Gemfile
|
154
144
|
- LICENSE
|
@@ -244,38 +234,44 @@ files:
|
|
244
234
|
- vendor/1.1/gen-rb/cassandra_constants.rb
|
245
235
|
- vendor/1.1/gen-rb/cassandra_types.rb
|
246
236
|
- cassandra.gemspec
|
237
|
+
has_rdoc: true
|
247
238
|
homepage: http://github.com/twitter/cassandra
|
248
239
|
licenses: []
|
240
|
+
|
249
241
|
post_install_message:
|
250
|
-
rdoc_options:
|
242
|
+
rdoc_options:
|
251
243
|
- --line-numbers
|
252
244
|
- --inline-source
|
253
245
|
- --title
|
254
246
|
- Cassandra
|
255
247
|
- --main
|
256
248
|
- README.md
|
257
|
-
require_paths:
|
249
|
+
require_paths:
|
258
250
|
- lib
|
259
251
|
- ext
|
260
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
requirements:
|
269
|
-
- -
|
270
|
-
- !ruby/object:Gem::Version
|
271
|
-
|
252
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - ">="
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
segments:
|
257
|
+
- 0
|
258
|
+
version: "0"
|
259
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - ">="
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
segments:
|
264
|
+
- 0
|
265
|
+
- 8
|
266
|
+
version: "0.8"
|
272
267
|
requirements: []
|
268
|
+
|
273
269
|
rubyforge_project: cassandra
|
274
|
-
rubygems_version: 1.
|
270
|
+
rubygems_version: 1.3.6
|
275
271
|
signing_key:
|
276
272
|
specification_version: 3
|
277
273
|
summary: A Ruby client for the Cassandra distributed database.
|
278
|
-
test_files:
|
274
|
+
test_files:
|
279
275
|
- test/cassandra_client_test.rb
|
280
276
|
- test/cassandra_mock_test.rb
|
281
277
|
- test/cassandra_test.rb
|