Class: MysqlBackup::Entity::Logs
- Inherits:
-
Files
- Object
- MysqlBackup::Entity
- Files
- MysqlBackup::Entity::Logs
- Includes:
- NamedArguments
- Defined in:
- lib/mysql_backup/entity/logs.rb
Instance Attribute Summary collapse
-
#completed_logs ⇒ Object
Returns the value of attribute completed_logs.
-
#log_bin_dir ⇒ Object
Returns the value of attribute log_bin_dir.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
-
#log_position ⇒ Object
Returns the value of attribute log_position.
Attributes inherited from MysqlBackup::Entity
Instance Method Summary collapse
- #completed_logs_paths ⇒ Object
-
#initialize(args = {}) ⇒ Logs
constructor
Takes the following arguments:.
- #log_file_path ⇒ Object
- #save(args = {}) {|:identifier => i, :file => log_file_path| ... } ⇒ Object
Methods inherited from Files
build_files, #confirm_required_paths_are_readable, create_tar_files, do_tar, process_file, #required_path_strings, #set_path_vars
Methods inherited from MysqlBackup::Entity
Constructor Details
#initialize(args = {}) ⇒ Logs
Takes the following arguments:
:log_bin_dir => The prefix of the log files
:completed_logs => All the logs before the one being written
:log_file => The current log
:log_position => The position in the log file
19 20 21 22 |
# File 'lib/mysql_backup/entity/logs.rb', line 19 def initialize args = {} super @log_bin_dir = Pathname.new(args[:log_bin_dir]) end |
Instance Attribute Details
#completed_logs ⇒ Object
Returns the value of attribute completed_logs.
9 10 11 |
# File 'lib/mysql_backup/entity/logs.rb', line 9 def completed_logs @completed_logs end |
#log_bin_dir ⇒ Object
Returns the value of attribute log_bin_dir.
8 9 10 |
# File 'lib/mysql_backup/entity/logs.rb', line 8 def log_bin_dir @log_bin_dir end |
#log_file ⇒ Object
Returns the value of attribute log_file.
11 12 13 |
# File 'lib/mysql_backup/entity/logs.rb', line 11 def log_file @log_file end |
#log_position ⇒ Object
Returns the value of attribute log_position.
10 11 12 |
# File 'lib/mysql_backup/entity/logs.rb', line 10 def log_position @log_position end |
Instance Method Details
#completed_logs_paths ⇒ Object
24 25 26 |
# File 'lib/mysql_backup/entity/logs.rb', line 24 def completed_logs_paths completed_logs.map {|l| Pathname.new(log_bin_dir) + l} end |
#log_file_path ⇒ Object
28 29 30 |
# File 'lib/mysql_backup/entity/logs.rb', line 28 def log_file_path Pathname.new(log_bin_dir) + log_file end |
#save(args = {}) {|:identifier => i, :file => log_file_path| ... } ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/mysql_backup/entity/logs.rb', line 32 def save args = {} # Do the complete logs completed_logs_paths.each do |p| i = MysqlBackup::Entity::Identifier.create_object :category => :log, :type => :complete, :log_file => p.basename.to_s, :n_parts => 1, :part_number => 0 files = self.class.tar_files [p.to_s] yield :identifier => i, :file => files.first end # Do the current log i = MysqlBackup::Entity::Identifier.create_object :category => :log, :type => :current, :log_file => log_file, :log_position => log_position, :n_parts => 1, :part_number => 0 yield :identifier => i, :file => log_file_path end |