Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up comments #405

Merged
merged 1 commit into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions retrievalmarket/impl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ Query sends a retrieval query to a specific retrieval provider, to determine
if the provider can serve a retrieval request and what its specific parameters for
the request are.

The client a new `RetrievalQueryStream` for the chosen peer ID,
and calls WriteQuery on it, which constructs a data-transfer message and writes it to the Query stream.
The client creates a new `RetrievalQueryStream` for the chosen peer ID,
and calls `WriteQuery` on it, which constructs a data-transfer message and writes it to the Query stream.
*/
func (c *Client) Query(ctx context.Context, p retrievalmarket.RetrievalPeer, payloadCID cid.Cid, params retrievalmarket.QueryParams) (retrievalmarket.QueryResponse, error) {
err := c.addMultiaddrs(ctx, p)
Expand Down Expand Up @@ -171,7 +171,7 @@ greatest likelihood the provider will accept the deal

When called, the client takes the following actions:

1. Creates a deal ID using the next value from its storedcounter.
1. Creates a deal ID using the next value from its `storedCounter`.

2. Constructs a `DealProposal` with deal terms

Expand Down Expand Up @@ -284,7 +284,7 @@ func (c *Client) TryRestartInsufficientFunds(paymentChannel address.Address) err
return nil
}

// CancelDeal attempts to cancel an inprogress deal
// CancelDeal attempts to cancel an in progress deal
func (c *Client) CancelDeal(dealID retrievalmarket.DealID) error {
return c.stateMachines.Send(dealID, retrievalmarket.ClientEventCancel)
}
Expand All @@ -298,7 +298,7 @@ func (c *Client) GetDeal(dealID retrievalmarket.DealID) (retrievalmarket.ClientD
return out, nil
}

// ListDeals lists in all known retrieval deals
// ListDeals lists all known retrieval deals
func (c *Client) ListDeals() (map[retrievalmarket.DealID]retrievalmarket.ClientDealState, error) {
var deals []retrievalmarket.ClientDealState
err := c.stateMachines.List(&deals)
Expand Down
10 changes: 5 additions & 5 deletions retrievalmarket/impl/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,22 +172,22 @@ func (p *Provider) SubscribeToEvents(subscriber retrievalmarket.ProviderSubscrib
return retrievalmarket.Unsubscribe(p.subscribers.Subscribe(subscriber))
}

// GetAsk returns the current parameters deals this provider accepts
// GetAsk returns the current deal parameters this provider accepts
func (p *Provider) GetAsk() *retrievalmarket.Ask {
p.askLk.Lock()
defer p.askLk.Unlock()
a := *p.ask
return &a
}

// SetAsk sets the parameters for deals this provider accepts
// SetAsk sets the deal parameters this provider accepts
func (p *Provider) SetAsk(ask *retrievalmarket.Ask) {
p.askLk.Lock()
defer p.askLk.Unlock()
p.ask = ask
}

// ListDeals lists in all known retrieval deals
// ListDeals lists all known retrieval deals
func (p *Provider) ListDeals() map[retrievalmarket.ProviderDealIdentifier]retrievalmarket.ProviderDealState {
var deals []retrievalmarket.ProviderDealState
_ = p.stateMachines.List(&deals)
Expand All @@ -205,11 +205,11 @@ A Provider handling a retrieval `Query` does the following:

1. Get the node's chain head in order to get its miner worker address.

2. Look in its piece store for determine if it can serve the given payload CID.
2. Look in its piece store to determine if it can serve the given payload CID.

3. Combine these results with its existing parameters for retrieval deals to construct a `retrievalmarket.QueryResponse` struct.

4.0 Writes this response to the `Query` stream.
4. Writes this response to the `Query` stream.

The connection is kept open only as long as the query-response exchange.
*/
Expand Down
2 changes: 1 addition & 1 deletion retrievalmarket/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ type QueryResponse struct {
// QueryResponseUndefined is an empty QueryResponse
var QueryResponseUndefined = QueryResponse{}

// PieceRetrievalPrice is the total price to retrieve the piece (size * MinPricePerByte)
// PieceRetrievalPrice is the total price to retrieve the piece (size * MinPricePerByte + UnsealedPrice)
func (qr QueryResponse) PieceRetrievalPrice() abi.TokenAmount {
return big.Add(big.Mul(qr.MinPricePerByte, abi.NewTokenAmount(int64(qr.Size))), qr.UnsealPrice)
}
Expand Down