Create a new global session provider # Arguments `transaction_manager` - Transaction manager for session transaction state `storage_manager` - Storage manager for data access `catalog_manager` - Catalog manager for schema and metadata access # Returns A new GlobalSessionProvider instance that shares its session pool with all other GlobalSessionProvider instances. # Note Only the FIRST call t
(
transaction_manager: Arc<TransactionManager>,
storage_manager: Arc<StorageManager>,
catalog_manager: Arc<RwLock<CatalogManager>>,
)
| 93 | /// and ignore the parameters. This is intentional for server mode where you want ONE |
| 94 | /// session pool for the entire process. |
| 95 | pub fn new( |
| 96 | transaction_manager: Arc<TransactionManager>, |
| 97 | storage_manager: Arc<StorageManager>, |
| 98 | catalog_manager: Arc<RwLock<CatalogManager>>, |
| 99 | ) -> Self { |
| 100 | // Initialize the global session manager if not already initialized |
| 101 | let mut global_manager = GLOBAL_SESSION_MANAGER.write().unwrap(); |
| 102 | if global_manager.is_none() { |
| 103 | let manager = Arc::new(SessionManager::new( |
| 104 | transaction_manager, |
| 105 | storage_manager, |
| 106 | catalog_manager, |
| 107 | )); |
| 108 | *global_manager = Some(manager); |
| 109 | } |
| 110 | drop(global_manager); |
| 111 | |
| 112 | Self { |
| 113 | _marker: std::marker::PhantomData, |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | /// Get the global session manager |
| 118 | /// |