-
Notifications
You must be signed in to change notification settings - Fork 11
/
proto.go
78 lines (66 loc) · 1.86 KB
/
proto.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
72
73
74
75
76
77
78
// Copyright 2019 DxChain, All rights reserved.
// Use of this source code is governed by an Apache
// License 2.0 that can be found in the LICENSE file.
package storage
import (
"github.com/DxChainNetwork/godx/common"
"github.com/DxChainNetwork/godx/core/types"
"math/big"
)
// Defines upload mode
const (
UploadActionAppend = "Append"
)
type (
// ContractCreateRequest contains storage contract info and client pk
ContractCreateRequest struct {
StorageContract types.StorageContract
Sign []byte
Renew bool
OldContractID common.Hash
}
// UploadRequest contains the request parameters for RPCUpload.
UploadRequest struct {
StorageContractID common.Hash
Actions []UploadAction
NewRevisionNumber uint64
NewValidProofValues []*big.Int
NewMissedProofValues []*big.Int
}
// UploadAction is a generic Write action. The meaning of each field
// depends on the Type of the action.
UploadAction struct {
Type string
A, B uint64
Data []byte
}
// UploadMerkleProof contains the optional Merkle proof for response data
// for RPCUpload.
UploadMerkleProof struct {
OldSubtreeHashes []common.Hash
OldLeafHashes []common.Hash
NewMerkleRoot common.Hash
}
// DownloadRequest contains the request parameters for RPCDownload.
DownloadRequest struct {
StorageContractID common.Hash
Sector DownloadRequestSector
MerkleProof bool
NewRevisionNumber uint64
NewValidProofValues []*big.Int
NewMissedProofValues []*big.Int
Signature []byte
}
// DownloadRequestSector is a section requested in DownloadRequest.
DownloadRequestSector struct {
MerkleRoot [32]byte
Offset uint32
Length uint32
}
// DownloadResponse contains the response data for RPCDownload.
DownloadResponse struct {
Signature []byte
Data []byte
MerkleProof []common.Hash
}
)