lotus/chain/deals/types.go

93 lines
1.8 KiB
Go
Raw Normal View History

2019-08-02 14:09:54 +00:00
package deals
import (
"github.com/filecoin-project/lotus/api"
2019-08-02 14:09:54 +00:00
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/address"
"github.com/filecoin-project/lotus/chain/types"
2019-08-02 14:09:54 +00:00
)
func init() {
cbor.RegisterCborType(StorageDealProposal{})
cbor.RegisterCborType(SignedStorageDealProposal{})
cbor.RegisterCborType(PieceInclusionProof{})
cbor.RegisterCborType(StorageDealResponse{})
cbor.RegisterCborType(SignedStorageDealResponse{})
2019-09-13 21:00:36 +00:00
cbor.RegisterCborType(AskRequest{})
cbor.RegisterCborType(AskResponse{})
2019-08-02 14:09:54 +00:00
}
2019-09-10 12:35:43 +00:00
const ProtocolID = "/fil/storage/mk/1.0.0"
2019-09-13 21:00:36 +00:00
const AskProtocolID = "/fil/storage/ask/1.0.0"
2019-09-10 12:35:43 +00:00
2019-08-02 14:09:54 +00:00
type SerializationMode string
const (
SerializationUnixFs = "UnixFs"
SerializationRaw = "Raw"
SerializationIPLD = "IPLD"
)
type StorageDealProposal struct {
2019-08-26 08:02:26 +00:00
PieceRef cid.Cid // TODO: port to spec
2019-08-02 14:09:54 +00:00
SerializationMode SerializationMode
CommP []byte
2019-08-06 11:30:14 +00:00
Size uint64
2019-08-02 14:09:54 +00:00
TotalPrice types.BigInt
Duration uint64
2019-08-07 20:16:26 +00:00
Payment actors.PaymentInfo
2019-08-02 14:09:54 +00:00
MinerAddress address.Address
ClientAddress address.Address
}
type SignedStorageDealProposal struct {
Proposal StorageDealProposal
2019-08-02 16:25:10 +00:00
Signature *types.Signature
2019-08-02 14:09:54 +00:00
}
// response
2019-08-06 11:30:14 +00:00
2019-08-02 14:09:54 +00:00
type PieceInclusionProof struct {
2019-08-06 11:30:14 +00:00
Position uint64
2019-08-12 21:48:18 +00:00
ProofElements []byte
2019-08-02 14:09:54 +00:00
}
type StorageDealResponse struct {
2019-09-10 14:13:24 +00:00
State api.DealState
2019-08-02 14:09:54 +00:00
2019-09-10 14:13:24 +00:00
// DealRejected / DealAccepted / DealFailed / DealStaged
2019-08-02 14:09:54 +00:00
Message string
Proposal cid.Cid
2019-09-10 14:13:24 +00:00
// DealSealing
2019-08-02 14:09:54 +00:00
PieceInclusionProof PieceInclusionProof
2019-09-10 12:35:43 +00:00
CommD []byte // TODO: not in spec
2019-08-02 14:09:54 +00:00
2019-09-10 14:13:24 +00:00
// DealComplete
2019-08-06 23:08:34 +00:00
SectorCommitMessage *cid.Cid
2019-08-02 14:09:54 +00:00
}
type SignedStorageDealResponse struct {
Response StorageDealResponse
2019-08-02 16:25:10 +00:00
Signature *types.Signature
2019-08-02 14:09:54 +00:00
}
2019-09-13 21:00:36 +00:00
type AskRequest struct {
Miner address.Address
}
type AskResponse struct {
Ask *types.SignedStorageAsk
}