-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Context-Scoped Sessions #7198
Comments
This patch allows associating a "session key" with a context by calling `NewSession(ctx)`. When the session is used in a request, the exchange can call `GetSession(ctx)` to make the request in the appropriate session, or create a new session with the given session key. Implements ipfs/kubo#7198
so I gave it a glance over — generally, yes, thumbs up, good plan, seems much closer the web apps uses cookies (which store minimal data, but can be used to lookup other session information). one thing that isn’t totally clear to me: is the code you’ve written out supposed to go in go-bitswap or go-ipfs? If go-bitswap, I wouldn’t want to disable the ability to make sessions manually for some other use case besides go-ipfs (for example, filecoin, which may still use bitswap sessions for blocksync in Lotus? -- not sure there) |
This patch allows associating a "session key" with a context by calling `NewSession(ctx)`. When the session is used in a request, the exchange can call `GetSession(ctx)` to make the request in the appropriate session, or create a new session with the given session key. Implements ipfs/kubo#7198
In go-bitswap. I'll leave the |
This patch allows associating a "session key" with a context by calling `NewSession(ctx)`. When the session is used in a request, the exchange can call `GetSession(ctx)` to make the request in the appropriate session, or create a new session with the given session key. Implements ipfs/kubo#7198
This patch allows associating a "session key" with a context by calling `NewSession(ctx)`. When the session is used in a request, the exchange can call `GetOrCreateSession(ctx)` to make the request in the appropriate session, or create a new session with the given session key. Implements ipfs/kubo#7198
I had to change the design slightly to use integer IDs:
So now I'm just atomically allocating increasing 64bit IDs. |
This patch allows associating a "session key" with a context by calling `NewSession(ctx)`. When the session is used in a request, the exchange can call `GetOrCreateSession(ctx)` to make the request in the appropriate session, or create a new session with the given session key. Implements ipfs/kubo#7198
This patch allows associating a "session key" with a context by calling `NewSession(ctx)`. When the session is used in a request, the exchange can call `GetOrCreateSession(ctx)` to make the request in the appropriate session, or create a new session with the given session key. Implements ipfs/kubo#7198
* Ensure we have a single session per gateway request. * Use a session in the ipfs refs command. * Start a session before resolving the pin root (also fixes sessions while pinning). * Update go-merkledag to reliably create sessions. part of #7198
* Ensure we have a single session per gateway request. * Use a session in the ipfs refs command. * Start a session before resolving the pin root (also fixes sessions while pinning). * Update go-merkledag to reliably create sessions. part of #7198
* Ensure we have a single session per gateway request. * Use a session in the ipfs refs command. * Start a session before resolving the pin root (also fixes sessions while pinning). * Update go-merkledag to reliably create sessions. part of #7198
* Ensure we have a single session per gateway request. * Use a session in the ipfs refs command. * Start a session before resolving the pin root (also fixes sessions while pinning). * Update go-merkledag to reliably create sessions. part of #7198
* Ensure we have a single session per gateway request. * Use a session in the ipfs refs command. * Start a session before resolving the pin root (also fixes sessions while pinning). * Update go-merkledag to reliably create sessions. part of #7198
This isn't perfect (we only use sessions after resolving the root cid) but it's better than what we have. The real solution is #7198 so we can use sessions everywhere.
This isn't perfect (we only use sessions after resolving the root cid) but it's better than what we have. The real solution is #7198 so we can use sessions everywhere.
This isn't perfect (we only use sessions after resolving the root cid) but it's better than what we have. The real solution is ipfs#7198 so we can use sessions everywhere.
This isn't perfect (we only use sessions after resolving the root cid) but it's better than what we have. The real solution is ipfs#7198 so we can use sessions everywhere.
This isn't perfect (we only use sessions after resolving the root cid) but it's better than what we have. The real solution is ipfs#7198 so we can use sessions everywhere.
Currently, bitswap sessions are hard to work with because we need to:
Usually 2 involves re-creating these services. This can be very painful and we have many places in go-ipfs where we simply aren't doing this.
Instead, we should associate a session with a context. That way, whenever we use the context, we use the session. When we cancel the context, we cancel the session.
PRs
Design
Store a session "key" in the session to identify the session.
Alternatives
I've considered two alternatives:
Embedded Exchange
We could:
On one hand, this is nice because we can embed alternative exchanges for a specific request. For example, we could embed an offline exchange to perform an offline lookup.
On the other hand:
Abstract Session
We could also store an abstract session object in the context (#6525). However, this would require building a general-purpose, abstract session/state manager. The session-key design lets us do everything the abstract session proposal does, without requiring a general-purpose anything.
The text was updated successfully, but these errors were encountered: