alephant-broker 3.0.0 → 3.0.1

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: 71dd81ac255c7701b1676aa6f0e57d6c9913789e
4
- data.tar.gz: 1ddc1f6954fe7302e9c87aba60ea0d1daee40b3d
3
+ metadata.gz: 68a9bc33df3994006cc8a45e6c03e7609ad87a85
4
+ data.tar.gz: b9f7f4f87c2d11c774a4ccaaeed7c7e1ee3b6f9a
5
5
  SHA512:
6
- metadata.gz: adf9b7900d4723e2f7686c26848b856cc43d440c1e12d0e5fe524461939aab2950aba64ca3c7adf8bc69036c952e7a55c21a41371655605294274668e4d1a80c
7
- data.tar.gz: 25553c80bb8a7c8c25c330d728df926fc9662d46df3349dd8491064c4c8babc56996fc47aa90cb5b885e2b109f6a1adbc0d1e6f326bfc3cf7c3f3c5e5ee2de48
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
- :bucket_id => 'test_bucket',
35
- :path => 'foo',
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**: the HTML load strategy relies upon being given a [URLGenerator](https://github.com/BBC-News/alephant-broker/blob/master/lib/alephant/broker/load_strategy/http.rb#L9-L13). This must be implemented within your own application, and extend `Alephant::Broker::LoadStrategy::HTTP::URL` (see above for an example). It is used to generate the URL which will act as the HTML endpoint.
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
 
@@ -55,7 +55,7 @@ module Alephant
55
55
  class NullClient
56
56
  def get(key); end
57
57
 
58
- def set(key, value)
58
+ def set(key, value, ttl = nil)
59
59
  value
60
60
  end
61
61
  end
@@ -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(component_meta).get_last_seen
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(component_meta)
81
- Alephant::Sequencer.create(
82
- Broker.config[:sequencer_table_name], component_meta.key
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.debug("Request::Batch#initialize(#{env.settings})")
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
- @batch_id = env.data['batch_id']
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
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Broker
3
- VERSION = "3.0.0"
3
+ VERSION = "3.0.1"
4
4
  end
5
5
  end
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.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 00:00:00.000000000 Z
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec