lotus/retrieval/types.go

45 lines
823 B
Go
Raw Normal View History

2019-08-26 08:02:26 +00:00
package retrieval
import (
"github.com/ipfs/go-cid"
2019-08-26 13:45:36 +00:00
cbor "github.com/ipfs/go-ipld-cbor"
2019-08-26 08:02:26 +00:00
"github.com/filecoin-project/go-lotus/chain/types"
)
2019-08-26 13:45:36 +00:00
const ProtocolID = "/fil/retrieval/-1.0.0" // TODO: spec
const QueryProtocolID = "/fil/retrieval/qry/-1.0.0" // TODO: spec
2019-08-26 08:02:26 +00:00
type QueryResponse int
2019-08-26 09:08:39 +00:00
2019-08-26 08:02:26 +00:00
const (
Available QueryResponse = iota
Unavailable
)
2019-08-26 13:45:36 +00:00
func init() {
cbor.RegisterCborType(RetDealProposal{})
cbor.RegisterCborType(RetQuery{})
cbor.RegisterCborType(RetQueryResponse{})
}
2019-08-26 08:02:26 +00:00
type RetDealProposal struct {
2019-08-26 09:08:39 +00:00
Piece cid.Cid
Price types.BigInt
2019-08-26 08:02:26 +00:00
Payment types.SignedVoucher
}
type RetQuery struct {
Piece cid.Cid
}
type RetQueryResponse struct {
Status QueryResponse
2019-08-26 13:45:36 +00:00
Size uint64 // TODO: spec
// TODO: unseal price (+spec)
// TODO: address to send money for the deal?
MinPrice types.BigInt
2019-08-26 08:02:26 +00:00
}