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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a8414b5806729af3ea2f852c8a56ab7ebcfa3a1
4
- data.tar.gz: 2da30be81a15c68d2dbaea5def3dd4e9d514e05f
3
+ metadata.gz: 26af20b2231cdb88d51a7ad006a5b807093d6d70
4
+ data.tar.gz: 947c6ffae0e64eb7a77ff013ac8d7ddb7fcee67e
5
5
  SHA512:
6
- metadata.gz: e646113d61e4b2ed79e0a576f5b0d0bfc491f2356ec93f6b89aa5f7e1fa980788d1c3498a0479933e22601edc868efe5095fab1e8bc6d85707174be1753dc60a
7
- data.tar.gz: 9039ca78be21c252a27cffd306e54e60959f66d82b765e5025c85adef9fa45f811f9aacb6becda238f33572317c92ccff3a3bc593a46d8e16e2b65ac2d84b716
6
+ metadata.gz: 49147d5e3b73712e211e5db6ec26f35efe0e99e4cea1b9e9e261aab2cdbf316968e1e627e7de2dffbc3735961870b131926203fa16423d9414be8665469b7781
7
+ data.tar.gz: 6dbc3c9d3bb758bfa64bf424a36adfdbe1456c018f55d7184914e3e05a6bad414ddeff8a9700db573ab7ee6bf66a3a8b6cb68e91ec4d237dbd201db6c4629d96
@@ -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-cache"
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"
@@ -1,5 +1,5 @@
1
1
  require "crimp"
2
- require "alephant/cache"
2
+ require "alephant/storage"
3
3
  require "alephant/lookup"
4
4
  require "alephant/broker/errors/invalid_cache_key"
5
5
  require "alephant/sequencer"
@@ -20,7 +20,7 @@ module Alephant
20
20
  end
21
21
 
22
22
  def load(component_meta)
23
- cache_object(component_meta)
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 cache_object(component_meta)
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
- cache_object(component_meta),
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
- cache_key(component_meta),
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 cache_key(component_meta)
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 cache_object(component_meta)
69
- cache.get cache_key(component_meta) do
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::Cache.new(
75
+ @s3 ||= Alephant::Storage.new(
76
76
  Broker.config[:s3_bucket_id],
77
77
  Broker.config[:s3_object_path]
78
78
  )
@@ -28,7 +28,7 @@ module Alephant
28
28
  )
29
29
  end
30
30
 
31
- def cache_key(component_meta)
31
+ def storage_key(component_meta)
32
32
  "#{super(component_meta)}/#{sequence(component_meta)}"
33
33
  end
34
34
 
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Broker
3
- VERSION = "3.7.1"
3
+ VERSION = "3.8.0"
4
4
  end
5
5
  end
@@ -40,7 +40,7 @@ describe Alephant::Broker::Application do
40
40
  )
41
41
  end
42
42
 
43
- let(:s3_cache_double) { instance_double("Alephant::Cache", :get => content) }
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::Cache).to receive(:new) { s3_cache_double }
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::Cache).to receive(:new) { s3_cache_double }
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(:s3_cache_double) do
118
+ let(:s3_double) do
119
119
  instance_double(
120
- "Alephant::Cache",
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::Cache).to receive(:new) { s3_cache_double }
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::Cache).to receive(:new) { s3_cache_double }
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(:s3_cache_double) do
187
+ let(:s3_double) do
188
188
  instance_double(
189
- "Alephant::Cache",
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::Cache).to receive(:new) { s3_cache_double }
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.7.1
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-18 00:00:00.000000000 Z
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-cache
187
+ name: alephant-storage
188
188
  prerelease: false
189
189
  type: :runtime
190
190
  version_requirements: !ruby/object:Gem::Requirement