-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdef.go
51 lines (43 loc) · 1.15 KB
/
def.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
39
40
41
42
43
44
45
46
47
48
49
50
51
package rsync
import (
// "io"
)
const (
DeltaMagic uint32 = 0x72730236
BlakeMagic uint32 = 0x72730137
Md4Magic uint32 = 0x72730136
TABLE_SIZE = (1 << 16)
NULL_TAG = -1
)
/*
* This structure describes all the sums generated for an instance of
* a file. It incorporates some redundancy to make it easier to
* search.
*/
type Signature struct {
flength int64 /* total file length */
count int /* how many chunks */
block_len uint32 /* block_length */
strong_sum_len uint32
block_sigs map[uint32][]*rs_block_sig /* points to info for each chunk */
tag_tables map[uint32]*rs_tag_table_entry
//tag_table []rs_tag_table_entry
//targets []rs_target
magic uint32
}
// from librsync sunset.h
// signature target
type rs_target struct {
t uint16
i int
}
type rs_tag_table_entry struct {
l int // left bound of the hash tag in sorted array of targets
r int // right bound of the hash tag in sorted array of targets
// all tags between l and r inclusively are the same
}
type rs_block_sig struct {
i int /* index of this chunk */
wsum uint32 /* simple checksum */
ssum []byte /* strong checksum */
}