Methods

Class/Module Index [+]

Quicksearch

Backup::Syncer::Cloud::Base

Constants

MUTEX

Attributes

max_retries[RW]

Number of times to retry failed operations.

Default: 10

retry_waitsec[RW]

Time in seconds to pause before each retry.

Default: 30

thread_count[RW]

Number of threads to use for concurrency.

Default: 0 (no concurrency)

Public Class Methods

new(syncer_id = nil, &block) click to toggle source
# File lib/backup/syncer/cloud/base.rb, line 28
def initialize(syncer_id = nil, &block)
  super
  instance_eval(&block) if block_given?

  @thread_count   ||= 0
  @max_retries    ||= 10
  @retry_waitsec  ||= 30

  @path ||= 'backups'
  @path = path.sub(/^\//, '')
end

Public Instance Methods

perform!() click to toggle source
# File lib/backup/syncer/cloud/base.rb, line 40
def perform!
  log!(:started)
  @transfer_count = 0
  @unchanged_count = 0
  @skipped_count = 0
  @orphans = thread_count > 0 ? Queue.new : []

  directories.each {|dir| sync_directory(dir) }
  orphans_result = process_orphans

  Logger.info "\nSummary:"
  Logger.info "\s\sTransferred Files: #{ @transfer_count }"
  Logger.info "\s\s#{ orphans_result }"
  Logger.info "\s\sUnchanged Files: #{ @unchanged_count }"
  Logger.warn "\s\sSkipped Files: #{ @skipped_count }" if @skipped_count > 0
  log!(:finished)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.