conveyor 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.2.2 / 2008-04-10
2
+ * make sure that an empty channel still has @last_id set
3
+ * switch back to mongrel. too many problems with event machine on solaris
4
+ * add logging for 404s. should probably switch this to a rack middleware
5
+ * adding a verbose mode, that dumps debug output to stdout
6
+
1
7
  == 0.2.1 / 2008-02-29
2
8
  * added get by timestamp and rewind to timestamp (for groups, too)
3
9
 
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ Hoe.new('conveyor', Conveyor::VERSION) do |p|
9
9
  p.author = 'Ryan King'
10
10
  p.email = 'ryan@theryanking.com'
11
11
  p.remote_rdoc_dir = ''
12
- p.extra_deps << ['thin']
12
+ p.extra_deps << ['mongrel']
13
13
  p.extra_deps << ['json']
14
14
  p.extra_deps << ['daemons']
15
15
  end
data/bin/conveyor CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'optparse'
4
4
  require 'rubygems'
5
5
  require 'daemons/daemonize'
6
- require 'thin'
6
+ require 'rack'
7
7
 
8
8
  options = {:port => 8011, :daemonize => false}
9
9
  opts = OptionParser.new do |opts|
@@ -27,6 +27,10 @@ opts = OptionParser.new do |opts|
27
27
  opts.on("--unsafe", "Unsafe Mode.") do |d|
28
28
  options[:unsafe] = d
29
29
  end
30
+
31
+ opts.on("--verbose", "Verbose mode. For debugging only.") do |d|
32
+ options[:verbose] = d
33
+ end
30
34
  end
31
35
 
32
36
  opts.parse!
@@ -44,9 +48,13 @@ if options[:daemonize]
44
48
  Daemonize.daemonize
45
49
  end
46
50
 
47
- Thin::Server.start('0.0.0.0', options[:port]) do
51
+ app = Rack::Builder.new do
48
52
  map '/channels' do
49
- run Conveyor::App.new(ARGV[0], :log_directory => options[:log_directory], :unsafe_mode => options[:unsafe])
53
+ run Conveyor::App.new(ARGV[0],
54
+ :log_directory => options[:log_directory],
55
+ :unsafe_mode => options[:unsafe],
56
+ :verbose => options[:verbose])
50
57
  end
51
58
  end
52
59
 
60
+ Rack::Handler::Mongrel.run(app, {:Host => '0.0.0.0', :Port => options[:port]})
data/bin/conveyor-upgrade CHANGED
File without changes
data/lib/conveyor.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Conveyor
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  QUALITY = 'alpha'
4
4
  end
@@ -186,6 +186,7 @@ module Conveyor
186
186
 
187
187
  @index_file = File.open(index_path, 'r+')
188
188
 
189
+ @last_id = 0
189
190
  @index_file.each_line do |line|
190
191
  @index << parse_headers(line.strip, true)
191
192
  @last_id = @index.last[:id]
@@ -43,7 +43,7 @@ module Conveyor
43
43
  r = nil
44
44
  group_iterator_lock(group) do
45
45
  @group_iterators[group] = 1 unless @group_iterators.key?(group)
46
- if @iterator <= @last_id
46
+ if @group_iterators[group] <= @last_id
47
47
  r = get(@group_iterators[group])
48
48
  @group_iterators[group] += 1
49
49
  group_iterators_file(group) do |f|
@@ -4,6 +4,7 @@ require 'conveyor/channel'
4
4
  require 'fileutils'
5
5
  require 'json'
6
6
  require 'logger'
7
+ require 'pp'
7
8
 
8
9
  module Conveyor
9
10
  class App
@@ -12,6 +13,7 @@ module Conveyor
12
13
  @data_directory = data_directory
13
14
  @log_directory = options[:log_directory]
14
15
  @unsafe_mode = options[:unsafe_mode] # allows deleting of channels. REALLY UNSAFE!
16
+ @verbose = options[:verbose]
15
17
 
16
18
  if @log_directory
17
19
  @logger = Logger.new File.join(@log_directory, 'conveyor.log')
@@ -90,6 +92,7 @@ module Conveyor
90
92
  create_new_channel(m.captures[0])
91
93
  post(env, m)
92
94
  else
