-
Notifications
You must be signed in to change notification settings - Fork 17
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
Actually track progress for send/receive #53
Conversation
Setup channel tracking to properly support mutable send and receive operations
create hooks abstraction layer to manage mapping graphsync requests to data transfer events on channel ids. Also adds recording for data progress
Add tests for the hooks interface and verify we are able to receive data for both send and receive
4a24051
to
9c544fd
Compare
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.
Looks ok to me, looks like the tests are pretty complete. I had only suggestions, nothing blocking. The test instrumentation looked like a PITA to get done but it did make things pretty readable and easier to write new tests for.
require.NoError(t, err) | ||
sent, err = channelList.IncrementSent(datatransfer.ChannelID{Initiator: peers[0], ID: tid1}, 25) | ||
require.Equal(t, uint64(125), sent) | ||
require.NoError(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.
Just as a sanity check it might be nice to have a parallel update test to verify the thread safety when updating sent and received.
}, | ||
}, | ||
"recognized incoming request will record outgoing blocks": { | ||
action: func(gsData *graphsyncTestData) { |
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.
You could reasonably combine this with the first valid incoming request test.
if data.makeRequest != nil { | ||
request = data.makeRequest(requestID, channelID) | ||
} else { | ||
ext := &extension.TransferData{ |
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.
Consider extracting these to a well-named function for readability.
Goals
Setup hooks with graphsync to facilitate tracking progress on the request -- this is important to get to being able to pause and resume at key increments. This sets up a bunch of the needed infrastructure for doing pause/resume and other needed facilities for retrieval.
Implementation