Class: Configuration::S3Source
Instance Attribute Summary
#config_locals
Class Method Summary
collapse
Instance Method Summary
collapse
#client, #initialize, #object, #url
#initialize
#config_local, #initialize, #path_template
Class Method Details
.match(node) ⇒ Object
382
383
384
|
# File 'lib/httpimagestore/configuration/s3.rb', line 382
def self.match(node)
node.name == 'source_s3'
end
|
.parse(configuration, node) ⇒ Object
386
387
388
|
# File 'lib/httpimagestore/configuration/s3.rb', line 386
def self.parse(configuration, node)
configuration.sources << super
end
|
Instance Method Details
#realize(request_state) ⇒ Object
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
|
# File 'lib/httpimagestore/configuration/s3.rb', line 390
def realize(request_state)
put_sourced_named_image(request_state) do |image_name, rendered_path|
log.info "sourcing '#{image_name}' image from S3 '#{@bucket}' bucket under '#{rendered_path}' key"
object(rendered_path) do |object|
data = request_state.memory_limit.get do |limit|
object.read(limit + 1)
end
S3SourceStoreBase.stats.incr_total_s3_source
S3SourceStoreBase.stats.incr_total_s3_source_bytes(data.bytesize)
image = Image.new(data, object.content_type)
image.source_url = url(object)
image
end
end
end
|
#to_s ⇒ Object
408
409
410
|
# File 'lib/httpimagestore/configuration/s3.rb', line 408
def to_s
"S3Source[image_name: '#{image_name}' bucket: '#{@bucket}' prefix: '#{@prefix}' path_spec: '#{path_spec}']"
end
|