deals

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2019 License: Apache-2.0, MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const AskProtocolID = "/fil/storage/ask/1.0.1"
View Source
const DealProtocolID = "/fil/storage/mk/1.0.1"

Variables

View Source
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}
)
View Source
var (
	// ErrDataTransferFailed means a data transfer for a deal failed
	ErrDataTransferFailed = errors.New("deal data transfer failed")
)
View Source
var ProviderDsPrefix = "/deals/provider"

Functions

This section is empty.

Types

type AskRequest

type AskRequest struct {
	Miner address.Address
}

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 NewClient

func NewClient(sm *stmgr.StateManager, chain *store.ChainStore, h host.Host, w *wallet.Wallet, dag dtypes.ClientDAG, dataTransfer dtypes.ClientDataTransfer, discovery *discovery.Local, fm *market.FundMgr, deals dtypes.ClientDealStore, chainapi full.ChainAPI, stateapi full.StateAPI) *Client

func (*Client) GetDeal

func (c *Client) GetDeal(d cid.Cid) (*ClientDeal, error)

func (*Client) List

func (c *Client) List() ([]ClientDeal, error)

func (*Client) QueryAsk

func (c *Client) QueryAsk(ctx context.Context, p peer.ID, a address.Address) (*types.SignedStorageAsk, error)

func (*Client) Run

func (c *Client) Run(ctx context.Context)

func (*Client) Start

func (c *Client) Start(ctx context.Context, p ClientDealProposal) (cid.Cid, error)

func (*Client) Stop

func (c *Client) Stop()

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 MinerDeal struct {
	Client      peer.ID
	Proposal    actors.StorageDealProposal
	ProposalCid cid.Cid
	State       api.DealState

	Ref cid.Cid

	DealID   uint64
	SectorID uint64 // Set when State >= DealStaged
	// contains filtered or unexported fields
}

func (*MinerDeal) MarshalCBOR

func (t *MinerDeal) MarshalCBOR(w io.Writer) error

func (*MinerDeal) UnmarshalCBOR

func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error

type Proposal

type Proposal struct {
	DealProposal *actors.StorageDealProposal

	Piece cid.Cid // Used for retrieving from the client
}

func (*Proposal) MarshalCBOR

func (t *Proposal) MarshalCBOR(w io.Writer) error

func (*Proposal) UnmarshalCBOR

func (t *Proposal) UnmarshalCBOR(r io.Reader) error

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 (p *Provider) HandleAskStream(s inet.Stream)

func (*Provider) HandleStream

func (p *Provider) HandleStream(s inet.Stream)

func (*Provider) Run

func (p *Provider) Run(ctx context.Context)

func (*Provider) SetPrice

func (p *Provider) SetPrice(price types.BigInt, ttlsecs int64) error

func (*Provider) Stop

func (p *Provider) Stop()

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
}

func (*Response) MarshalCBOR

func (t *Response) MarshalCBOR(w io.Writer) error

func (*Response) UnmarshalCBOR

func (t *Response) UnmarshalCBOR(r io.Reader) error

type SignedResponse

type SignedResponse struct {
	Response Response

	Signature *types.Signature
}

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

func (*SignedResponse) Verify

func (r *SignedResponse) Verify(addr address.Address) 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL