Parent

Methods

Class/Module Index [+]

Quicksearch

Backup::Syncer::Cloud::Base::SyncContext

Attributes

bucket[R]
directory[R]
path[R]
remote_base[R]

Public Class Methods

new(directory, bucket, path) click to toggle source

Creates a new SyncContext object which handles a single directory from the Syncer::Base @directories array.

# File lib/backup/syncer/cloud/base.rb, line 73
def initialize(directory, bucket, path)
  @directory, @bucket, @path = directory, bucket, path
  @remote_base = File.join(path, File.basename(directory))
end

Public Instance Methods

sync!(mirror = false, concurrency_type = false, concurrency_level = 2) click to toggle source

Performs the sync operation using the provided techniques (mirroring/concurrency).

# File lib/backup/syncer/cloud/base.rb, line 81
def sync!(mirror = false, concurrency_type = false, concurrency_level = 2)
  block = Proc.new { |relative_path| sync_file relative_path, mirror }

  case concurrency_type
  when FalseClass
    all_file_names.each(&block)
  when :threads
    Parallel.each all_file_names,
        :in_threads => concurrency_level, &block
  when :processes
    Parallel.each all_file_names,
        :in_processes => concurrency_level, &block
  else
    raise Errors::Syncer::Cloud::ConfigurationError,
        "Unknown concurrency_type setting: #{ concurrency_type.inspect }"
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.