regurgitator 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 540755c4ee64844a72e4785fe8f2e9afd44af42c
4
- data.tar.gz: 103abb8cade042a114d9f946ae8430cde845fda2
3
+ metadata.gz: e25137895b8a81aec30d1df214183867db1814e5
4
+ data.tar.gz: 64d515de854a2f3acfc53b7bd752abe0c71000f4
5
5
  SHA512:
6
- metadata.gz: 999e149f5b40e8790c29deb70d38f3cec6f182bcc2a7ca662748c250221c74553de230cff20440af1693bf078a5371f25db18ec0d56eb66e8dcb8abdd7ac4380
7
- data.tar.gz: b2ddaf77efd2e6c5ade2aab699af1a44efdf5c06f5527480ae51be5983b2727ab0b231384297289b1a7acce0f5fd846955369e7348ea66bf99a32961a50887a0
6
+ metadata.gz: e19aa4469529c3c1a4a4ac16212dd6594155c040017e56c0a0f092f92cd2777338e42e86c88f7bf687fac1d86224059725542291841384c935a1e53fa0706643
7
+ data.tar.gz: ca163773416ad27217eaaecab8e0ab8a3c39652397e0e317020772da23615a1178ccf994ea147c2f2ff7e237f771c457283b63097ce9263acb6ddbedd83a5daf
data/GIT-VERSION-FILE CHANGED
@@ -1 +1 @@
1
- GIT_VERSION = 0.7.0
1
+ GIT_VERSION = 0.8.0
data/GIT-VERSION-GEN CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v0.7.0
4
+ DEF_VER=v0.8.0
5
5
 
6
6
  LF='
7
7
  '
data/LATEST CHANGED
@@ -1,13 +1,14 @@
1
- === regurgitator 0.7.0 / 2016-06-11 22:57 UTC
2
-
3
- 8 changes since v0.6.0:
4
-
5
- update email address to point to me for now
6
- GNUmakefile: publish examples with website
7
- update documentation and packaging
8
- cleanup documentation on our homepage
9
- README: grammar fix
10
- README: use lowercase to match the gem name
11
- local_file: Content-Length is zero on 416 responses
12
- README: updates for HTTPS and new mailing list
1
+ === regurgitator 0.8.0 - modernizing to Rack 2.x / 2016-11-02 21:46 UTC
2
+
3
+ I don't think anybody cares or uses this project,
4
+ but we now require Rack 2+ and Ruby 2.1+.
5
+
6
+ 6 changes since 0.7.0:
7
+
8
+ pkg.mk: avoid network for "gem install"
9
+ use monotonic clock for time comparisons
10
+ gemspec: bump dependencies
11
+ local_file: avoid deprecated Rack::Utils.byte_ranges
12
+ reduce autoload footprint
13
+ fix loading regressions
13
14
 
data/NEWS CHANGED
@@ -1,3 +1,17 @@
1
+ === regurgitator 0.8.0 - modernizing to Rack 2.x / 2016-11-02 21:46 UTC
2
+
3
+ I don't think anybody cares or uses this project,
4
+ but we now require Rack 2+ and Ruby 2.1+.
5
+
6
+ 6 changes since 0.7.0:
7
+
8
+ pkg.mk: avoid network for "gem install"
9
+ use monotonic clock for time comparisons
10
+ gemspec: bump dependencies
11
+ local_file: avoid deprecated Rack::Utils.byte_ranges
12
+ reduce autoload footprint
13
+ fix loading regressions
14
+
1
15
  === regurgitator 0.7.0 / 2016-06-11 22:57 UTC
2
16
 
3
17
  8 changes since v0.6.0:
@@ -1,5 +1,8 @@
1
1
  # -*- encoding: binary -*-
2
2
  # helpers for device lookups
3
+
4
+ require_relative 'server_settings'
5
+
3
6
  module Regurgitator::Device # :nodoc:
4
7
  include Regurgitator::ServerSettings
5
8
 
@@ -14,9 +17,9 @@ module Regurgitator::Device # :nodoc:
14
17
 
15
18
  def device_init
16
19
  server_settings_init
17
- @device_cache_mtime = Time.at(0)
18
- @device_cache = nil
19
- @device_cache_lock = Mutex.new
20
+ @dev_cache_mtime = 0
21
+ @dev_cache = nil
22
+ @dev_cache_lock = Mutex.new
20
23
  end
21
24
 
22
25
  def self.extended(obj)
@@ -31,11 +34,11 @@ module Regurgitator::Device # :nodoc:
31
34
  # Returns a hash of device info with the Integer +devid+
32
35
  # as the hash key.
33
36
  def refresh_device(force = false) # :nodoc:
34
- @device_cache_lock.synchronize { refresh_device_unlocked(force) }
37
+ @dev_cache_lock.synchronize { refresh_device_unlocked(force) }
35
38
  end
36
39
 
37
40
  def refresh_device_unlocked(force) # :nodoc:
38
- return @device_cache if ! force && ((Time.now - @device_cache_mtime) < 60)
41
+ return @dev_cache if !force && ((Regurgitator.now - @dev_cache_mtime) < 60)
39
42
  tmp = {}.compare_by_identity
40
43
  refresh_zone(force)
41
44
  @db[REFRESH_DEVICE].each do |x|
@@ -52,7 +55,7 @@ module Regurgitator::Device # :nodoc:
52
55
  tmp[devid] = x
53
56
  end
54
57
  Regurgitator::Local.refresh_addrs!
55
- @device_cache_mtime = Time.now
56
- @device_cache = tmp
58
+ @dev_cache_mtime = Regurgitator.now
59
+ @dev_cache = tmp
57
60
  end
58
61
  end
@@ -6,7 +6,7 @@ module Regurgitator::Domain # :nodoc:
6
6
 
7
7
  def domain_init
8
8
  @domain_lock = Mutex.new
9
- @domain_cache_mtime = Time.at(0)
9
+ @domain_cache_mtime = 0
10
10
  @domain_cache = nil
11
11
  end
12
12
 
@@ -24,10 +24,10 @@ module Regurgitator::Domain # :nodoc:
24
24
  end
25
25
 
26
26
  def refresh_domain_unlocked # :nodoc:
27
- return @domain_cache if ((Time.now - @domain_cache_mtime) < 15)
27
+ return @domain_cache if ((Regurgitator.now - @domain_cache_mtime) < 15)
28
28
  tmp = {}
29
29
  @db[REFRESH_DOMAIN].each { |x| tmp[x[:namespace].freeze] = x[:dmid] }
30
- @domain_cache_mtime = Time.now
30
+ @domain_cache_mtime = Regurgitator.now
31
31
  @domain_cache = tmp
32
32
  end
33
33
  end
@@ -1,4 +1,5 @@
1
1
  # -*- encoding: binary -*-
2
+ require_relative 'endpoint'
2
3
 
3
4
  # Matches GET and HEAD requests in the format of ":domain.example.com/:dkey"
4
5
  # where domain is read from the Host: header.
@@ -1,4 +1,5 @@
1
1
  # -*- encoding: binary -*-
2
+ require_relative 'endpoint'
2
3
 
3
4
  # matches GET and HEAD requests in the format of "/:namespace/:dkey"
4
5
  # where +:dkey+ may contain multiple slashes
@@ -1,5 +1,9 @@
1
1
  # -*- encoding: binary -*-
2
2
  require "socket"
3
+ require_relative 'file_request'
4
+ require_relative 'file_info'
5
+ require_relative 'local'
6
+
3
7
  module Regurgitator::Endpoint # :nodoc:
4
8
  include Regurgitator::FileInfo
5
9
  include Rack::Utils
@@ -1,4 +1,8 @@
1
1
  # -*- encoding: binary -*-
2
+
3
+ require_relative 'domain'
4
+ require_relative 'device'
5
+
2
6
  module Regurgitator::FileInfo # :nodoc:
3
7
  include Regurgitator::Domain
4
8
  include Regurgitator::Device
@@ -1,4 +1,7 @@
1
1
  # -*- encoding: binary -*-
2
+
3
+ require_relative 'domain'
4
+
2
5
  module Regurgitator::ListKeys # :nodoc:
3
6
  include Regurgitator::Domain
4
7
 
@@ -1,6 +1,7 @@
1
1
  # -*- encoding: binary -*-
2
2
  require "socket"
3
3
  require "set"
4
+ require_relative 'local_file'
4
5
 
5
6
  module Regurgitator::Local # :nodoc:
6
7
 
@@ -28,7 +28,7 @@ class Regurgitator::LocalFile # :nodoc:
28
28
  }
29
29
  @response = [ 200, headers ]
30
30
 
31
- ranges = Rack::Utils.byte_ranges(env, size)
31
+ ranges = Rack::Utils.get_byte_ranges(env['HTTP_RANGE'], size)
32
32
  if nil == ranges || ranges.size > 1
33
33
  @range = nil
34
34
  elsif @range = ranges[0]
@@ -1,5 +1,7 @@
1
1
  # -*- encoding: binary -*-
2
2
 
3
+ require_relative 'endpoint'
4
+
3
5
  # matches GET and HEAD requests in the format of "/:dkey" from a
4
6
  # single, preconfigured domain.
5
7
  #
@@ -1,11 +1,13 @@
1
1
  # -*- encoding: binary -*-
2
2
  # helpers for server_settings lookups
3
+
4
+ require_relative 'local'
3
5
  module Regurgitator::ServerSettings # :nodoc:
4
6
 
5
7
  SETTINGS_LOOKUP = 'SELECT value FROM server_settings WHERE field = ? LIMIT 1'
6
8
 
7
9
  def server_settings_init
8
- @zone_cache_mtime = Time.at(0)
10
+ @zone_cache_mtime = 0
9
11
  @zone_cache = nil
10
12
  @zone_cache_lock = Mutex.new
11
13
  end
@@ -19,7 +21,7 @@ module Regurgitator::ServerSettings # :nodoc:
19
21
  end