95
+ i "#{env["REMOTE_ADDR"]} #{env["REQUEST_METHOD"]} #{env["REQUEST_PATH"]} 404"
93
96
  [404, {}, '']
94
97
  end
95
98
  end
@@ -145,6 +148,7 @@ module Conveyor
145
148
  return [200, {}, list.to_json]
146
149
  end
147
150
 
151
+ i "#{env["REMOTE_ADDR"]} #{env["REQUEST_METHOD"]} #{env["REQUEST_PATH"]} 404"
148
152
  return [404, {}, '']
149
153
  end
150
154
 
@@ -157,6 +161,9 @@ module Conveyor
157
161
  end
158
162
 
159
163
  def call(env)
164
+ if @verbose
165
+ pp env
166
+ end
160
167
  @requests += 1
161
168
  if env['REQUEST_METHOD'] == 'PUT' && m = path_match(env, %r{/channels/(.*)})
162
169
  put(env, m)
@@ -167,6 +174,7 @@ module Conveyor
167
174
  elsif env['REQUEST_METHOD'] == 'GET'
168
175
  get(env)
169
176
  else
177
+ i "#{env["REMOTE_ADDR"]} #{env["REQUEST_METHOD"]} #{env["REQUEST_PATH"]} 404"
170
178
  [404, {}, '']
171
179
  end
172
180
  end
@@ -1,6 +1,7 @@
1
1
  require "test/unit"
2
2
  require 'fileutils'
3
3
  require "conveyor/replicated_channel"
4
+ require 'priority_queue'
4
5
 
5
6
  class TestReplicatedChannel < Test::Unit::TestCase
6
7
  def test_basic
data/test/test_server.rb CHANGED
@@ -2,7 +2,7 @@ require "test/unit"
2
2
  require "conveyor/server"
3
3
  require 'net/http'
4
4
  require 'conveyor/client'
5
- require 'thin'
5
+ require 'rack'
6
6
 
7
7
  class TestConveyorServer < Test::Unit::TestCase
8
8
  include Conveyor
@@ -11,12 +11,14 @@ class TestConveyorServer < Test::Unit::TestCase
11
11
  FileUtils.mkdir('/tmp/asdf')
12
12
 
13
13
  Thread.start do
14
- Thin::Server.start('0.0.0.0', 8011) do
14
+ app = Rack::Builder.new do
15
15
  map '/channels' do
16
- run Conveyor::App.new('/tmp/asdf', :unsafe_mode => true)
16
+ run Conveyor::App.new('/tmp/asdf', :unsafe_mode => true)
17
17
  end
18
18
  end
19
- end
19
+
20
+ Rack::Handler::Mongrel.run(app, :Host => '0.0.0.0', :Port => 8011)
21
+ end
20
22
 
21
23
  def test_channels
22
24
  Net::HTTP.start("localhost", 8011) do |h|
@@ -148,7 +150,7 @@ class TestConveyorServer < Test::Unit::TestCase
148
150
 
149
151
  assert_kind_of Net::HTTPNotFound, req
150
152
 
151
- req = h.post("/channels/#{chan}?rewind_id=1", nil)
153
+ req = h.post("/channels/#{chan}?rewind_id=1", nil, {'Content-Type' => 'application/octet-stream'})
152
154
  assert_kind_of Net::HTTPOK, req
153
155
 
154
156
  req = h.get("/channels/#{chan}?next")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conveyor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan King
@@ -30,11 +30,11 @@ cert_chain:
30
30
  Zls3y84CmyAEGg==
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2008-02-29 00:00:00 -08:00
33
+ date: 2008-04-10 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
- name: thin
37
+ name: mongrel
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
@@ -67,7 +67,7 @@ dependencies:
67
67
  requirements:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: 1.5.0
70
+ version: 1.5.1
71
71
  version:
72
72
  description: "* Like TiVo for your data * A distributed rewindable multi-queue"
73
73
  email: ryan@theryanking.com
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements: []
126
126
 
127
127
  rubyforge_project: conveyor
128
- rubygems_version: 1.0.1
128
+ rubygems_version: 1.1.0
129
129
  signing_key:
130
130
  specification_version: 2
131
131
  summary: "* Like TiVo for your data * A distributed rewindable multi-queue"
metadata.gz.sig CHANGED
Binary file