arya-pandemic 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -21,5 +21,6 @@ lib/pandemic/util.rb
21
21
  lib/pandemic.rb
22
22
  Manifest
23
23
  MIT-LICENSE
24
+ pandemic.gemspec
24
25
  Rakefile
25
26
  README.markdown
@@ -1,7 +1,7 @@
1
1
  # Pandemic
2
- Pandemic is a map-reduce framework. You give it the map, process, and reduce methods and it handles the rest. It's designed to serve requests in real-time, but can also be used for offline tasks.
2
+ Pandemic is a map-reduce-ish framework. It allows you to partition requests and distribute them as you please, then process the request (or parts of it) on any number of nodes, and then reduce the response however you please. It's designed to serve requests in real-time, but can also be used for offline tasks.
3
3
 
4
- It's different from the typical map-reduce framework in that it doesn't have a master-worker structure. Every node can map, process, and reduce. It also doesn't have the concept of jobs, everything is a request.
4
+ It's different from the typical map-reduce framework in that it doesn't have a master-worker structure. Every node does can do everything. It's actually not strictly a map-reduce framework, it's a bit more lenient on what you can do to your data/request other than map and reduce.
5
5
 
6
6
  The framework is designed to be as flexible as possible, there is no rigid request format, or API, you can specify it however you want. You can send it http-style headers and a body, you can send it JSON, or you can even just send it a single line and have it do whatever you want. The only requirement is that you write your handler to appropriately act on the request and return the response.
7
7
 
@@ -21,9 +21,9 @@ The framework is designed to be as flexible as possible, there is no rigid reque
21
21
  pandemic_server.handler = Handler # Pandemic will call the initializer once per process
22
22
  pandemic_server.start.join
23
23
 
24
- In this example, the handler doesn't define the map or reduce methods, and the defaults are used. The default for each is as follows:
24
+ In this example, the handler doesn't define the partition or reduce methods, and the defaults are used. The default for each is as follows:
25
25
 
26
- * map: Send the full request body to every connected node
26
+ * partition: Send the full request body to every connected node
27
27
  * process: Return the body (do nothing)
28
28
  * reduce: Concatenate all the responses
29
29
 
@@ -117,6 +117,8 @@ The servers are going to try to bind to localhost:4000 and localhost:4001 so mak
117
117
  By default, the handler runs in the same Ruby process as Pandemic. By setting the fork\_for\_processor to true in pandemic\_server.yml, you can have Pandemic fork to new processes to run the process method. This is particularly useful when your process method goes to MySQL which locks the entire process until MySQL returns.
118
118
 
119
119
  ## Change History
120
+ Version 0.3.1
121
+ * Changed map to partition to more accurately reflect what it does. This breaks backwards compatibility, but all you have to do is rename your method.
120
122
  Version 0.3.0
121
123
 
122
124
  * Pandemic can now fork to call the process method
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('pandemic', '0.3.0') do |p|
5
+ Echoe.new('pandemic', '0.3.1') do |p|
6
6
  p.description = "Distribute MapReduce to any of the workers and it will spread, like a pandemic."
7
7
  p.url = "https://github.com/arya/pandemic/"
8
8
  p.author = "Arya Asemanfar"
@@ -3,7 +3,7 @@ require 'pandemic'
3
3
  require 'json'
4
4
 
5
5
  class WordCounter < Pandemic::ServerSide::Handler
6
- def map(request, servers)
6
+ def partition(request, servers)
7
7
  # select only the alive servers (non-disconnected)
8
8
  only_alive = servers.keys.select{|k| servers[k] != :disconnected}
9
9
 
@@ -4,8 +4,8 @@ module Pandemic
4
4
  def config
5
5
  Config
6
6
  end
7
-
8
- def map(request, servers)
7
+
8
+ def partition(request, servers)
9
9
  map = {}
10
10
  servers.each do |server, status|
11
11
  if status != :disconnected
@@ -115,7 +115,7 @@ module Pandemic
115
115
 
116
116
  def handle_client_request(request)
117
117
  info("Handling client request")
118
- map = @handler_instance.map(request, connection_statuses)
118
+ map = @handler_instance.partition(request, connection_statuses)
119
119
  request.max_responses = map.size
120
120
  debug("Sending client request to #{map.size} handlers (#{request.hash})")
121
121
 
@@ -2,27 +2,26 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{pandemic}
5
- s.version = "0.3.0"
5
+ s.version = "0.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Arya Asemanfar"]
9
- s.date = %q{2009-05-27}
9
+ s.date = %q{2009-06-18}
10
10
  s.description = %q{Distribute MapReduce to any of the workers and it will spread, like a pandemic.}
11
11
  s.email = %q{aryaasemanfar@gmail.com}
