Sha256: 16681f767073fb74a4c754da5d075171b45bf18ecf77063129ee4fb2ef4ab4be

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

#List the files in a MogileFS backup with their metadata
class List
  attr_accessor :backup_path
  include Validations


  #initialize the list object
  #@param[Hash] o :backup_path is required
  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

  #Outputs a list of files in CSV format
  #fid,key,length,class
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mogbak-0.2.1 lib/list.rb
mogbak-0.2.0 lib/list.rb