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 +4 -4
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/LATEST +13 -12
- data/NEWS +14 -0
- data/lib/regurgitator/device.rb +10 -7
- data/lib/regurgitator/domain.rb +3 -3
- data/lib/regurgitator/domain_host.rb +1 -0
- data/lib/regurgitator/domain_path.rb +1 -0
- data/lib/regurgitator/endpoint.rb +4 -0
- data/lib/regurgitator/file_info.rb +4 -0
- data/lib/regurgitator/list_keys.rb +3 -0
- data/lib/regurgitator/local.rb +1 -0
- data/lib/regurgitator/local_file.rb +1 -1
- data/lib/regurgitator/one_domain.rb +2 -0
- data/lib/regurgitator/server_settings.rb +5 -3
- data/lib/regurgitator.rb +6 -8
- data/pkg.mk +1 -1
- data/regurgitator.gemspec +4 -2
- data/test/test_local.rb +2 -1
- data/test/test_server_settings.rb +1 -0
- metadata +8 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e25137895b8a81aec30d1df214183867db1814e5
|
4
|
+
data.tar.gz: 64d515de854a2f3acfc53b7bd752abe0c71000f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e19aa4469529c3c1a4a4ac16212dd6594155c040017e56c0a0f092f92cd2777338e42e86c88f7bf687fac1d86224059725542291841384c935a1e53fa0706643
|
7
|
+
data.tar.gz: ca163773416ad27217eaaecab8e0ab8a3c39652397e0e317020772da23615a1178ccf994ea147c2f2ff7e237f771c457283b63097ce9263acb6ddbedd83a5daf
|
data/GIT-VERSION-FILE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
GIT_VERSION = 0.
|
1
|
+
GIT_VERSION = 0.8.0
|
data/GIT-VERSION-GEN
CHANGED
data/LATEST
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
=== regurgitator 0.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
local_file:
|
12
|
-
|
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:
|
data/lib/regurgitator/device.rb
CHANGED
@@ -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
|
-
@
|
18
|
-
@
|
19
|
-
@
|
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
|
-
@
|
37
|
+
@dev_cache_lock.synchronize { refresh_device_unlocked(force) }
|
35
38
|
end
|
36
39
|
|
37
40
|
def refresh_device_unlocked(force) # :nodoc:
|
38
|
-
return @
|
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
|
-
@
|
56
|
-
@
|
58
|
+
@dev_cache_mtime = Regurgitator.now
|
59
|
+
@dev_cache = tmp
|
57
60
|
end
|
58
61
|
end
|
data/lib/regurgitator/domain.rb
CHANGED
@@ -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 =
|
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 ((
|
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 =
|
30
|
+
@domain_cache_mtime = Regurgitator.now
|
31
31
|
@domain_cache = tmp
|
32
32
|
end
|
33
33
|
end
|
data/lib/regurgitator/local.rb
CHANGED
@@ -28,7 +28,7 @@ class Regurgitator::LocalFile # :nodoc:
|
|
28
28
|
}
|
29
29
|
@response = [ 200, headers ]
|
30
30
|
|
31
|
-
ranges = Rack::Utils.
|
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,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 =
|
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 !
|
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 =
|
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
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", [
|
21
|
+
s.add_dependency("rack", ['~> 2.0'])
|
22
22
|
s.add_dependency("sequel", ["~> 4.0"])
|
23
|
-
s.add_dependency("http_spew", [
|
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
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.
|
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-
|
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: '
|
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: '
|
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.
|
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.
|
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: '
|
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.
|
175
|
+
rubygems_version: 2.6.7
|
182
176
|
signing_key:
|
183
177
|
specification_version: 4
|
184
178
|
summary: read-only Rack endpoints for MogileFS
|