Class: DB2Fog::FogStore

Inherits:
Object
  • Object
show all
Defined in:
lib/db2fog.rb

Instance Method Summary collapse

Instance Method Details

#delete(remote_filename) ⇒ Object



194
195
196
197
# File 'lib/db2fog.rb', line 194

def delete(remote_filename)
  remote_file = directory.files.head(remote_filename)
  remote_file.destroy if remote_file
end

#fetch(remote_filename) ⇒ Object



182
183
184
185
186
187
188
# File 'lib/db2fog.rb', line 182

def fetch(remote_filename)
  remote_file = directory.files.get(remote_filename)

  file = Tempfile.new("dump")
  open(file.path, 'wb') { |f| f.write(remote_file.body) }
  file
end

#listObject



190
191
192
# File 'lib/db2fog.rb', line 190

def list
  directory.files.map { |f| f.key }
end

#store(remote_filename, io) ⇒ Object



178
179
180
# File 'lib/db2fog.rb', line 178

def store(remote_filename, io)
  directory.files.create(:key => remote_filename, :body => io, :public => false)
end