-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
38 lines (30 loc) · 926 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
Copyright (c) 2022, Geolffrey Mena <[email protected]>
Refs:
https://rsync.samba.org/tech_report/
https://en.wikipedia.org/wiki/Adler-32
https://www.zlib.net/maxino06_fletcher-adler.pdf
https://www.sciencedirect.com/science/article/pii/S1742287606000764#fig2
https://xilinx.github.io/Vitis_Libraries/security/2020.2/guide_L1/internals/adler32.html
**/
package main
import (
IO "github.com/geolffreym/rolling-sync/fileio"
Sync "github.com/geolffreym/rolling-sync/sync"
)
func main() {
// Example usage
blockSize := 1 << 4 // 16 bytes
io := IO.New(blockSize)
sync := Sync.New(blockSize)
v1, err := io.Open("mock.txt")
if err != nil {
panic("Fail opening mock.txt")
}
v2, err := io.Open("mockV2.txt")
if err != nil {
panic("Fail opening mockV2.txt")
}
sig := sync.BuildSigTable(v1) // Signature file for "source"
sync.Delta(sig, v2) // Return delta with "sig" and "target" differences
}