class List

List the files in a MogileFS backup with their metadata

Attributes

backup_path[RW]

Public Class Methods

new(o={}) click to toggle source

initialize the list object @param o :backup_path is required

# File lib/list.rb, line 9
def initialize(o={})

  #If settings file does not exist then this is not a valid mogilefs backup
  check_settings_file('settings.yml not found in path.  This must not be a backup profile. Cannot list')

  connect_sqlite
  migrate_sqlite

  #Now that database is all setup load the model class
  require('bakfile')
end

Public Instance Methods

list() click to toggle source

Outputs a list of files in CSV format fid,key,length,class

# File lib/list.rb, line 23
def list
  files = BakFile.find_each(:conditions => ['saved = ?', true]) do |file|
    Log.instance.info("#{file.fid},#{file.dkey},#{file.length},#{file.classname}")
    break if SignalHandler.instance.should_quit
  end
end