-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add support for IPLD prime's budgets feature in selectors #235
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,8 @@ type graphsyncConfigOptions struct { | |
maxInProgressIncomingRequests uint64 | ||
maxInProgressOutgoingRequests uint64 | ||
registerDefaultValidator bool | ||
maxLinksPerOutgoingRequest uint64 | ||
maxLinksPerIncomingRequest uint64 | ||
} | ||
|
||
// Option defines the functional option type that can be used to configure | ||
|
@@ -136,6 +138,22 @@ func MaxInProgressOutgoingRequests(maxInProgressOutgoingRequests uint64) Option | |
} | ||
} | ||
|
||
// MaxLinksPerOutgoingRequests changes the allowed number of links an outgoing | ||
// request can traverse before failing | ||
func MaxLinksPerOutgoingRequests(maxLinksPerOutgoingRequest uint64) Option { | ||
return func(gs *graphsyncConfigOptions) { | ||
gs.maxLinksPerOutgoingRequest = maxLinksPerOutgoingRequest | ||
} | ||
} | ||
|
||
// MaxLinksPerIncomingRequests changes the allowed number of links an incoming | ||
// request can traverse before failing | ||
func MaxLinksPerIncomingRequests(maxLinksPerIncomingRequest uint64) Option { | ||
return func(gs *graphsyncConfigOptions) { | ||
gs.maxLinksPerIncomingRequest = maxLinksPerIncomingRequest | ||
} | ||
} | ||
|
||
// New creates a new GraphSync Exchange on the given network, | ||
// and the given link loader+storer. | ||
func New(parent context.Context, network gsnet.GraphSyncNetwork, | ||
|
@@ -179,11 +197,11 @@ func New(parent context.Context, network gsnet.GraphSyncNetwork, | |
|
||
asyncLoader := asyncloader.New(ctx, linkSystem, requestAllocator) | ||
requestQueue := taskqueue.NewTaskQueue(ctx) | ||
requestManager := requestmanager.New(ctx, asyncLoader, linkSystem, outgoingRequestHooks, incomingResponseHooks, networkErrorListeners, requestQueue, network.ConnectionManager()) | ||
requestManager := requestmanager.New(ctx, asyncLoader, linkSystem, outgoingRequestHooks, incomingResponseHooks, networkErrorListeners, requestQueue, network.ConnectionManager(), gsConfig.maxLinksPerOutgoingRequest) | ||
requestExecutor := executor.NewExecutor(requestManager, incomingBlockHooks, asyncLoader.AsyncLoad) | ||
responseAssembler := responseassembler.New(ctx, peerManager) | ||
peerTaskQueue := peertaskqueue.New() | ||
responseManager := responsemanager.New(ctx, linkSystem, responseAssembler, peerTaskQueue, requestQueuedHooks, incomingRequestHooks, outgoingBlockHooks, requestUpdatedHooks, completedResponseListeners, requestorCancelledListeners, blockSentListeners, networkErrorListeners, gsConfig.maxInProgressIncomingRequests, network.ConnectionManager()) | ||
responseManager := responsemanager.New(ctx, linkSystem, responseAssembler, peerTaskQueue, requestQueuedHooks, incomingRequestHooks, outgoingBlockHooks, requestUpdatedHooks, completedResponseListeners, requestorCancelledListeners, blockSentListeners, networkErrorListeners, gsConfig.maxInProgressIncomingRequests, network.ConnectionManager(), gsConfig.maxLinksPerIncomingRequest) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these have gotten pretty unwieldy. we probably want options or some other pattern for these constructors at some point There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they're initialized by the code itself, so I'd probably lean towards a struct, but I also want to move this whole package to an internal directory :) but yes for later |
||
graphSync := &GraphSync{ | ||
network: network, | ||
linkSystem: linkSystem, | ||
|
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.
can we ask for a tag of this?
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.
will do on monday
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.
before I commit go-graphsync v0.10.0 final