12
12
  s.extra_rdoc_files = ["lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "README.markdown"]
13
- s.files = ["examples/client/client.rb", "examples/client/constitution.txt", "examples/client/pandemic_client.yml", "examples/server/pandemic_server.yml", "examples/server/word_count_server.rb", "lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "Manifest", "MIT-LICENSE", "Rakefile", "README.markdown", "pandemic.gemspec", "test/client_test.rb", "test/connection_pool_test.rb", "test/functional_test.rb", "test/handler_test.rb", "test/mutex_counter_test.rb", "test/peer_test.rb", "test/processor_test.rb", "test/server_test.rb", "test/test_helper.rb", "test/util_test.rb"]
14
- s.has_rdoc = true
13
+ s.files = ["examples/client/client.rb", "examples/client/constitution.txt", "examples/client/pandemic_client.yml", "examples/server/pandemic_server.yml", "examples/server/word_count_server.rb", "lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "Manifest", "MIT-LICENSE", "pandemic.gemspec", "Rakefile", "README.markdown", "test/client_test.rb", "test/connection_pool_test.rb", "test/functional_test.rb", "test/handler_test.rb", "test/mutex_counter_test.rb", "test/peer_test.rb", "test/processor_test.rb", "test/server_test.rb", "test/test_helper.rb", "test/util_test.rb"]
15
14
  s.homepage = %q{https://github.com/arya/pandemic/}
16
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Pandemic", "--main", "README.markdown"]
17
16
  s.require_paths = ["lib"]
18
17
  s.rubyforge_project = %q{pandemic}
19
- s.rubygems_version = %q{1.3.1}
18
+ s.rubygems_version = %q{1.3.4}
20
19
  s.summary = %q{Distribute MapReduce to any of the workers and it will spread, like a pandemic.}
21
20
  s.test_files = ["test/client_test.rb", "test/connection_pool_test.rb", "test/functional_test.rb", "test/handler_test.rb", "test/mutex_counter_test.rb", "test/peer_test.rb", "test/processor_test.rb", "test/server_test.rb", "test/test_helper.rb", "test/util_test.rb"]
22
21
 
23
22
  if s.respond_to? :specification_version then
24
23
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
- s.specification_version = 2
24
+ s.specification_version = 3
26
25
 
27
26
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
27
  s.add_development_dependency(%q<shoulda>, [">= 0"])
@@ -21,7 +21,7 @@ class HandlerTest < Test::Unit::TestCase
21
21
 
22
22
  should "map to all non-disconnected nodes" do
23
23
  @request.expects(:body).twice.returns("123")
24
- map = @handler.map(@request, @servers)
24
+ map = @handler.partition(@request, @servers)
25
25
  # see setup for @servers
26
26
  assert_equal 2, map.size
27
27
  assert_equal "123", map[1]
@@ -94,7 +94,7 @@ class ServerTest < Test::Unit::TestCase
94
94
  request = mock()
95
95
  request.expects(:hash).at_least_once.returns("abcddef134123")
96
96
  @peer.expects(:connected?).returns(true)
97
- handler.expects(:map).with(request, is_a(Hash)).returns({"localhost:4000" => "1", "localhost:4001" => "2"})
97
+ handler.expects(:partition).with(request, is_a(Hash)).returns({"localhost:4000" => "1", "localhost:4001" => "2"})
98
98
  request.expects(:max_responses=).with(2)
99
99
  @peer.expects(:client_request).with(request, "2")
100
100
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arya-pandemic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arya Asemanfar
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-27 00:00:00 -07:00
12
+ date: 2009-06-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -80,9 +80,9 @@ files:
80
80
  - lib/pandemic.rb
81
81
  - Manifest
82
82
  - MIT-LICENSE
83
+ - pandemic.gemspec
83
84
  - Rakefile
84
85
  - README.markdown
85
- - pandemic.gemspec
86
86
  - test/client_test.rb
87
87
  - test/connection_pool_test.rb
88
88
  - test/functional_test.rb
@@ -93,7 +93,7 @@ files:
93
93
  - test/server_test.rb
94
94
  - test/test_helper.rb
95
95
  - test/util_test.rb
96
- has_rdoc: true
96
+ has_rdoc: false
97
97
  homepage: https://github.com/arya/pandemic/
98
98
  post_install_message:
99
99
  rdoc_options:
@@ -122,7 +122,7 @@ requirements: []
122
122
  rubyforge_project: pandemic
123
123
  rubygems_version: 1.2.0
124
124
  signing_key:
125
- specification_version: 2
125
+ specification_version: 3
126
126
  summary: Distribute MapReduce to any of the workers and it will spread, like a pandemic.
127
127
  test_files:
128
128
  - test/client_test.rb