-
Notifications
You must be signed in to change notification settings - Fork 87
Vortex Session #5111
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
Vortex Session #5111
Conversation
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
vortex-session/src/lib.rs
Outdated
| /// Creates an empty Vortex session. | ||
| /// | ||
| /// Do not call this function otherwise you will end up with an empty session! | ||
| pub fn _empty() -> Self { |
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.
any reason to make pub?
if we really don't want people calling it we could slap a #[doc(hidden)] on it
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.
I haven't yet decided between:
- User creates an empty session, in which case we can just impl Default and the functions on the session are get_or_create.
- Downstream crates must explicitly initialize their state into the session. Possibly using inventory?? This seems weirder to me though. But it does allow for non-default state on the session, for example I don't think the async runtime should be defaulted on first access?
Signed-off-by: Nicholas Gates <[email protected]>
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Nicholas Gates <[email protected]>
|
another possible solution is to split the implementation and the trait - we implement some |
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
|
@AdamGS the trait definition wouldn't be able to reference types from any of the other vortex crates. If you remove those types, you end up with general get/set on the session, which is basically the design we end up with here. |
Deploying vortex-bench with
|
| Latest commit: |
1bb1aa3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://80c9ae0b.vortex-93b.pages.dev |
| Branch Preview URL: | https://ngates-vortex-session.vortex-93b.pages.dev |
Signed-off-by: Nicholas Gates <[email protected]>
|
@gatesn Depending on how its used, the trait can potentially only know about the traits, right? in which case it could be placed really close to the root of the dependency tree. It might require some restructuring there, which might not be desirable. |
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
CodSpeed Performance ReportMerging #5111 will not alter performanceComparing Summary
Benchmarks breakdown
Footnotes
|
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
| /// | ||
| /// NOTE: this function will be changed in the future to encapsulate logic for using different | ||
| /// Vortex "Editions" that may support different sets of encodings. | ||
| pub fn register_default_encodings(session: &VortexSession) { |
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.
it's weird that this is not a mut ref?
VortexSession
We have had a
VortexSessionobject for a while, but never really made use of it, in a large part because none of the Vortex components could take a dependency without creating a cycle.Since Vortex is incredibly extensible, the idea of the session is to hold the plugin registries for arrays, layouts, expressions and so on. While our existing solution does this, it created very fragile APIs where it was possible to construct file readers/writers without using the main registry of plugins. Similarly, metrics registries were getting lost and some metrics ended up in isolated
VortexMetrics::default()instances - never to see the light of day.This PR introduces a top-level VortexSession create that essentially acts as a type map. Components of Vortex can register session state, and then read it back again later. This allows components to accept and hold a VortexSession internally, while our root
vortexcrate performs a default configuration.Runtime Handles
One of the most fragile bits of mis-configured API was the Vortex runtime handle. This is our abstraction over runtimes (in practice, only over Tokio or a custom smol-based CurrentThreadRuntime) and provides an API for components to spawn CPU, I/O, blocking and other types of work.
This PR demonstrates the session API by holding a runtime handle and plumbing this through APIs that formerly accepted a with_handle argument.
Language Bindings
This PR doesn't not completely migrate language bindings onto a session-based API. Many bindings still use a global static session where a session instance would be preferred.