Documentation ¶
Index ¶
- Constants
- Variables
- type AskRequest
- type AskResponse
- type Client
- func (c *Client) GetDeal(d cid.Cid) (*ClientDeal, error)
- func (c *Client) List() ([]ClientDeal, error)
- func (c *Client) QueryAsk(ctx context.Context, p peer.ID, a address.Address) (*types.SignedStorageAsk, error)
- func (c *Client) Run(ctx context.Context)
- func (c *Client) Start(ctx context.Context, p ClientDealProposal) (cid.Cid, error)
- func (c *Client) Stop()
- type ClientDeal
- type ClientDealProposal
- type ClientRequestValidator
- type MinerDeal
- type Proposal
- type Provider
- type ProviderRequestValidator
- type Response
- type SignedResponse
- type StorageDataTransferVoucher
- func (dv *StorageDataTransferVoucher) FromBytes(raw []byte) error
- func (dv *StorageDataTransferVoucher) Identifier() string
- func (t *StorageDataTransferVoucher) MarshalCBOR(w io.Writer) error
- func (dv *StorageDataTransferVoucher) ToBytes() ([]byte, error)
- func (t *StorageDataTransferVoucher) UnmarshalCBOR(r io.Reader) error
Constants ¶
const AskProtocolID = "/fil/storage/ask/1.0.1"
const DealProtocolID = "/fil/storage/mk/1.0.1"
Variables ¶
var ( // ErrWrongVoucherType means the voucher was not the correct type can validate against ErrWrongVoucherType = errors.New("cannot validate voucher type.") // ErrNoPushAccepted just means clients do not accept pushes for storage deals ErrNoPushAccepted = errors.New("client should not receive data for a storage deal.") // ErrNoPullAccepted just means providers do not accept pulls for storage deals ErrNoPullAccepted = errors.New("provider should not send data for a storage deal.") // ErrNoDeal means no active deal was found for this vouchers proposal cid ErrNoDeal = errors.New("no deal found for this proposal.") // ErrWrongPeer means that the other peer for this data transfer request does not match // the other peer for the deal ErrWrongPeer = errors.New("data Transfer peer id and Deal peer id do not match.") // ErrWrongPiece means that the pieceref for this data transfer request does not match // the one specified in the deal ErrWrongPiece = errors.New("base CID for deal does not match CID for piece.") // ErrInacceptableDealState means the deal for this transfer is not in a deal state // where transfer can be performed ErrInacceptableDealState = errors.New("deal is not a in a state where deals are accepted.") // DataTransferStates are the states in which it would make sense to actually start a data transfer DataTransferStates = []api.DealState{api.DealAccepted, api.DealUnknown} )
var ( // ErrDataTransferFailed means a data transfer for a deal failed ErrDataTransferFailed = errors.New("deal data transfer failed") )
var ProviderDsPrefix = "/deals/provider"
Functions ¶
This section is empty.
Types ¶
type AskRequest ¶
func (*AskRequest) MarshalCBOR ¶
func (t *AskRequest) MarshalCBOR(w io.Writer) error
func (*AskRequest) UnmarshalCBOR ¶
func (t *AskRequest) UnmarshalCBOR(r io.Reader) error
type AskResponse ¶
type AskResponse struct {
Ask *types.SignedStorageAsk
}
func (*AskResponse) MarshalCBOR ¶
func (t *AskResponse) MarshalCBOR(w io.Writer) error
func (*AskResponse) UnmarshalCBOR ¶
func (t *AskResponse) UnmarshalCBOR(r io.Reader) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetDeal ¶
func (c *Client) GetDeal(d cid.Cid) (*ClientDeal, error)
func (*Client) List ¶
func (c *Client) List() ([]ClientDeal, error)
type ClientDeal ¶
type ClientDeal struct { ProposalCid cid.Cid Proposal actors.StorageDealProposal State api.DealState Miner peer.ID MinerWorker address.Address DealID uint64 PublishMessage *types.SignedMessage // contains filtered or unexported fields }
func (*ClientDeal) MarshalCBOR ¶
func (t *ClientDeal) MarshalCBOR(w io.Writer) error
func (*ClientDeal) UnmarshalCBOR ¶
func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error
type ClientDealProposal ¶
type ClientDealProposal struct { Data cid.Cid PricePerEpoch types.BigInt ProposalExpiration uint64 Duration uint64 ProviderAddress address.Address Client address.Address MinerWorker address.Address MinerID peer.ID }
func (*ClientDealProposal) MarshalCBOR ¶
func (t *ClientDealProposal) MarshalCBOR(w io.Writer) error
func (*ClientDealProposal) UnmarshalCBOR ¶
func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error
type ClientRequestValidator ¶
type ClientRequestValidator struct {
// contains filtered or unexported fields
}
ClientRequestValidator validates data transfer requests for the client in a storage market
func NewClientRequestValidator ¶
func NewClientRequestValidator(deals dtypes.ClientDealStore) *ClientRequestValidator
NewClientRequestValidator returns a new client request validator for the given datastore
func (*ClientRequestValidator) ValidatePull ¶
func (c *ClientRequestValidator) ValidatePull( receiver peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, Selector ipld.Node) error
ValidatePull validates a pull request received from the peer that will receive data Will succeed only if: - voucher has correct type - voucher references an active deal - referenced deal matches the receiver (miner) - referenced deal matches the given base CID - referenced deal is in an acceptable state
func (*ClientRequestValidator) ValidatePush ¶
func (c *ClientRequestValidator) ValidatePush( sender peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, Selector ipld.Node) error
ValidatePush validates a push request received from the peer that will send data Will always error because clients should not accept push requests from a provider in a storage deal (i.e. send data to client).
type MinerDeal ¶
type Proposal ¶
type Proposal struct { DealProposal *actors.StorageDealProposal Piece cid.Cid // Used for retrieving from the client }
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func NewProvider(ds dtypes.MetadataDS, sminer *storage.Miner, secb *sectorblocks.SectorBlocks, dag dtypes.StagingDAG, dataTransfer dtypes.ProviderDataTransfer, fullNode api.FullNode) (*Provider, error)
func (*Provider) HandleAskStream ¶
func (*Provider) HandleStream ¶
type ProviderRequestValidator ¶
type ProviderRequestValidator struct {
// contains filtered or unexported fields
}
ProviderRequestValidator validates data transfer requests for the provider in a storage market
func NewProviderRequestValidator ¶
func NewProviderRequestValidator(deals dtypes.ProviderDealStore) *ProviderRequestValidator
NewProviderRequestValidator returns a new client request validator for the given datastore
func (*ProviderRequestValidator) ValidatePull ¶
func (m *ProviderRequestValidator) ValidatePull( receiver peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, Selector ipld.Node) error
ValidatePull validates a pull request received from the peer that will receive data. Will always error because providers should not accept pull requests from a client in a storage deal (i.e. send data to client).
func (*ProviderRequestValidator) ValidatePush ¶
func (m *ProviderRequestValidator) ValidatePush( sender peer.ID, voucher datatransfer.Voucher, baseCid cid.Cid, Selector ipld.Node) error
ValidatePush validates a push request received from the peer that will send data Will succeed only if: - voucher has correct type - voucher references an active deal - referenced deal matches the client - referenced deal matches the given base CID - referenced deal is in an acceptable state
type Response ¶
type Response struct { State api.DealState // DealProposalRejected Message string Proposal cid.Cid // DealAccepted StorageDealSubmission *types.SignedMessage }
type SignedResponse ¶
TODO: Do we actually need this to be signed?
func (*SignedResponse) MarshalCBOR ¶
func (t *SignedResponse) MarshalCBOR(w io.Writer) error
func (*SignedResponse) UnmarshalCBOR ¶
func (t *SignedResponse) UnmarshalCBOR(r io.Reader) error
type StorageDataTransferVoucher ¶
type StorageDataTransferVoucher struct { Proposal cid.Cid DealID uint64 }
StorageDataTransferVoucher is the voucher type for data transfers used by the storage market
func (*StorageDataTransferVoucher) FromBytes ¶
func (dv *StorageDataTransferVoucher) FromBytes(raw []byte) error
FromBytes converts the StorageDataTransferVoucher to raw bytes
func (*StorageDataTransferVoucher) Identifier ¶
func (dv *StorageDataTransferVoucher) Identifier() string
Identifier is the unique string identifier for a StorageDataTransferVoucher
func (*StorageDataTransferVoucher) MarshalCBOR ¶
func (t *StorageDataTransferVoucher) MarshalCBOR(w io.Writer) error
func (*StorageDataTransferVoucher) ToBytes ¶
func (dv *StorageDataTransferVoucher) ToBytes() ([]byte, error)
ToBytes converts the StorageDataTransferVoucher to raw bytes
func (*StorageDataTransferVoucher) UnmarshalCBOR ¶
func (t *StorageDataTransferVoucher) UnmarshalCBOR(r io.Reader) error