20
22
 
21
23
  def refresh_zone_unlocked(force)
22
- return @zone_cache if ! force && ((Time.now - @zone_cache_mtime) < 60)
24
+ return @zone_cache if !force && ((Regurgitator.now-@zone_cache_mtime) < 60)
23
25
  tmp = Patricia.new
24
26
  begin
25
27
  row = @db[SETTINGS_LOOKUP, 'network_zones'].first or return tmp
@@ -31,7 +33,7 @@ module Regurgitator::ServerSettings # :nodoc:
31
33
  end
32
34
  end
33
35
  ensure
34
- @zone_cache_mtime = Time.now
36
+ @zone_cache_mtime = Regurgitator.now
35
37
  return @zone_cache = tmp
36
38
  end
37
39
  end
data/lib/regurgitator.rb CHANGED
@@ -13,14 +13,6 @@ require 'rpatricia'
13
13
  # so just "require 'regurgitator'" in your code.
14
14
  module Regurgitator
15
15
 
16
- autoload :ServerSettings, 'regurgitator/server_settings'
17
- autoload :Domain, 'regurgitator/domain'
18
- autoload :Device, 'regurgitator/device'
19
- autoload :FileInfo, 'regurgitator/file_info'
20
- autoload :Endpoint, 'regurgitator/endpoint'
21
- autoload :FileRequest, 'regurgitator/file_request'
22
- autoload :Local, 'regurgitator/local'
23
- autoload :LocalFile, 'regurgitator/local_file'
24
16
  autoload :ListKeys, 'regurgitator/list_keys'
25
17
  # Rack middlewares/apps
26
18
  autoload :DomainPath, 'regurgitator/domain_path'
@@ -36,4 +28,10 @@ module Regurgitator
36
28
  # raised by FileRequest when the HTTP status code
37
29
  # is outside of (200-299, 304)
38
30
  BadResponse = Class.new(Error) # :nodoc:
31
+
32
+ def self.now # :nodoc:
33
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
34
+ end
39
35
  end
36
+
37
+ require_relative 'regurgitator/local'
data/pkg.mk CHANGED
@@ -86,7 +86,7 @@ fix-perms:
86
86
  gem: $(pkggem)
87
87
 
88
88
  install-gem: $(pkggem)
89
- gem install $(CURDIR)/$<
89
+ gem install --local $(CURDIR)/$<
90
90
 
91
91
  $(pkggem): manifest fix-perms
92
92
  gem build $(rfpackage).gemspec
data/regurgitator.gemspec CHANGED
@@ -18,10 +18,12 @@ Gem::Specification.new do |s|
18
18
  s.summary = summary
19
19
  s.test_files = Dir["test/test_*.rb"]
20
20
 
21
- s.add_dependency("rack", ["~> 1.3"])
21
+ s.add_dependency("rack", ['~> 2.0'])
22
22
  s.add_dependency("sequel", ["~> 4.0"])
23
- s.add_dependency("http_spew", ["~> 0.4", ">= 0.4.1" ])
23
+ s.add_dependency("http_spew", ['~> 0.5'])
24
24
  s.add_dependency("rpatricia", ["~> 1.0"])
25
25
  s.add_development_dependency('olddoc', "~> 1.0")
26
+
27
+ s.required_ruby_version = '>= 2.1'
26
28
  s.licenses = %w(GPL-2.0+)
27
29
  end
data/test/test_local.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require "test/unit"
2
- require "regurgitator"
3
2
  require "tmpdir"
4
3
  require "fileutils"
4
+ require "regurgitator"
5
+ require "regurgitator/local"
5
6
 
6
7
  class TestLocal < Test::Unit::TestCase
7
8
  include Regurgitator::Local
@@ -1,5 +1,6 @@
1
1
  require 'test/unit'
2
2
  require 'regurgitator'
3
+ require 'regurgitator/server_settings'
3
4
 
4
5
  class TestServerSettings < Test::Unit::TestCase
5
6
  include Regurgitator::ServerSettings
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regurgitator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Regurgitators
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-11 00:00:00.000000000 Z
11
+ date: 2016-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sequel
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,20 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.4'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: 0.4.1
47
+ version: '0.5'
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
52
  - - "~>"
56
53
  - !ruby/object:Gem::Version
57
- version: '0.4'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 0.4.1
54
+ version: '0.5'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: rpatricia
63
57
  requirement: !ruby/object:Gem::Requirement
@@ -170,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
164
  requirements:
171
165
  - - ">="
172
166
  - !ruby/object:Gem::Version
173
- version: '0'
167
+ version: '2.1'
174
168
  required_rubygems_version: !ruby/object:Gem::Requirement
175
169
  requirements:
176
170
  - - ">="
@@ -178,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
172
  version: '0'
179
173
  requirements: []
180
174
  rubyforge_project:
181
- rubygems_version: 2.6.4
175
+ rubygems_version: 2.6.7
182
176
  signing_key:
183
177
  specification_version: 4
184
178
  summary: read-only Rack endpoints for MogileFS