class Synco::Methods::RSyncSnapshot

Public Class Methods

new(*command, arguments: [], archive: true, stats: true, **options) click to toggle source
Calls superclass method Synco::Methods::RSync::new
# File lib/synco/methods/rsync.rb, line 113
def initialize(*command, arguments: [], archive: true, stats: true, **options)
        super
end

Public Instance Methods

call(scope) click to toggle source
# File lib/synco/methods/rsync.rb, line 137
def call(scope)
        master_server = scope.master_server
        target_server = scope.target_server
        
        directory = scope.directory
        incremental_path = compute_incremental_path(directory)
        link_arguments = compute_link_arguments(directory, incremental_path)
        
        # Create the destination backup directory
        target_server.run('mkdir', '-p', target_server.full_path(incremental_path))
        
        master_server.run(
                *@command,
                *@arguments,
                *directory.arguments,
                *connect_arguments(master_server, target_server),
                *link_arguments,
                master_server.connection_string(directory, on: master_server),
                target_server.connection_string(incremental_path, on: master_server)
        )
rescue CommandFailure => failure
        raise unless failure.status.to_i == 24
end
compute_incremental_path(directory) click to toggle source
# File lib/synco/methods/rsync.rb, line 125
def compute_incremental_path(directory)
        File.join(snapshot_name, directory.path)
end
latest_name() click to toggle source
# File lib/synco/methods/rsync.rb, line 121
def latest_name
        @options[:latest_name] || LATEST_NAME
end
snapshot_name() click to toggle source
# File lib/synco/methods/rsync.rb, line 117
def snapshot_name
        @options[:snapshot_name] || SNAPSHOT_NAME
end