-
Notifications
You must be signed in to change notification settings - Fork 59
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
Move to an explicit piecestore and explicit unsealing. #54
Conversation
Outlines node interface changes and relevant code to remove the need for the node to track information about pieces
When retrieving, manually unseal as neccesary based on piece CID, removing need for node implementors to maintain transparently sealed blockstore
Initial implementation of the piecestore - based on statestore
Codecov Report
@@ Coverage Diff @@
## master #54 +/- ##
=========================================
+ Coverage 32.43% 33.82% +1.4%
=========================================
Files 33 36 +3
Lines 2350 2608 +258
=========================================
+ Hits 762 882 +120
- Misses 1514 1590 +76
- Partials 74 136 +62
Continue to review full report at Codecov.
|
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.
Some non-blocking comments... 👍
} | ||
|
||
func (ps *pieceStore) AddDealForPiece(pieceCID []byte, dealInfo DealInfo) error { | ||
// Do we need to de-dupe or anything here? |
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.
This comment is wondering about whether adding duplicate DealInfo
(or BlockInfo
below) is necessarily bad or not. Since it's a local store maybe it's not a big deal.
HasBlockInfo(pieceCID []byte) (bool, error) | ||
HasDealInfo(pieceCID []byte) (bool, error) |
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.
Are these going to be used in another context? They are unused here -- or would they be more useful if they didn't return an error?
@ingar I'm gonna mess with this interface some more in my next PR, cause I realize we actually are gonna have to change some more things... :( so let's not block on it for now. |
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.
All the suggestions I have are super minor. Your call
assert.NoError(t, err) | ||
blockInfos := []piecestore.BlockInfo{{testCid, 42, 43}} | ||
|
||
err = ps.AddBlockInfosToPiece(pieceCid, blockInfos) |
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.
this should really be broken up into test cases for test hygiene and easier auditing.
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.
yes, this is gonna get changed a bunch shortly so I will hold off for now
@@ -10,6 +10,8 @@ import ( | |||
"github.com/filecoin-project/go-fil-markets/shared/types" | |||
) | |||
|
|||
// TestRetrievalClientNode is a node adapter for a retrieval client whose responses |
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.
🙇♀ for clarifying comments
) | ||
|
||
func TestNewLoaderWithUnsealing(t *testing.T) { | ||
ctx := context.Background() |
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 don't really understand at this time how IPLD trees work so I can't review this adequately.
|
||
// attemp to load again, will not unseal, will fail | ||
_, err = loaderWithUnsealing.Load(testdata.MiddleMapNodeLnk, ipld.LinkContext{}) | ||
require.Error(t, err) |
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'd feel better with require/assert.EqualError to check that the error is what you expected.
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.
yea so, this isn't the best test, but the error is actually the same as if it weren't in the blockstore --
if it unsealed a second time, it would work, cause it would put the deleted block back in the block store.
so it's not a specific error -- it just doesn't attempt another unseal -- and then fails reading from the blockstore as a result
|
||
if err == nil { | ||
if err == nil && len(pieceInfo.Deals) > 0 { | ||
answer.Status = retrievalmarket.QueryResponseAvailable | ||
// TODO: get price, look for already unsealed ref to reduce work |
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.
Do these TODOs need to be captured in issues?
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.
nah that's copied code that should get deleted :)
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.
actually i'm not sure will take another look
providerNode.ExpectPiece(piece, expectedQR.Size*uint64(i+1)) | ||
pieceStore.ExpectPiece(piece, piecestore.PieceInfo{ | ||
Deals: []piecestore.DealInfo{ | ||
piecestore.DealInfo{ |
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 inner piecestore.DealInfo is redundant. only worth changing if you're touching the file IMO
Fix todos, import orders, extraneous typing
Goals
Reduce the node adapter interfaces so they can be satisfied by both go-filecoin and lotus, while also fully supporting CAR files and seperating interface boundaries
Implementation