]> git.rkrishnan.org Git - hs-rsync.git/blob - app/Main.hs
remove the older versions of checksum and checksumupdate
[hs-rsync.git] / app / Main.hs
1 module Main where
2
3 import qualified Data.ByteString.Char8 as BS
4 import qualified Data.ByteString.Lazy as BL
5
6 import Lib
7
8 main :: IO ()
9 main = do
10   let fileRemote    = "fasljlajljalfjlajfasdjkg;fdk;kqpitpk;k;asdk;kg;adskg"
11       fileLocal     = "ljljalsjdgljadslfjlasjdfqporiuqplsadljfaljdf"
12       blockSize     = 5
13       -- generate signatures at block boundaries for the local file and send it to remote.
14       fileLocalSigs = fileSignatures (BL.fromStrict (BS.pack fileLocal)) blockSize
15       -- at remote, take the signatures from the other size and generate instructions.
16       insns         = genInstructions fileLocalSigs blockSize (BL.fromStrict (BS.pack fileRemote))
17       -- at the local side, take those instructions and apply to fileLocal
18       fileLocalNew  = recreate (BL.fromStrict (BS.pack fileLocal)) blockSize insns
19   putStrLn $ "remote: " ++ fileRemote
20   putStrLn $ "local:  " ++ fileLocal
21   BS.putStrLn $ (BS.pack "recreated: ") `BS.append` (BL.toStrict fileLocalNew)