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
review of dagstore + carv2 #596
Conversation
268b814
to
f122745
Compare
Codecov Report
@@ Coverage Diff @@
## feat/wip-markets-dagstore #596 +/- ##
=============================================================
+ Coverage 64.97% 65.83% +0.87%
=============================================================
Files 67 63 -4
Lines 4649 4562 -87
=============================================================
- Hits 3020 3003 -17
+ Misses 1342 1268 -74
- Partials 287 291 +4
Continue to review full report at Codecov.
|
FastRetrieval: params.FastRetrieval, | ||
DealStages: storagemarket.NewDealStages(), | ||
CreationTime: curTime(), | ||
IndexedCAR: params.IndexedCAR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name of this field to describe function, and not type. I don't think this affects existing deals, because I believe that CBOR is positional, but would love a confirmation, since you've seen several upgrades through @dirkmc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure about that - maybe write a test to confirm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's gonna be hard writing a test for that :-( I'll hack something but it won't go in as a test.
@@ -263,7 +262,7 @@ func (p *Provider) receiveDeal(s network.StorageDealStream) error { | |||
Ref: proposal.Piece, | |||
FastRetrieval: proposal.FastRetrieval, | |||
CreationTime: curTime(), | |||
CARv2FilePath: carV2FilePath, | |||
InboundCAR: path, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the field name. Idem as above @dirkmc
// re-track all deals for whom we still have a local blockstore. | ||
for _, d := range deals { | ||
if _, err := os.Stat(d.InboundCAR); err == nil && d.Ref != nil { | ||
_, _ = p.stores.GetOrOpen(d.ProposalCid.String(), d.InboundCAR, d.Ref.Root) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now load all in progress deals whose inbound CAR still exists on disk into the trackers. This reduces complexity of the former FinalizeReadWriteBlockstore on providerDealEnvironment, which used to accept the root CID and the path to reload the entry in the tracker if it didn't exist. It puzzled me quite a bit. I believe restoring state on startup is more correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds right to me 👍
func (p *providerDealEnvironment) FinalizeReadWriteBlockstore(proposalCid cid.Cid, carPath string, rootCid cid.Cid) error { | ||
bs, err := p.p.readWriteBlockStores.GetOrCreate(proposalCid.String(), carPath, rootCid) | ||
func (p *providerDealEnvironment) FinalizeBlockstore(proposalCid cid.Cid) error { | ||
bs, _, err := p.p.stores.Get(proposalCid.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's what I was talking about above.
@@ -0,0 +1,161 @@ | |||
package stores |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous filestorecaradapter
package is now merged into stores
.
// re-track all deals for whom we still have a local blockstore. | ||
for _, d := range deals { | ||
if _, err := os.Stat(d.InboundCAR); err == nil && d.Ref != nil { | ||
_, _ = p.stores.GetOrOpen(d.ProposalCid.String(), d.InboundCAR, d.Ref.Root) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds right to me 👍
Looks like you need to run |
The |
stores
.TODO
Refactoring migration.