Skip to content

Commit

Permalink
Tidy up comments (#405)
Browse files Browse the repository at this point in the history
Signed-off-by: Kirk Baird <baird.k@outlook.com>
  • Loading branch information
kirk-baird authored Sep 18, 2020
1 parent 64f78f7 commit ccb2cbf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
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

0 comments on commit ccb2cbf

Please sign in to comment.