eurydice 1.0.0-java → 1.0.1-java
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/.rvmrc +1 -1
- data/Rakefile +6 -0
- data/lib/cassandra.rb +11 -0
- data/lib/eurydice/pelops/keyspace.rb +9 -1
- data/lib/eurydice/version.rb +1 -1
- data/spec/eurydice/pelops/column_family_spec.rb +2 -1
- data/spec/eurydice/pelops/keyspace_spec.rb +5 -4
- metadata +52 -61
data/.rvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
rvm --create use jruby-1.6.
|
|
1
|
+
rvm --create use jruby-1.6.5@eurydice
|
data/Rakefile
ADDED
data/lib/cassandra.rb
CHANGED
|
@@ -45,6 +45,11 @@ module Cassandra
|
|
|
45
45
|
:lte => IndexOperator::LTE
|
|
46
46
|
}.freeze
|
|
47
47
|
|
|
48
|
+
LOCATOR_STRATEGY_CLASSES = {
|
|
49
|
+
:simple => 'org.apache.cassandra.locator.SimpleStrategy'.freeze,
|
|
50
|
+
:network_topology => 'org.apache.cassandra.locator.NetworkTopologyStrategy'.freeze
|
|
51
|
+
}.freeze
|
|
52
|
+
|
|
48
53
|
class KsDef
|
|
49
54
|
def self.from_h(h)
|
|
50
55
|
ks_def = h.reduce(self.new) do |ks_def, (field_name, field_value)|
|
|
@@ -78,6 +83,12 @@ module Cassandra
|
|
|
78
83
|
acc[field_name] = field_value
|
|
79
84
|
end
|
|
80
85
|
acc
|
|
86
|
+
end.tap do |h|
|
|
87
|
+
if h[:strategy_class] == LOCATOR_STRATEGY_CLASSES[:simple] || h[:strategy_class] == LOCATOR_STRATEGY_CLASSES[:network_topology]
|
|
88
|
+
h[:strategy_options].keys.each do |k|
|
|
89
|
+
h[:strategy_options][k] = h[:strategy_options][k].to_i
|
|
90
|
+
end
|
|
91
|
+
end
|
|
81
92
|
end
|
|
82
93
|
end
|
|
83
94
|
end
|
|
@@ -28,7 +28,10 @@ module Eurydice
|
|
|
28
28
|
|
|
29
29
|
def create!(options={})
|
|
30
30
|
thrift_exception_handler do
|
|
31
|
-
|
|
31
|
+
ks_properties = options.merge(:name => @name)
|
|
32
|
+
ks_properties[:strategy_class] = DEFAULT_STRATEGY_CLASS unless ks_properties.key?(:strategy_class)
|
|
33
|
+
ks_properties[:strategy_options] = DEFAULT_STRATEGY_OPTIONS if !ks_properties.key?(:strategy_options) && ks_properties[:strategy_class] == DEFAULT_STRATEGY_CLASS
|
|
34
|
+
ks_def = Cassandra::KsDef.from_h(ks_properties)
|
|
32
35
|
keyspace_manager.add_keyspace(ks_def)
|
|
33
36
|
@driver.add_pool(@pool_name, @cluster, @name)
|
|
34
37
|
end
|
|
@@ -70,6 +73,11 @@ module Eurydice
|
|
|
70
73
|
def column_family_manger
|
|
71
74
|
@column_family_manger ||= @driver.create_column_family_manager(@cluster, @name)
|
|
72
75
|
end
|
|
76
|
+
|
|
77
|
+
private
|
|
78
|
+
|
|
79
|
+
DEFAULT_STRATEGY_CLASS = Cassandra::LOCATOR_STRATEGY_CLASSES[:simple]
|
|
80
|
+
DEFAULT_STRATEGY_OPTIONS = {:replication_factor => 1}.freeze
|
|
73
81
|
end
|
|
74
82
|
end
|
|
75
83
|
end
|
data/lib/eurydice/version.rb
CHANGED
|
@@ -381,7 +381,8 @@ module Eurydice
|
|
|
381
381
|
it 'returns an Enumerator that yields each column in a row' do
|
|
382
382
|
row = {}
|
|
383
383
|
enum = @cf.each_column('ABC')
|
|
384
|
-
enum.each do |
|
|
384
|
+
enum.each do |pair|
|
|
385
|
+
k, v = *pair # JRuby 1.6.4 Enumerator#each does not splat the arguments
|
|
385
386
|
row[k] = v
|
|
386
387
|
end
|
|
387
388
|
row.should == Hash[('a'..'z').map { |a| [a, a.upcase] }]
|
|
@@ -26,14 +26,14 @@ module Eurydice
|
|
|
26
26
|
it 'creates a keyspace with specific strategy options' do
|
|
27
27
|
@keyspace = @cluster.keyspace(@keyspace_name, :create => false)
|
|
28
28
|
@keyspace.create!(:strategy_options => {:replication_factor => 2})
|
|
29
|
-
@keyspace.definition(true)[:strategy_options][:replication_factor].should ==
|
|
29
|
+
@keyspace.definition(true)[:strategy_options][:replication_factor].should == 2
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it 'creates a whole schema' do
|
|
33
33
|
@keyspace = @cluster.keyspace(@keyspace_name, :create => false)
|
|
34
34
|
@keyspace.create!(
|
|
35
35
|
:strategy_class => 'org.apache.cassandra.locator.NetworkTopologyStrategy',
|
|
36
|
-
:strategy_options => {:
|
|
36
|
+
:strategy_options => {:dc1 => 1, :dc2 => 2},
|
|
37
37
|
:column_families => {
|
|
38
38
|
'some_family' => {
|
|
39
39
|
:comparator_type => :ascii,
|
|
@@ -57,7 +57,7 @@ module Eurydice
|
|
|
57
57
|
)
|
|
58
58
|
definition = @keyspace.definition(true)
|
|
59
59
|
definition[:strategy_class].should == 'org.apache.cassandra.locator.NetworkTopologyStrategy'
|
|
60
|
-
definition[:strategy_options].should == {:
|
|
60
|
+
definition[:strategy_options].should == {:dc1 => 1, :dc2 => 2}
|
|
61
61
|
definition[:column_families]['some_family'][:comparator_type].should == 'org.apache.cassandra.db.marshal.AsciiType'
|
|
62
62
|
definition[:column_families]['some_family'][:comment].should == 'This is some family'
|
|
63
63
|
definition[:column_families]['another_family'][:comment].should == 'This is another family'
|
|
@@ -82,7 +82,8 @@ module Eurydice
|
|
|
82
82
|
@keyspace = @cluster.keyspace(@keyspace_name)
|
|
83
83
|
definition = @keyspace.definition
|
|
84
84
|
definition[:name].should == @keyspace_name
|
|
85
|
-
definition[:strategy_class].should == 'org.apache.cassandra.locator.
|
|
85
|
+
definition[:strategy_class].should == 'org.apache.cassandra.locator.SimpleStrategy'
|
|
86
|
+
definition[:strategy_options].should == {:replication_factor => 1}
|
|
86
87
|
end
|
|
87
88
|
end
|
|
88
89
|
end
|
metadata
CHANGED
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eurydice
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
prerelease:
|
|
5
|
-
|
|
6
|
-
- 1
|
|
7
|
-
- 0
|
|
8
|
-
- 0
|
|
9
|
-
version: 1.0.0
|
|
4
|
+
prerelease:
|
|
5
|
+
version: 1.0.1
|
|
10
6
|
platform: java
|
|
11
7
|
authors:
|
|
12
|
-
- Theo Hultberg
|
|
8
|
+
- Theo Hultberg
|
|
13
9
|
autorequire:
|
|
14
10
|
bindir: bin
|
|
15
11
|
cert_chain: []
|
|
16
12
|
|
|
17
|
-
date: 2011-
|
|
18
|
-
default_executable:
|
|
13
|
+
date: 2011-11-01 00:00:00 Z
|
|
19
14
|
dependencies:
|
|
20
|
-
- !ruby/object:Gem::Dependency
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
type: :runtime
|
|
32
|
-
version_requirements: *id001
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: pelops-jars
|
|
17
|
+
prerelease: false
|
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
19
|
+
none: false
|
|
20
|
+
requirements:
|
|
21
|
+
- - "="
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: "1.2"
|
|
24
|
+
type: :runtime
|
|
25
|
+
version_requirements: *id001
|
|
33
26
|
description: ""
|
|
34
27
|
email:
|
|
35
|
-
- theo@burtcorp.com
|
|
28
|
+
- theo@burtcorp.com
|
|
36
29
|
executables: []
|
|
37
30
|
|
|
38
31
|
extensions: []
|
|
@@ -40,32 +33,32 @@ extensions: []
|
|
|
40
33
|
extra_rdoc_files: []
|
|
41
34
|
|
|
42
35
|
files:
|
|
43
|
-
- .gitignore
|
|
44
|
-
- .rspec
|
|
45
|
-
- .rvmrc
|
|
46
|
-
- Gemfile
|
|
47
|
-
- Gemfile.lock
|
|
48
|
-
- README.mdown
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
- examples/
|
|
52
|
-
- examples/
|
|
53
|
-
- examples/
|
|
54
|
-
- examples/
|
|
55
|
-
- examples/
|
|
56
|
-
- examples/
|
|
57
|
-
-
|
|
58
|
-
- lib/
|
|
59
|
-
- lib/eurydice
|
|
60
|
-
- lib/eurydice/pelops
|
|
61
|
-
- lib/eurydice/pelops/
|
|
62
|
-
- lib/eurydice/pelops/
|
|
63
|
-
- lib/eurydice/
|
|
64
|
-
-
|
|
65
|
-
- spec/eurydice/pelops/
|
|
66
|
-
- spec/eurydice/pelops/
|
|
67
|
-
- spec/
|
|
68
|
-
|
|
36
|
+
- .gitignore
|
|
37
|
+
- .rspec
|
|
38
|
+
- .rvmrc
|
|
39
|
+
- Gemfile
|
|
40
|
+
- Gemfile.lock
|
|
41
|
+
- README.mdown
|
|
42
|
+
- Rakefile
|
|
43
|
+
- eurydice.gemspec
|
|
44
|
+
- examples/01_connect.rb
|
|
45
|
+
- examples/02_create_keyspace.rb
|
|
46
|
+
- examples/03_create_column_family.rb
|
|
47
|
+
- examples/04_storing_data.rb
|
|
48
|
+
- examples/05_loading_data.rb
|
|
49
|
+
- examples/06_cluster_info.rb
|
|
50
|
+
- examples/common.rb
|
|
51
|
+
- lib/cassandra.rb
|
|
52
|
+
- lib/eurydice.rb
|
|
53
|
+
- lib/eurydice/pelops.rb
|
|
54
|
+
- lib/eurydice/pelops/cluster.rb
|
|
55
|
+
- lib/eurydice/pelops/column_family.rb
|
|
56
|
+
- lib/eurydice/pelops/keyspace.rb
|
|
57
|
+
- lib/eurydice/version.rb
|
|
58
|
+
- spec/eurydice/pelops/cluster_spec.rb
|
|
59
|
+
- spec/eurydice/pelops/column_family_spec.rb
|
|
60
|
+
- spec/eurydice/pelops/keyspace_spec.rb
|
|
61
|
+
- spec/spec_helper.rb
|
|
69
62
|
homepage: http://github.com/iconara/eurydice
|
|
70
63
|
licenses: []
|
|
71
64
|
|
|
@@ -73,25 +66,23 @@ post_install_message:
|
|
|
73
66
|
rdoc_options: []
|
|
74
67
|
|
|
75
68
|
require_paths:
|
|
76
|
-
- lib
|
|
69
|
+
- lib
|
|
77
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
none: false
|
|
78
72
|
requirements:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- 0
|
|
83
|
-
version: "0"
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: "0"
|
|
84
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
|
+
none: false
|
|
85
78
|
requirements:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
- 0
|
|
90
|
-
version: "0"
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: "0"
|
|
91
82
|
requirements: []
|
|
92
83
|
|
|
93
84
|
rubyforge_project: eurydice
|
|
94
|
-
rubygems_version: 1.
|
|
85
|
+
rubygems_version: 1.8.9
|
|
95
86
|
signing_key:
|
|
96
87
|
specification_version: 3
|
|
97
88
|
summary: Ruby wrapper for the Pelops library
|