dcell 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.travis.yml +4 -1
  2. data/CHANGES.md +11 -0
  3. data/Gemfile +6 -3
  4. data/LICENSE.txt +1 -1
  5. data/README.md +27 -243
  6. data/benchmarks/receiver.rb +2 -2
  7. data/dcell.gemspec +7 -7
  8. data/explorer/css/bootstrap-responsive.css +686 -0
  9. data/explorer/css/bootstrap-responsive.min.css +12 -0
  10. data/explorer/css/bootstrap.css +3990 -0
  11. data/explorer/css/bootstrap.min.css +689 -0
  12. data/explorer/css/explorer.css +28 -0
  13. data/explorer/ico/favicon.ico +0 -0
  14. data/explorer/img/glyphicons-halflings-white.png +0 -0
  15. data/explorer/img/glyphicons-halflings.png +0 -0
  16. data/explorer/img/logo.png +0 -0
  17. data/explorer/index.html.erb +94 -0
  18. data/explorer/js/bootstrap.js +1726 -0
  19. data/explorer/js/bootstrap.min.js +6 -0
  20. data/lib/dcell.rb +27 -2
  21. data/lib/dcell/celluloid_ext.rb +14 -3
  22. data/lib/dcell/directory.rb +15 -3
  23. data/lib/dcell/explorer.rb +76 -0
  24. data/lib/dcell/future_proxy.rb +32 -0
  25. data/lib/dcell/info_service.rb +117 -0
  26. data/lib/dcell/mailbox_proxy.rb +6 -7
  27. data/lib/dcell/messages.rb +5 -6
  28. data/lib/dcell/node.rb +25 -55
  29. data/lib/dcell/node_manager.rb +81 -0
  30. data/lib/dcell/registries/cassandra_adapter.rb +86 -0
  31. data/lib/dcell/registries/gossip/core.rb +235 -0
  32. data/lib/dcell/registries/gossip_adapter.rb +26 -0
  33. data/lib/dcell/registries/moneta_adapter.rb +0 -7
  34. data/lib/dcell/registries/redis_adapter.rb +0 -31
  35. data/lib/dcell/registries/zk_adapter.rb +1 -39
  36. data/lib/dcell/router.rb +37 -30
  37. data/lib/dcell/rpc.rb +23 -23
  38. data/lib/dcell/server.rb +5 -2
  39. data/lib/dcell/version.rb +1 -1
  40. data/logo.png +0 -0
  41. data/spec/dcell/actor_proxy_spec.rb +4 -0
  42. data/spec/dcell/celluloid_ext_spec.rb +11 -0
  43. data/spec/dcell/directory_spec.rb +1 -1
  44. data/spec/dcell/explorer_spec.rb +17 -0
  45. data/spec/dcell/global_spec.rb +4 -0
  46. data/spec/dcell/registries/gossip_adapter_spec.rb +6 -0
  47. data/spec/spec_helper.rb +14 -7
  48. data/spec/support/registry_examples.rb +0 -18
  49. data/tasks/cassandra.task +84 -0
  50. metadata +55 -35
  51. data/celluloid-zmq/.gitignore +0 -17
  52. data/celluloid-zmq/.rspec +0 -4
  53. data/celluloid-zmq/CHANGES.md +0 -31
  54. data/celluloid-zmq/Gemfile +0 -7
  55. data/celluloid-zmq/README.md +0 -56
  56. data/celluloid-zmq/Rakefile +0 -7
  57. data/celluloid-zmq/celluloid-zmq.gemspec +0 -28
  58. data/celluloid-zmq/lib/celluloid/zmq.rb +0 -36
  59. data/celluloid-zmq/lib/celluloid/zmq/reactor.rb +0 -90
  60. data/celluloid-zmq/lib/celluloid/zmq/sockets.rb +0 -130
  61. data/celluloid-zmq/lib/celluloid/zmq/version.rb +0 -5
  62. data/celluloid-zmq/lib/celluloid/zmq/waker.rb +0 -55
  63. data/celluloid-zmq/spec/celluloid/zmq/actor_spec.rb +0 -6
  64. data/celluloid-zmq/spec/spec_helper.rb +0 -2
