Skip to content
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

feat: use new exchange session logic #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Stebalien
Copy link
Member

Instead of manually creating a session and hoping the DAG we've been passed
implements the Session interface, add the session to the context in WalkDepth.
This should ensure that any walk has an associated session.

part of ipfs/kubo#7198

Instead of manually creating a session and hoping the DAG we've been passed
implements the Session interface, add the session to the context in WalkDepth.
This should ensure that _any_ walk has an associated session.
Comment on lines +17 to +19
// Deprecated: Use exchange.NewSession to wrap your context. This function only
// works if the NodeGetter happens to implement the session interface. If it has
// been wrapped in some way, it won't work.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you specify how you can then get the session out of the context afterwards too?

Might be worth changing the signature and returning an error when the NodeGetter is not a SessionMaker. People might be using this wrong and the deprecation notice will not really fix their code. Thinking that someone is using this wrong without deep-auditing their code will be difficult for us if they ever ask, and this might be a major perf sink for them even in the simplest application.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a link to the NewSession docs (and some examples there) suffice? I'd like to avoid duplicating information.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants