Class: List
Overview
List the files in a MogileFS backup with their metadata
Instance Attribute Summary collapse
-
#backup_path ⇒ Object
Returns the value of attribute backup_path.
Instance Method Summary collapse
-
#initialize(o = {}) ⇒ List
constructor
initialize the list object @param o :backup_path is required.
-
#list ⇒ Object
Outputs a list of files in CSV format fid,key,length,class.
Methods included from Validations
#check_backup_path, #check_mogile_domain, #check_settings_file, #connect_sqlite, #create_sqlite_db, #migrate_sqlite, #mogile_db_connect, #mogile_tracker_connect
Constructor Details
#initialize(o = {}) ⇒ List
initialize the list object @param o :backup_path is required
9 10 11 12 13 14 15 16 17 18 19 |
# 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 |
Instance Attribute Details
#backup_path ⇒ Object
Returns the value of attribute backup_path.
3 4 5 |
# File 'lib/list.rb', line 3 def backup_path @backup_path end |
Instance Method Details
#list ⇒ Object
Outputs a list of files in CSV format fid,key,length,class
23 24 25 26 27 28 |
# 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 |