Class: Aws::S3::DirectoryDownloader::ObjectProducer Private
- Inherits:
-
Object
- Object
- Aws::S3::DirectoryDownloader::ObjectProducer
- Includes:
- Enumerable
- Defined in:
- lib/aws-sdk-s3/directory_downloader.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: DownloadEntry
Constant Summary collapse
- DEFAULT_QUEUE_SIZE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
100- DONE_MARKER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
:done
Instance Method Summary collapse
- #close ⇒ Object private
- #closed? ⇒ Boolean private
- #each ⇒ Object private
-
#initialize(opts = {}) ⇒ ObjectProducer
constructor
private
A new instance of ObjectProducer.
Constructor Details
#initialize(opts = {}) ⇒ ObjectProducer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ObjectProducer.
126 127 128 129 130 131 132 133 134 135 |
# File 'lib/aws-sdk-s3/directory_downloader.rb', line 126 def initialize(opts = {}) @directory_downloader = opts[:directory_downloader] @destination_dir = opts[:destination] @bucket = opts[:bucket] @client = opts[:client] @s3_prefix = opts[:s3_prefix] @filter_callback = opts[:filter_callback] @request_callback = opts[:request_callback] @object_queue = SizedQueue.new(DEFAULT_QUEUE_SIZE) end |
Instance Method Details
#close ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
141 142 143 144 |
# File 'lib/aws-sdk-s3/directory_downloader.rb', line 141 def close @object_queue.close @object_queue.clear end |
#closed? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
137 138 139 |
# File 'lib/aws-sdk-s3/directory_downloader.rb', line 137 def closed? @object_queue.closed? end |
#each ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/aws-sdk-s3/directory_downloader.rb', line 146 def each producer_thread = Thread.new do stream_objects @object_queue << DONE_MARKER rescue ClosedQueueError # abort requested rescue StandardError => e close raise e end while (object = @object_queue.shift) && object != DONE_MARKER yield object end ensure producer_thread.value end |