class SyncJobs

Overview

confmgr = ConfigManager.new("sample_config.yaml")
syncjobs = SyncJobs.new(confmgr)
crawl(confmgr.config.crawl_dir) do |batch|
  batch.files.each do |f|
    syncjobs.add(f)
  end
  syncjobs.sync
  puts syncjobs.summary

  # If any hardlinks available then sync it
  if batch.hardlinks.size > 0
    batch.hardlinks.each do |_, hls|
      syncjobs.add(hls)
    end
    syncjobs.sync
    puts syncjobs.summary
  end
end

Defined in:

syncjobs.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(confmgr : ConfigManager) #

[View source]

Instance Method Detail

def add(entry : String) #

Add one entry to a Rsync job then switch to next job


[View source]
def add(entries : Array(String)) #

Add all entries to single Rsync Job Very useful for syncing Hardlinks To use -H or preserve hardlinks options with rsync, all hardlinks should be synced in the same process.


[View source]
def rsync_job #

[View source]
def rsync_ssh_opts #

[View source]
def speed(total_bytes, elapsed_time) #

[View source]
def summary : Array(JobSummary) #

[View source]
def sync #

Start N rsync jobs and add the files to each jobs stdin. Once all the jobs are started, wait for the completion and then return response.


[View source]