class DB2Fog::FogStore

Public Instance Methods

delete(remote_filename) click to toggle source
    # File lib/db2fog.rb
194 def delete(remote_filename)
195   remote_file = directory.files.head(remote_filename)
196   remote_file.destroy if remote_file
197 end
fetch(remote_filename) click to toggle source
    # File lib/db2fog.rb
182 def fetch(remote_filename)
183   remote_file = directory.files.get(remote_filename)
184 
185   file = Tempfile.new("dump")
186   open(file.path, 'wb') { |f| f.write(remote_file.body) }
187   file
188 end
list() click to toggle source
    # File lib/db2fog.rb
190 def list
191   directory.files.map { |f| f.key }
192 end
store(remote_filename, io) click to toggle source
    # File lib/db2fog.rb
178 def store(remote_filename, io)
179   directory.files.create(:key => remote_filename, :body => io, :public => false)
180 end

Private Instance Methods

directory() click to toggle source
    # File lib/db2fog.rb
217 def directory
218   @directory ||= storage.directories.get(directory_name)
219 end
directory_name() click to toggle source
    # File lib/db2fog.rb
209 def directory_name
210   if DB2Fog.config.respond_to?(:[])
211     DB2Fog.config[:directory]
212   else
213     raise "DB2Fog not configured"
214   end
215 end
fog_options() click to toggle source
    # File lib/db2fog.rb
201 def fog_options
202   if DB2Fog.config.respond_to?(:[])
203     DB2Fog.config.except(:directory, :database_options)
204   else
205     raise "DB2Fog not configured"
206   end
207 end
storage() click to toggle source
    # File lib/db2fog.rb
221 def storage
222   @storage = Fog::Storage.new(fog_options)
223 end