class Synco::Methods::ZFS

Public Instance Methods

call(scope, arguments: []) click to toggle source
# File lib/synco/methods/zfs.rb, line 30
def call(scope, arguments: [])
        from_server = scope.current_server
        master_server = scope.master_server
        target_server = scope.target_server
        directory = scope.directory
        
        send_command = [
                *@command,
                "send",
                master_server.full_path(directory)
        ]
        
        receive_command = [
                *@command,
                "receive",
                target_server.full_path(directory)
        ]
        
        input, output = IO.pipe
        
        Fiber.new do
                master_server.run(*send_command, out: output, from: from_server)
                output.close
        end.resume
        
        target_server.run(*receive_command, in: input, from: from_server)
        input.close
end
default_command() click to toggle source
# File lib/synco/methods/zfs.rb, line 26
def default_command
        ['zfs', '-rnv']
end