-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
P3Low: Not priority right nowLow: Not priority right noweffort/hoursEstimated to take one or several hoursEstimated to take one or several hoursexp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulneed/analysisNeeds further analysis before proceedingNeeds further analysis before proceeding
Description
What
Convert the following methods on the GraphsyncExchange interface:
type GraphsyncExchange interface {
//...
// UnpauseRequest unpauses a request that was paused in a block hook based request ID
// Can also send extensions with unpause
UnpauseRequest(RequestID, ...ExtensionData) error
// PauseRequest pauses an in progress request (may take 1 or more blocks to process)
PauseRequest(RequestID) error
// UnpauseResponse unpauses a response that was paused in a block hook based on peer ID and request ID
// Can also send extensions with unpause
UnpauseResponse(peer.ID, RequestID, ...ExtensionData) error
// PauseResponse pauses an in progress response (may take 1 or more blocks to process)
PauseResponse(peer.ID, RequestID) error
// CancelResponse cancels an in progress response
CancelResponse(peer.ID, RequestID) error
// CancelRequest cancels an in progress request
CancelRequest(context.Context, RequestID) error
//...
}
to
type GraphsyncExchange interface {
//...
// UnpauseRequest unpauses a request that was paused in a block hook based request ID
// Can also send extensions with unpause
UnpauseRequest(RequestID, ...ExtensionData) <-chan error
// PauseRequest pauses an in progress request (may take 1 or more blocks to process)
PauseRequest(RequestID) <-chan error
// UnpauseResponse unpauses a response that was paused in a block hook based on peer ID and request ID
// Can also send extensions with unpause
UnpauseResponse(peer.ID, RequestID, ...ExtensionData) <-chan error
// PauseResponse pauses an in progress response (may take 1 or more blocks to process)
PauseResponse(peer.ID, RequestID) <-chan error
// CancelResponse cancels an in progress response
CancelResponse(peer.ID, RequestID) <-chan error
// CancelRequest cancels an in progress request
CancelRequest(context.Context, RequestID) <-chan error
//...
}
Why
The above methods delegate to the RequestManager and ResponseManager, and if you look at the code for their implementation, they all perform a channel wait implicitly. This makes them significantly more blocking than they need to be, and perhaps we want to let calling code decide when to wait for the results.
In particular we may want to unlock mutexs between the call and the wait.
Flagging as needs discussion as its a breaking change
Metadata
Metadata
Assignees
Labels
P3Low: Not priority right nowLow: Not priority right noweffort/hoursEstimated to take one or several hoursEstimated to take one or several hoursexp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulneed/analysisNeeds further analysis before proceedingNeeds further analysis before proceeding