@@ -0,0 +1,84 @@
1
+ require 'rake/clean'
2
+
3
+ namespace :cassandra do
4
+ CASS_VERSION = "1.0.8"
5
+ CASS_TARBALL = "apache-cassandra-#{CASS_VERSION}-bin.tar.gz"
6
+ CASS_MD5 = "676887f6d185689c3383908f3ad8e015"
7
+
8
+ task :download => "tmp/#{CASS_TARBALL}"
9
+ directory 'tmp'
10
+
11
+ file "tmp/#{CASS_TARBALL}" => "tmp" do
12
+ require 'digest/md5'
13
+ tarball = "tmp/#{CASS_TARBALL}"
14
+
15
+ puts "*** Downloading Cassandra"
16
+ sh "curl http://archive.apache.org/dist/cassandra/#{CASS_VERSION}/#{CASS_TARBALL} -o #{tarball}"
17
+ digest = Digest::MD5.hexdigest(File.read(tarball))
18
+ unless digest == CASS_MD5
19
+ rm tarball
20
+ raise "Expected MD5 #{CASS_MD5} but got #{digest}."
21
+ end
22
+ end
23
+
24
+ task :install => :download do
25
+ require 'yaml'
26
+ puts "*** Unpacking Cassandra"
27
+
28
+ rm_rf "cassandra" if File.exists? "cassandra"
29
+ sh "tar -zxvf tmp/#{CASS_TARBALL}"
30
+ mv "apache-cassandra-#{CASS_VERSION}", "cassandra"
31
+ home = File.expand_path("../../cassandra", __FILE__)
32
+
33
+ # Create base configuration
34
+ data = File.join(home, "data").encode("us-ascii")
35
+ mkdir_p data
36
+ commit = File.join(home, "commit").encode("us-ascii")
37
+ mkdir_p commit
38
+ caches = File.join(home, "caches").encode("us-ascii")
39
+ mkdir_p caches
40
+ config_file = File.join(home, "conf", "cassandra.yaml")
41
+ env_file = File.join(home, "conf", "cassandra-env.sh")
42
+
43
+ conf = YAML::load_file(config_file)
44
+ conf.merge!({
45
+ "initial_token" => 0,
46
+ "partitioner" => "org.apache.cassandra.dht.RandomPartitioner",
47
+ "data_file_directories" => [data],
48
+ "commitlog_directory" => commit,
49
+ "saved_caches_directory" => caches,
50
+ "storage_port" => 27000,
51
+ "ssl_storage_port" => 27001,
52
+ "listen_address" => "127.0.0.1",
53
+ "rpc_address" => "127.0.0.1",
54
+ "rpc_port" => 29160,
55
+ # DSE doesn't work OOTB as a single node unless you switch to simplesnitch
56
+ "endpoint_snitch" => "org.apache.cassandra.locator.SimpleSnitch",
57
+ })
58
+ File.open(config_file, "w") { |file| file.puts YAML::dump(conf) }
59
+
60
+ env = File.read(env_file)
61
+ env.sub!(/JMX_PORT=['"]?\d+['"]?/, 'JMX_PORT="27199"')
62
+ File.open(env_file, "w") { |file| file.puts env }
63
+ end
64
+
65
+ task :start => :cassandra do
66
+ puts "*** Starting Cassandra"
67
+
68
+ # adding the -Dcassandra.for=dcell makes it easier to kill the right
69
+ # cassandra if you're running more than one, e.g. pkill -f dcell
70
+ # or DTRT and kill $(< cassandra/cassandra.pid)
71
+ sh "cd cassandra && bin/cassandra -p cassandra.pid -Dcassandra.for=dcell"
72
+ puts "*** waiting for Cassandra to come up before creating schema ..."
73
+ sleep 2
74
+ puts "*** creating schema ..."
75
+ sh "echo 'create keyspace dcell;' | cassandra/bin/cassandra-cli -h 127.0.0.1 -p 29160"
76
+ sh "echo 'create column family dcell;' | cassandra/bin/cassandra-cli -h 127.0.0.1 -p 29160 -k dcell"
77
+ end
78
+ end
79
+
80
+ file 'cassandra' do
81
+ Rake::Task['cassandra:install'].invoke
82
+ end
83
+
84
+ CLEAN.include "tmp", "cassandra"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dcell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,33 +9,44 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-21 00:00:00.000000000 Z
12
+ date: 2012-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: celluloid
16
- requirement: &70186417956180 !ruby/object:Gem::Requirement
16
+ requirement: &70253692964560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.9.0
21
+ version: 0.10.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70186417956180
24
+ version_requirements: *70253692964560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: celluloid-zmq
27
- requirement: &70186417955420 !ruby/object:Gem::Requirement
27
+ requirement: &70253692964060 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 0.9.0
32
+ version: 0.10.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70186417955420
35
+ version_requirements: *70253692964060
36
+ - !ruby/object:Gem::Dependency
37
+ name: reel
38
+ requirement: &70253692963600 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.0.1
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70253692963600
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: redis
38
- requirement: &70186417954800 !ruby/object:Gem::Requirement
49
+ requirement: &70253692963220 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: '0'
44
55
  type: :runtime
45
56
  prerelease: false
46
- version_requirements: *70186417954800
57
+ version_requirements: *70253692963220
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: redis-namespace
49
- requirement: &70186417954340 !ruby/object:Gem::Requirement
60
+ requirement: &70253692962760 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: '0'
55
66
  type: :runtime
56
67
  prerelease: false
57
- version_requirements: *70186417954340
68
+ version_requirements: *70253692962760
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: moneta
60
- requirement: &70186418040120 !ruby/object:Gem::Requirement
71
+ requirement: &70253692962280 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: '0'
66
77
  type: :runtime
67
78
  prerelease: false
68
- version_requirements: *70186418040120
79
+ version_requirements: *70253692962280
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: rake
71
- requirement: &70186418039640 !ruby/object:Gem::Requirement
82
+ requirement: &70253692961860 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '0'
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *70186418039640
90
+ version_requirements: *70253692961860
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: rspec
82
- requirement: &70186418039200 !ruby/object:Gem::Requirement
93
+ requirement: &70253692961300 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,7 +98,7 @@ dependencies:
87
98
  version: '0'
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *70186418039200
101
+ version_requirements: *70253692961300
91
102
  description: DCell is an distributed object framework based on Celluloid built on
92
103
  0MQ and Zookeeper
93
104
  email:
@@ -106,29 +117,34 @@ files:
106
117
  - Rakefile
107
118
  - benchmarks/messaging.rb
108
119
  - benchmarks/receiver.rb
109
- - celluloid-zmq/.gitignore
110
- - celluloid-zmq/.rspec
111
- - celluloid-zmq/CHANGES.md
112
- - celluloid-zmq/Gemfile
113
- - celluloid-zmq/README.md
114
- - celluloid-zmq/Rakefile
115
- - celluloid-zmq/celluloid-zmq.gemspec
116
- - celluloid-zmq/lib/celluloid/zmq.rb
117
- - celluloid-zmq/lib/celluloid/zmq/reactor.rb
118
- - celluloid-zmq/lib/celluloid/zmq/sockets.rb
119
- - celluloid-zmq/lib/celluloid/zmq/version.rb
120
- - celluloid-zmq/lib/celluloid/zmq/waker.rb
121
- - celluloid-zmq/spec/celluloid/zmq/actor_spec.rb
122
- - celluloid-zmq/spec/spec_helper.rb
123
120
  - dcell.gemspec
121
+ - explorer/css/bootstrap-responsive.css
122
+ - explorer/css/bootstrap-responsive.min.css
123
+ - explorer/css/bootstrap.css
124
+ - explorer/css/bootstrap.min.css
125
+ - explorer/css/explorer.css
126
+ - explorer/ico/favicon.ico
127
+ - explorer/img/glyphicons-halflings-white.png
128
+ - explorer/img/glyphicons-halflings.png
129
+ - explorer/img/logo.png
130
+ - explorer/index.html.erb
131
+ - explorer/js/bootstrap.js
132
+ - explorer/js/bootstrap.min.js
124
133
  - lib/dcell.rb
125
134
  - lib/dcell/actor_proxy.rb
126
135
  - lib/dcell/celluloid_ext.rb
127
136
  - lib/dcell/directory.rb
137
+ - lib/dcell/explorer.rb
138
+ - lib/dcell/future_proxy.rb
128
139
  - lib/dcell/global.rb
140
+ - lib/dcell/info_service.rb
129
141
  - lib/dcell/mailbox_proxy.rb
130
142
  - lib/dcell/messages.rb
131
143
  - lib/dcell/node.rb
144
+ - lib/dcell/node_manager.rb
145
+ - lib/dcell/registries/cassandra_adapter.rb
146
+ - lib/dcell/registries/gossip/core.rb
147
+ - lib/dcell/registries/gossip_adapter.rb
132
148
  - lib/dcell/registries/moneta_adapter.rb
133
149
  - lib/dcell/registries/redis_adapter.rb
134
150
  - lib/dcell/registries/zk_adapter.rb
@@ -142,8 +158,10 @@ files:
142
158
  - spec/dcell/actor_proxy_spec.rb
143
159
  - spec/dcell/celluloid_ext_spec.rb
144
160
  - spec/dcell/directory_spec.rb
161
+ - spec/dcell/explorer_spec.rb
145
162
  - spec/dcell/global_spec.rb
146
163
  - spec/dcell/node_spec.rb
164
+ - spec/dcell/registries/gossip_adapter_spec.rb
147
165
  - spec/dcell/registries/moneta_adapter_spec.rb
148
166
  - spec/dcell/registries/redis_adapter_spec.rb
149
167
  - spec/dcell/registries/zk_adapter_spec.rb
@@ -151,9 +169,10 @@ files:
151
169
  - spec/support/helpers.rb
152
170
  - spec/support/registry_examples.rb
153
171
  - spec/test_node.rb
172
+ - tasks/cassandra.task
154
173
  - tasks/rspec.task
155
174
  - tasks/zookeeper.task
156
- homepage: http://github.com/tarcieri/dcell
175
+ homepage: http://github.com/celluloid/dcell
157
176
  licenses: []
158
177
  post_install_message:
159
178
  rdoc_options: []
@@ -173,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
192
  version: '0'
174
193
  requirements: []
175
194
  rubyforge_project:
176
- rubygems_version: 1.8.10
195
+ rubygems_version: 1.8.17
177
196
  signing_key:
178
197
  specification_version: 3
179
198
  summary: An asynchronous distributed object framework based on Celluloid
@@ -181,8 +200,10 @@ test_files:
181
200
  - spec/dcell/actor_proxy_spec.rb
182
201
  - spec/dcell/celluloid_ext_spec.rb
183
202
  - spec/dcell/directory_spec.rb
203
+ - spec/dcell/explorer_spec.rb
184
204
  - spec/dcell/global_spec.rb
185
205
  - spec/dcell/node_spec.rb
206
+ - spec/dcell/registries/gossip_adapter_spec.rb
186
207
  - spec/dcell/registries/moneta_adapter_spec.rb
187
208
  - spec/dcell/registries/redis_adapter_spec.rb
188
209
  - spec/dcell/registries/zk_adapter_spec.rb
@@ -190,4 +211,3 @@ test_files:
190
211
  - spec/support/helpers.rb
191
212
  - spec/support/registry_examples.rb
192
213
  - spec/test_node.rb
193
- has_rdoc:
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
@@ -1,4 +0,0 @@
1
- --color
2
- --format documentation
3
- --backtrace
4
- --default_path spec
@@ -1,31 +0,0 @@
1
- 0.9.0
2
- -----
3
- * New 0MQ APIs which wrap ffi-rzmq's
4
- * Terminate the 0MQ context at shutdown
5
- * Use Celluloid::IO 0.9.0's reactor injection support so we no longer have to
6
- subclass Celluloid::IO::Mailbox
7
-
8
- 0.8.0
9
- -----
10
- * Update to match internals of celluloid-io
11
-
12
- 0.7.0
13
- -----
14
- * Use celluloid-io gem
15
- * Match versions with Celluloid
16
-
17
- 0.0.4
18
- -----
19
- * Fix bugs in 0MQ polling (timeouts were being processed 1000x too fast)
20
-
21
- 0.0.3
22
- -----
23
- * Fix botched dependencies (celluloid-zmq does not depend on redis)
24
-
25
- 0.0.2
26
- -----
27
- * Pure blocking 0MQ reactor using a ZMQ::PAIR socket as the waker
28
-
29
- 0.0.1
30
- -----
31
- * Initial release
@@ -1,7 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'celluloid', :git => 'git://github.com/tarcieri/celluloid'
4
- gem 'celluloid-io', :git => 'git://github.com/tarcieri/celluloid-io'
5
-
6
- # Specify your gem's dependencies in celluloid-zmq.gemspec
7
- gemspec
@@ -1,56 +0,0 @@
1
- Celluloid::ZMQ
2
- ==============
3
-
4
- This gem uses the ffi-rzmq library to provide Celluloid actors that can
5
- interact with 0MQ sockets.
6
-
7
- Celluloid::ZMQ provides two methods for multiplexing 0MQ sockets with
8
- receiving messages over Celluloid's actor protocol:
9
-
10
- * Celluloid::ZMQ#wait_readable(socket): wait until a message is available to
11
- read from the given 0MQ socket
12
- * Celluloid::ZMQ#wait_writeable(socket): waits until there's space in the
13
- given socket's message buffer to send another message
14
-
15
- Example Usage:
16
-
17
- require 'celluloid-zmq'
18
-
19
- ZMQ_CONTEXT = ZMQ::Context.new(1)
20
-
21
- class MyZmqCell
22
- include Celluloid::ZMQ
23
-
24
- def initialize(addr)
25
- @socket = ZMQ_CONTEXT.socket(ZMQ::PUSH)
26
-
27
- unless ZMQ::Util.resultcode_ok? @socket.connect addr
28
- @socket.close
29
- raise "error connecting to #{addr}: #{ZMQ::Util.error_string}"
30
- end
31
- end
32
-
33
- def write(message)
34
- wait_writeable @socket
35
- unless ZMQ::Util.resultcode_ok? @socket.send_string message
36
- raise "error sending 0MQ message: #{ZMQ::Util.error_string}"
37
- end
38
- end
39
-
40
- def read
41
- wait_readable @socket
42
- message = ''
43
-
44
- rc = @socket.recv_string message
45
- if ZMQ::Util.resultcode_ok? rc
46
- handle_message message
47
- else
48
- raise "error receiving ZMQ string: #{ZMQ::Util.error_string}"
49
- end
50
- end
51
- end
52
-
53
- Copyright
54
- ---------
55
-
56
- Copyright (c) 2011 Tony Arcieri. See LICENSE.txt for further details.
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env rake
2
- require 'bundler/gem_tasks'
3
- require 'rspec/core/rake_task'
4
-
5
- RSpec::Core::RakeTask.new
6
-
7
- task :default => :spec
@@ -1,28 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/celluloid/zmq/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Tony Arcieri"]
6
- gem.email = ["tony.arcieri@gmail.com"]
7
- gem.description = "Celluloid bindings to the ffi-rzmq library"
8
- gem.summary = "Celluloid::ZMQ provides concurrent Celluloid actors that can listen for 0MQ events"
9
- gem.homepage = "http://github.com/tarcieri/dcell"
10
-
11
- gem.name = "celluloid-zmq"
12
- gem.version = Celluloid::ZMQ::VERSION
13
-
14
- gem.add_dependency "celluloid", "~> 0.9.0"
15
- gem.add_dependency "celluloid-io", "~> 0.9.0"
16
- gem.add_dependency "ffi"
17
- gem.add_dependency "ffi-rzmq"
18
-
19
- gem.add_development_dependency "rake"
20
- gem.add_development_dependency "rspec"
21
-
22
- # Files
23
- ignores = File.read(".gitignore").split(/\r?\n/).reject{ |f| f =~ /^(#.+|\s*)$/ }.map {|f| Dir[f] }.flatten
24
- gem.files = (Dir['**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) }
25
- gem.test_files = (Dir['spec/**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) }
26
- # gem.executables = Dir['bin/*'].map { |f| File.basename(f) }
27
- gem.require_paths = ['lib']
28
- end