@@ -12,14 +12,15 @@ or other shared resources.
1212
1313The session is built on two primitives from the ` vortex-session ` crate:
1414
15- - ** ` VortexSession ` ** -- a cloneable, thread-safe map from Rust ` TypeId ` to a boxed value. Any
16- type that is ` Send + Sync + Debug + 'static ` can be stored as a session variable.
15+ - ** ` VortexSession ` ** -- a cloneable, thread-safe map from Rust ` TypeId ` to a shared
16+ (` Arc ` -wrapped) value. Any type that is ` Clone + Send + Sync + Debug + 'static ` can be stored
17+ as a session variable.
1718- ** ` Registry<T> ` ** -- a concurrent map from string IDs to values of type ` T ` , used by each
1819 component to look up registered plugins at runtime.
1920
20- Because ` VortexSession ` is backed by an ` Arc<DashMap> ` , cloning is cheap and all clones share
21- the same state. This makes it safe to hand the session to multiple threads, tasks, or I/O
22- operations without coordination.
21+ Because ` VortexSession ` is backed by an ` ArcSwap ` , cloning is cheap and all clones share the
22+ same state, with lock-free reads and copy-on-write writes . This makes it safe to hand the
23+ session to multiple threads, tasks, or I/O operations without coordination.
2324
2425## Component Registries
2526
@@ -95,14 +96,13 @@ all built-in components and encodings:
9596let session = VortexSession :: default ();
9697```
9798
98- For tests or specialized use-cases, sessions can be assembled from individual components using
99- the ` .with::<T>() ` builder :
99+ For tests or specialized use-cases, sessions can be assembled from individual components by
100+ starting from an empty session and chaining the ` .with::<T>() ` helpers :
100101
101102``` rust
102- let session = VortexSession :: builder ()
103+ let session = VortexSession :: empty ()
103104 . with :: <ArraySession >()
104105 . with :: <LayoutSession >()
105106 . with :: <ScalarFnSession >()
106- . with :: <RuntimeSession >()
107- . build ();
107+ . with :: <RuntimeSession >();
108108```
0 commit comments