Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vortex-data/vortex/llms.txt
Use this file to discover all available pages before exploring further.
VortexSession is the runtime configuration container for the Vortex ecosystem. It is a type-indexed map that holds all extensible state — registered encodings, layouts, extension dtypes, scalar functions, and the async runtime handle. There is typically one session per process, and it is passed explicitly through the API rather than relying on global or thread-local state.
Plugins can also store their own state in the session, for example to hold caches or other shared resources.
Design
The session is built on two primitives from thevortex-session crate:
VortexSession— a cloneable, thread-safe map from RustTypeIdto a boxed value. Any type implementingSessionVar(which requiresSend + Sync + Debug + 'static) can be stored.Registry<T>— a concurrent map from string IDs to values of typeT, used by each component to look up registered plugins at runtime.
VortexSession is backed by an Arc<DashMap>, cloning is cheap and all clones share the same underlying state. This makes it safe to hand the session to multiple threads, async tasks, or I/O operations without any explicit coordination.
Component Registries
Each Vortex crate defines a session variable — a type that implementsSessionVar — that holds a registry of plugins for that component. Session variables are created lazily on first access using their Default implementation, which pre-populates the built-in plugins.
| Session Variable | Crate | Registry Contents |
|---|---|---|
DTypeSession | vortex-array | Extension dtype vtables (Date, Time, …) |
ArraySession | vortex-array | Array encoding vtables (ALP, FSST, …) |
ScalarFnSession | vortex-array | Scalar function vtables |
LayoutSession | vortex-layout | Layout encoding vtables (Flat, Chunked, …) |
RuntimeSession | vortex-io | Async runtime handle |
CudaSession | vortex-cuda | CUDA context, compiled kernels, and stream pool |
ArraySession::default() registers the 14 built-in encodings (Null, Bool, Primitive, Struct, etc.), and LayoutSession::default() registers the 5 built-in layouts (Flat, Struct, Chunked, Zoned, Dict).
Constructing a Session
TheVortexSession::default() provided by the top-level vortex crate constructs a session with all built-in components registered:
.with::<T>() builder method:
Registering Plugins
Plugins register with the session by accessing the relevant component registry and callingregister:
initialize function that registers everything at once. The top-level vortex crate calls these during VortexSession::default() to register all built-in plugins.
Attempting to insert a session variable type that already exists (via
.with::<T>()) will panic. Use .with_some(var) to insert a pre-built variable, and avoid calling .with::<T>() more than once per type.Explicit Session Passing
Sessions are passed explicitly through constructors and method arguments. Every API that needs access to registries — file readers, writers, scan builders, layout readers — receives the session directly:OpenOptionsSessionExt adds .open_options() to any session that has ArraySession, LayoutSession, and RuntimeSession registered. This lets the type system enforce that the required components are present before a file can be opened.
Thread Safety and Scoping
VortexSession is Clone + Send + Sync. All session variable access goes through DashMap, which uses sharded locking to allow concurrent reads and writes. Short-lived borrows are returned as Ref<'_, T> and RefMut<'_, T> wrappers — these hold a read or write lock on the map shard for their lifetime, so they should not be held across .await points.
Because all clones share the same Arc<DashMap>, a plugin registered into one clone is immediately visible through all other clones of the same session.
Unknown Plugin Policy
By default, encountering an unknown encoding or layout ID during deserialization returns an error. For forward-compatibility scenarios where older readers should tolerate files written with newer encodings, the session can be configured to allow unknown plugins:Implementing a SessionVar
Any type can be stored in the session by implementingSessionVar:
session.get::<MyPluginCache>().