alephant-broker 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -3
- data/lib/alephant/broker/cache.rb +1 -1
- data/lib/alephant/broker/load_strategy/s3.rb +5 -5
- data/lib/alephant/broker/request/batch.rb +3 -5
- data/lib/alephant/broker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68a9bc33df3994006cc8a45e6c03e7609ad87a85
|
4
|
+
data.tar.gz: b9f7f4f87c2d11c774a4ccaaeed7c7e1ee3b6f9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02b9c8a85184e32b00019a3401727c32d06445e1afc61248d16e9960b0378a1ed153df9da524c5b8c198aa53792e9dc6f488695edaf52e6ee9369d83d8ebd126
|
7
|
+
data.tar.gz: f5f3d1fee60fa8ce65a8615fcd51d159e5ddb7bd8551fa2916cfd695fc318eb0142aa3b32070e91f250b2520b98962b1994c0cb1dd2d569edcc96f58d43b6e55
|
data/README.md
CHANGED
@@ -31,8 +31,8 @@ require 'alephant/broker'
|
|
31
31
|
require 'alephant/broker/load_strategy/s3'
|
32
32
|
|
33
33
|
config = {
|
34
|
-
:
|
35
|
-
:
|
34
|
+
:s3_bucket_id => 'test_bucket',
|
35
|
+
:s3_object_path => 'foo',
|
36
36
|
:lookup_table_name => 'test_lookup'
|
37
37
|
}
|
38
38
|
|
@@ -78,7 +78,30 @@ Alephant::Broker::Application.new(
|
|
78
78
|
end
|
79
79
|
```
|
80
80
|
|
81
|
-
**Note
|
81
|
+
**Note**
|
82
|
+
|
83
|
+
The HTML load strategy relies upon being given a URLGenerator, which is used to generate the URL of the HTML endpoint (see below for example). The class must:
|
84
|
+
|
85
|
+
* be implemented within your own application.
|
86
|
+
* extend [`Alephant::Broker::LoadStrategy::HTTP::URL`](https://github.com/BBC-News/alephant-broker/blob/master/lib/alephant/broker/load_strategy/http.rb#L9-L13).
|
87
|
+
* include a `#generate` method which takes `id` (string) and `options` (hash) as parameters.
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
require 'alephant/broker/load_strategy/http'
|
91
|
+
require 'rack'
|
92
|
+
|
93
|
+
class UrlGenerator < Alephant::Broker::LoadStrategy::HTTP::URL
|
94
|
+
def generate(id, options)
|
95
|
+
"http://api.my-app.com/component/#{id}?#{to_query_string(options)}"
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
def to_query_string(hash)
|
101
|
+
Rack::Utils.build_query hash
|
102
|
+
end
|
103
|
+
end
|
104
|
+
```
|
82
105
|
|
83
106
|
### Rack App
|
84
107
|
|
@@ -21,7 +21,7 @@ module Alephant
|
|
21
21
|
)
|
22
22
|
end
|
23
23
|
|
24
|
-
private
|
24
|
+
private
|
25
25
|
|
26
26
|
def add_s3_headers(component_data, component_meta)
|
27
27
|
component_data.merge(
|
@@ -38,7 +38,7 @@ module Alephant
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def sequence(component_meta)
|
41
|
-
sequencer
|
41
|
+
sequencer.get_last_seen component_meta.key
|
42
42
|
end
|
43
43
|
|
44
44
|
def retrieve_object(component_meta)
|
@@ -77,9 +77,9 @@ module Alephant
|
|
77
77
|
)
|
78
78
|
end
|
79
79
|
|
80
|
-
def sequencer
|
81
|
-
Alephant::Sequencer.create(
|
82
|
-
Broker.config[:sequencer_table_name],
|
80
|
+
def sequencer
|
81
|
+
@sequencer ||= Alephant::Sequencer.create(
|
82
|
+
Broker.config[:sequencer_table_name], nil
|
83
83
|
)
|
84
84
|
end
|
85
85
|
end
|
@@ -11,13 +11,11 @@ module Alephant
|
|
11
11
|
attr_reader :batch_id, :components, :load_strategy
|
12
12
|
|
13
13
|
def initialize(component_factory, env)
|
14
|
-
logger.
|
14
|
+
logger.info "Request::Batch#initialize: id: #{env.data['batch_id']}"
|
15
15
|
|
16
|
+
@batch_id = env.data['batch_id']
|
16
17
|
@component_factory = component_factory
|
17
|
-
@
|
18
|
-
@components = components_for env
|
19
|
-
|
20
|
-
logger.debug("Request::Batch#initialize: id: #{@batch_id}")
|
18
|
+
@components = components_for env
|
21
19
|
end
|
22
20
|
|
23
21
|
private
|
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.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|