1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[storage|aws] Emit warning from Files#each.

Files#each doesn't take pagination into account; it's probably not
what you want to use. If it is, use Files#each_nowarn instead to avoid
the warning.
This commit is contained in:
Samuel Merritt 2011-04-19 14:02:36 -07:00
parent 062eea86ca
commit 3299e16fb5
2 changed files with 8 additions and 2 deletions

View file

@ -51,11 +51,11 @@ module Fog
Enumerable::Enumerator.new(self, :each_file)
else
page_of_files = files.all
page_of_files.each {|f| yield f }
page_of_files.each_nowarn {|f| yield f }
while page_of_files.is_truncated
page_of_files = files.all(:marker => page_of_files.last.key)
page_of_files.each {|f| yield f }
page_of_files.each_nowarn {|f| yield f }
end
end

View file

@ -39,6 +39,12 @@ module Fog
end
end
alias :each_nowarn :each
def each
Formatador.display_line("[yellow][WARN] fog: AWS::Storage::Files#each only works on the first page of files; consider using AWS::Storage::Directory#each_file instead[/]")
super
end
def get(key, options = {}, &block)
requires :directory
data = connection.get_object(directory.key, key, options, &block)