]> git.rkrishnan.org Git - hs-rsync.git/blobdiff - app/Main.hs
closer to the rsync algorithm technical paper
[hs-rsync.git] / app / Main.hs
index 0393ce468b914d3cfaa62da24343a4142ad6bf80..f87a0fae8475df3f40d15771b82f8327978b085a 100644 (file)
@@ -9,12 +9,13 @@ main :: IO ()
 main = do
   let fileRemote    = "fasljlajljalfjlajfasdjkg;fdk;kqpitpk;k;asdk;kg;adskg"
       fileLocal     = "ljljalsjdgljadslfjlasjdfqporiuqplsadljfaljdf"
+      blockSize     = 5
       -- generate signatures at block boundaries for the local file and send it to remote.
-      fileLocalSigs = fileSignatures (BL.fromStrict (BS.pack fileLocal)) 5
+      fileLocalSigs = fileSignatures (BL.fromStrict (BS.pack fileLocal)) blockSize
       -- at remote, take the signatures from the other size and generate instructions.
-      insns         = genInstructions fileLocalSigs 5 (BL.fromStrict (BS.pack fileRemote))
+      insns         = genInstructions fileLocalSigs blockSize (BL.fromStrict (BS.pack fileRemote))
       -- at the local side, take those instructions and apply to fileLocal
-      fileLocalNew  = recreate (BL.fromStrict (BS.pack fileLocal)) 5 insns
+      fileLocalNew  = recreate (BL.fromStrict (BS.pack fileLocal)) blockSize insns
   putStrLn $ "remote: " ++ fileRemote
   putStrLn $ "local:  " ++ fileLocal
   BS.putStrLn $ (BS.pack "recreated: ") `BS.append` (BL.toStrict fileLocalNew)