Class: Alephant::Broker::LoadStrategy::S3::Sequenced
- Inherits:
-
Base
- Object
- Base
- Alephant::Broker::LoadStrategy::S3::Sequenced
show all
- Defined in:
- lib/alephant/broker/load_strategy/s3/sequenced.rb
Instance Attribute Summary
Attributes inherited from Base
#cached
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #load
Instance Method Details
32
33
34
35
36
|
# File 'lib/alephant/broker/load_strategy/s3/sequenced.rb', line 32
def (component_meta)
{
"X-Sequence" => sequence(component_meta).to_s
}.merge(super(component_meta))
end
|
#s3_path(component_meta) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/alephant/broker/load_strategy/s3/sequenced.rb', line 12
def s3_path(component_meta)
lookup.read(
component_meta.id,
component_meta.options,
sequence(component_meta)
).tap do |obj|
raise InvalidCacheKey if obj.location.nil?
end.location unless sequence(component_meta).nil?
end
|
#sequence(component_meta) ⇒ Object
8
9
10
|
# File 'lib/alephant/broker/load_strategy/s3/sequenced.rb', line 8
def sequence(component_meta)
sequencer.get_last_seen component_meta.key
end
|
#sequencer ⇒ Object
22
23
24
25
26
|
# File 'lib/alephant/broker/load_strategy/s3/sequenced.rb', line 22
def sequencer
@sequencer ||= Alephant::Sequencer.create(
Broker.config[:sequencer_table_name], :config => Broker.config
)
end
|
#storage_key(component_meta) ⇒ Object
28
29
30
|
# File 'lib/alephant/broker/load_strategy/s3/sequenced.rb', line 28
def storage_key(component_meta)
"#{super(component_meta)}/#{sequence(component_meta)}"
end
|