-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtypes.go
71 lines (59 loc) · 1.37 KB
/
types.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package dag
import (
"github.com/HORNET-Storage/Scionic-Merkle-Tree/merkletree"
)
var ChunkSize = 2048 * 1024 // 2048 * 1024 bytes = 2 megabytes
type LeafType string
const (
FileLeafType LeafType = "file"
ChunkLeafType LeafType = "chunk"
DirectoryLeafType LeafType = "directory"
)
type Dag struct {
Root string
Leafs map[string]*DagLeaf
}
type DagBuilder struct {
Leafs map[string]*DagLeaf
}
type DagLeaf struct {
Hash string
ItemName string
Type LeafType
ContentHash []byte
Content []byte
ClassicMerkleRoot []byte
CurrentLinkCount int
LatestLabel string
LeafCount int
Links map[string]string
ParentHash string
AdditionalData map[string]string
MerkleTree *merkletree.MerkleTree
LeafMap map[string]merkletree.DataBlock
Proofs map[string]*ClassicTreeBranch
}
type DagLeafBuilder struct {
ItemName string
Label int64
LeafType LeafType
Data []byte
Links map[string]string
}
type ClassicTreeBranch struct {
Leaf string
Proof *merkletree.Proof
}
type DagBranch struct {
Leaf *DagLeaf
Path []*DagLeaf
MerkleProofs map[string]*ClassicTreeBranch
}
type TransmissionPacket struct {
Leaf *DagLeaf
ParentHash string
Proofs map[string]*ClassicTreeBranch
}
func SetChunkSize(size int) {
ChunkSize = size
}