lotus/retrieval/types.go

67 lines
1.1 KiB
Go
Raw Normal View History

2019-08-26 08:02:26 +00:00
package retrieval
import (
"github.com/filecoin-project/lotus/api"
2019-08-26 08:02:26 +00:00
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/types"
2019-08-26 08:02:26 +00:00
)
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
type QueryResponseStatus uint64
2019-08-26 09:08:39 +00:00
2019-08-26 08:02:26 +00:00
const (
2019-08-26 18:23:11 +00:00
Available QueryResponseStatus = iota
2019-08-26 08:02:26 +00:00
Unavailable
)
2019-08-27 18:45:21 +00:00
const (
Accepted = iota
Error
Rejected
Unsealing
2019-08-27 18:45:21 +00:00
)
2019-08-26 18:23:11 +00:00
type Query struct {
2019-08-26 08:02:26 +00:00
Piece cid.Cid
2019-08-26 18:23:11 +00:00
// TODO: payment
2019-08-26 08:02:26 +00:00
}
2019-08-26 18:23:11 +00:00
type QueryResponse struct {
Status QueryResponseStatus
2019-08-26 08:02:26 +00:00
2019-08-26 13:45:36 +00:00
Size uint64 // TODO: spec
// TODO: unseal price (+spec)
2019-08-26 18:23:11 +00:00
// TODO: sectors to unseal
2019-08-26 13:45:36 +00:00
// TODO: address to send money for the deal?
MinPrice types.BigInt
2019-08-26 08:02:26 +00:00
}
2019-08-26 18:23:11 +00:00
type Unixfs0Offer struct {
2019-08-26 18:23:11 +00:00
Offset uint64
Size uint64
}
type RetParams struct {
2019-08-26 18:23:11 +00:00
Unixfs0 *Unixfs0Offer
}
type DealProposal struct {
2019-09-16 13:46:05 +00:00
Payment api.PaymentInfo
Ref cid.Cid
Params RetParams
}
2019-08-26 18:23:11 +00:00
type DealResponse struct {
Status uint64
2019-08-27 18:45:21 +00:00
Message string
2019-08-26 18:23:11 +00:00
}
2019-08-29 11:31:25 +00:00
type Block struct { // TODO: put in spec
Prefix []byte // TODO: fix cid.Prefix marshaling somehow
Data []byte
}