alephant-broker 3.7.1 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/alephant-broker.gemspec +1 -1
- data/lib/alephant/broker/component.rb +1 -1
- data/lib/alephant/broker/load_strategy/http.rb +2 -2
- data/lib/alephant/broker/load_strategy/s3/base.rb +6 -6
- data/lib/alephant/broker/load_strategy/s3/sequenced.rb +1 -1
- data/lib/alephant/broker/version.rb +1 -1
- data/spec/integration/rack_spec.rb +10 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26af20b2231cdb88d51a7ad006a5b807093d6d70
|
4
|
+
data.tar.gz: 947c6ffae0e64eb7a77ff013ac8d7ddb7fcee67e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49147d5e3b73712e211e5db6ec26f35efe0e99e4cea1b9e9e261aab2cdbf316968e1e627e7de2dffbc3735961870b131926203fa16423d9414be8665469b7781
|
7
|
+
data.tar.gz: 6dbc3c9d3bb758bfa64bf424a36adfdbe1456c018f55d7184914e3e05a6bad414ddeff8a9700db573ab7ee6bf66a3a8b6cb68e91ec4d237dbd201db6c4629d96
|
data/alephant-broker.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency "rack-test"
|
33
33
|
|
34
34
|
spec.add_runtime_dependency "alephant-lookup"
|
35
|
-
spec.add_runtime_dependency "alephant-
|
35
|
+
spec.add_runtime_dependency "alephant-storage"
|
36
36
|
spec.add_runtime_dependency "alephant-logger", "1.2.0"
|
37
37
|
spec.add_runtime_dependency 'alephant-sequencer'
|
38
38
|
spec.add_runtime_dependency "dalli-elasticache"
|
@@ -20,7 +20,7 @@ module Alephant
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def load(component_meta)
|
23
|
-
|
23
|
+
fetch_object(component_meta)
|
24
24
|
rescue
|
25
25
|
logger.metric "CacheMiss"
|
26
26
|
cache.set(component_meta.cache_key, content(component_meta))
|
@@ -34,7 +34,7 @@ module Alephant
|
|
34
34
|
@cache ||= Cache::Client.new
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def fetch_object(component_meta)
|
38
38
|
cache.get(component_meta.cache_key) { content component_meta }
|
39
39
|
end
|
40
40
|
|
@@ -17,14 +17,14 @@ module Alephant
|
|
17
17
|
|
18
18
|
def load(component_meta)
|
19
19
|
add_s3_headers(
|
20
|
-
|
20
|
+
fetch_object(component_meta),
|
21
21
|
component_meta
|
22
22
|
)
|
23
23
|
rescue
|
24
24
|
logger.metric "S3CacheMiss"
|
25
25
|
add_s3_headers(
|
26
26
|
cache.set(
|
27
|
-
|
27
|
+
storage_key(component_meta),
|
28
28
|
retrieve_object(component_meta)
|
29
29
|
),
|
30
30
|
component_meta
|
@@ -37,7 +37,7 @@ module Alephant
|
|
37
37
|
Hash.new
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
40
|
+
def storage_key(component_meta)
|
41
41
|
component_meta.component_key
|
42
42
|
end
|
43
43
|
|
@@ -65,14 +65,14 @@ module Alephant
|
|
65
65
|
raise Alephant::Broker::Errors::ContentNotFound
|
66
66
|
end
|
67
67
|
|
68
|
-
def
|
69
|
-
cache.get
|
68
|
+
def fetch_object(component_meta)
|
69
|
+
cache.get storage_key(component_meta) do
|
70
70
|
retrieve_object component_meta
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
def s3
|
75
|
-
@s3 ||= Alephant::
|
75
|
+
@s3 ||= Alephant::Storage.new(
|
76
76
|
Broker.config[:s3_bucket_id],
|
77
77
|
Broker.config[:s3_object_path]
|
78
78
|
)
|
@@ -40,7 +40,7 @@ describe Alephant::Broker::Application do
|
|
40
40
|
)
|
41
41
|
end
|
42
42
|
|
43
|
-
let(:
|
43
|
+
let(:s3_double) { instance_double("Alephant::Storage", :get => content) }
|
44
44
|
|
45
45
|
before do
|
46
46
|
allow_any_instance_of(Logger).to receive(:info)
|
@@ -66,7 +66,7 @@ describe Alephant::Broker::Application do
|
|
66
66
|
|
67
67
|
describe "Component endpoint '/component/...'" do
|
68
68
|
before do
|
69
|
-
allow(Alephant::
|
69
|
+
allow(Alephant::Storage).to receive(:new) { s3_double }
|
70
70
|
get "/component/test_component"
|
71
71
|
end
|
72
72
|
|
@@ -95,7 +95,7 @@ describe Alephant::Broker::Application do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
before do
|
98
|
-
allow(Alephant::
|
98
|
+
allow(Alephant::Storage).to receive(:new) { s3_double }
|
99
99
|
end
|
100
100
|
|
101
101
|
context "when using valid batch asset data" do
|
@@ -115,9 +115,9 @@ describe Alephant::Broker::Application do
|
|
115
115
|
:meta => {}
|
116
116
|
)
|
117
117
|
end
|
118
|
-
let(:
|
118
|
+
let(:s3_double) do
|
119
119
|
instance_double(
|
120
|
-
"Alephant::
|
120
|
+
"Alephant::Storage",
|
121
121
|
:get => content
|
122
122
|
)
|
123
123
|
end
|
@@ -125,7 +125,7 @@ describe Alephant::Broker::Application do
|
|
125
125
|
context "with 404 status code set" do
|
126
126
|
before do
|
127
127
|
content[:meta]["status"] = 404
|
128
|
-
allow(Alephant::
|
128
|
+
allow(Alephant::Storage).to receive(:new) { s3_double }
|
129
129
|
get "/component/test_component"
|
130
130
|
end
|
131
131
|
|
@@ -140,7 +140,7 @@ describe Alephant::Broker::Application do
|
|
140
140
|
"head_header_without_dash" => "bar",
|
141
141
|
"status" => 200
|
142
142
|
}
|
143
|
-
allow(Alephant::
|
143
|
+
allow(Alephant::Storage).to receive(:new) { s3_double }
|
144
144
|
get "/component/test_component"
|
145
145
|
end
|
146
146
|
|
@@ -184,9 +184,9 @@ describe Alephant::Broker::Application do
|
|
184
184
|
:get => "<p>Some data</p>"
|
185
185
|
)
|
186
186
|
end
|
187
|
-
let(:
|
187
|
+
let(:s3_double) do
|
188
188
|
instance_double(
|
189
|
-
"Alephant::
|
189
|
+
"Alephant::Storage",
|
190
190
|
:get => "test_content"
|
191
191
|
)
|
192
192
|
end
|
@@ -194,7 +194,7 @@ describe Alephant::Broker::Application do
|
|
194
194
|
context "which is old" do
|
195
195
|
before do
|
196
196
|
allow(Alephant::Broker::Cache::Client).to receive(:new) { cache_double }
|
197
|
-
allow(Alephant::
|
197
|
+
allow(Alephant::Storage).to receive(:new) { s3_double }
|
198
198
|
end
|
199
199
|
it "should update the cache (call `.set`)" do
|
200
200
|
expect(cache_double).to receive(:set).once
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-broker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BBC News
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,7 +184,7 @@ dependencies:
|
|
184
184
|
- - '>='
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
|
-
name: alephant-
|
187
|
+
name: alephant-storage
|
188
188
|
prerelease: false
|
189
189
|
type: :runtime
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|