Class: Configuration::S3Source
Class Method Summary
collapse
Instance Method Summary
collapse
#client, #initialize, #object, #url
#initialize
Methods inherited from Scope
#initialize, node_parsers, #parse, register_node_parser
Class Method Details
.match(node) ⇒ Object
389
390
391
|
# File 'lib/httpimagestore/configuration/s3.rb', line 389
def self.match(node)
node.name == 'source_s3'
end
|
.parse(configuration, node) ⇒ Object
393
394
395
|
# File 'lib/httpimagestore/configuration/s3.rb', line 393
def self.parse(configuration, node)
configuration.sources << super
end
|
Instance Method Details
#realize(request_state) ⇒ Object
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
|
# File 'lib/httpimagestore/configuration/s3.rb', line 397
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"
measure "sourcing image from S3", "image: '#{image_name}' bucket: '#{@bucket}'" do
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
end
|
#to_s ⇒ Object
417
418
419
|
# File 'lib/httpimagestore/configuration/s3.rb', line 417
def to_s
"S3Source[image_name: '#{image_name}' bucket: '#{@bucket}' prefix: '#{@prefix}' path_spec: '#{path_spec}']"
end
|