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

replace AddAsk with SetAsk, to convey intent #275

Merged
merged 1 commit into from
Jun 15, 2020
Merged

replace AddAsk with SetAsk, to convey intent #275

merged 1 commit into from
Jun 15, 2020

Conversation

laser
Copy link
Contributor

@laser laser commented Jun 15, 2020

Why does this PR exist?

Searching for a DeleteAsk operation caused me to go down the rabbit hole of trying to figure out how asks added with the AddAsk method could be replaced with a new ask (when the miner changed their minimum piece size, for instance).

As it turns out, the current implementation of go-fil-markets allows a storage miner to have exactly one ask, manipulated through the misleadingly-named AddAsk method.

What's in this PR?

This PR replaces the AddAsk method with a SetAsk method, and replaces ListAsks with GetAsk.

Alternative approaches

If a SignedStorageAsk had an identity (I don't see that it does right now), we could preserve the AddAsk and ListAsks signatures. We'd need to add a DeleteAsk method, though.

The current implementation of go-fil-markets allows a storage miner to
have exactly one ask, but the interface (before this commit) allowed the
StorageProvider to return multiple asks, and the name AddAsk implies an
additive operation that was, in fact, a replace of any existing ask.
@codecov-commenter
Copy link

Codecov Report

Merging #275 into master will increase coverage by 0.09%.
The diff coverage is 16.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #275      +/-   ##
==========================================
+ Coverage   65.08%   65.16%   +0.09%     
==========================================
  Files          40       40              
  Lines        2362     2359       -3     
==========================================
  Hits         1537     1537              
+ Misses        700      697       -3     
  Partials      125      125              
Impacted Files Coverage Δ
storagemarket/impl/provider.go 5.54% <0.00%> (+0.07%) ⬆️
storagemarket/types.go 33.34% <ø> (ø)
storagemarket/impl/storedask/storedask.go 80.52% <50.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 095f786...6d9f11f. Read the comment docs.

@laser laser marked this pull request as ready for review June 15, 2020 17:03
@laser laser requested review from hannahhoward and ingar June 15, 2020 17:03
@hannahhoward hannahhoward merged commit eec6fdc into filecoin-project:master Jun 15, 2020
@dirkmc dirkmc mentioned this pull request Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants