1- use super :: block_on;
2- use super :: catalog_provider:: HotDataCatalogProvider ;
31use crate :: catalog:: { CatalogManager , ConnectionInfo , SqliteCatalogManager , TableInfo } ;
42use crate :: datafetch:: DataFetcher ;
3+ use crate :: datafusion:: { block_on, RivetCatalogProvider } ;
54use crate :: source:: Source ;
65use crate :: storage:: { FilesystemStorage , StorageManager } ;
76use anyhow:: Result ;
@@ -20,13 +19,13 @@ pub struct QueryResponse {
2019}
2120
2221/// The main query engine that manages connections, catalogs, and query execution.
23- pub struct HotDataEngine {
22+ pub struct RivetEngine {
2423 catalog : Arc < dyn CatalogManager > ,
2524 df_ctx : SessionContext ,
2625 storage : Arc < dyn StorageManager > ,
2726}
2827
29- impl HotDataEngine {
28+ impl RivetEngine {
3029 /// Create a new engine instance and register all existing connections.
3130 pub async fn new ( catalog_path : & str ) -> Result < Self > {
3231 Self :: new_with_paths ( catalog_path, "cache" , "state" , false ) . await
@@ -123,7 +122,7 @@ impl HotDataEngine {
123122 for conn in connections {
124123 let source: Source = serde_json:: from_str ( & conn. config_json ) ?;
125124
126- let catalog_provider = Arc :: new ( HotDataCatalogProvider :: new (
125+ let catalog_provider = Arc :: new ( RivetCatalogProvider :: new (
127126 conn. id ,
128127 conn. name . clone ( ) ,
129128 Arc :: new ( source) ,
@@ -169,7 +168,7 @@ impl HotDataEngine {
169168 }
170169
171170 // Register with DataFusion
172- let catalog_provider = Arc :: new ( HotDataCatalogProvider :: new (
171+ let catalog_provider = Arc :: new ( RivetCatalogProvider :: new (
173172 conn_id,
174173 name. to_string ( ) ,
175174 Arc :: new ( source) ,
@@ -249,7 +248,7 @@ impl HotDataEngine {
249248 // This causes DataFusion to drop any open file handles to the cached files
250249 let source: Source = serde_json:: from_str ( & conn. config_json ) ?;
251250
252- let catalog_provider = Arc :: new ( HotDataCatalogProvider :: new (
251+ let catalog_provider = Arc :: new ( RivetCatalogProvider :: new (
253252 conn. id ,
254253 conn. name . clone ( ) ,
255254 Arc :: new ( source) ,
@@ -291,7 +290,7 @@ impl HotDataEngine {
291290 // This causes DataFusion to drop any open file handles to the cached files
292291 let source: Source = serde_json:: from_str ( & conn. config_json ) ?;
293292
294- let catalog_provider = Arc :: new ( HotDataCatalogProvider :: new (
293+ let catalog_provider = Arc :: new ( RivetCatalogProvider :: new (
295294 conn. id ,
296295 conn. name . clone ( ) ,
297296 Arc :: new ( source) ,
@@ -358,39 +357,39 @@ impl HotDataEngine {
358357 }
359358}
360359
361- impl Drop for HotDataEngine {
360+ impl Drop for RivetEngine {
362361 fn drop ( & mut self ) {
363362 // Ensure catalog connection is closed when engine is dropped
364363 let _ = block_on ( self . catalog . close ( ) ) ;
365364 }
366365}
367366
368- /// Builder for HotDataEngine
367+ /// Builder for RivetEngine
369368///
370369/// # Example
371370///
372371/// ```no_run
373- /// use rivetdb::datafusion::HotDataEngine ;
372+ /// use rivetdb::RivetEngine ;
374373/// use std::path::PathBuf;
375374///
376- /// let builder = HotDataEngine ::builder()
375+ /// let builder = RivetEngine ::builder()
377376/// .metadata_dir(PathBuf::from("/tmp/rivet"));
378377///
379378/// // let engine = builder.build().unwrap();
380379/// ```
381- pub struct HotDataEngineBuilder {
380+ pub struct RivetEngineBuilder {
382381 metadata_dir : Option < PathBuf > ,
383382 catalog : Option < Arc < dyn CatalogManager > > ,
384383 storage : Option < Arc < dyn StorageManager > > ,
385384}
386385
387- impl Default for HotDataEngineBuilder {
386+ impl Default for RivetEngineBuilder {
388387 fn default ( ) -> Self {
389388 Self :: new ( )
390389 }
391390}
392391
393- impl HotDataEngineBuilder {
392+ impl RivetEngineBuilder {
394393 pub fn new ( ) -> Self {
395394 Self {
396395 metadata_dir : None ,
@@ -414,7 +413,7 @@ impl HotDataEngineBuilder {
414413 self
415414 }
416415
417- pub async fn build ( self ) -> Result < HotDataEngine > {
416+ pub async fn build ( self ) -> Result < RivetEngine > {
418417 let catalog = self
419418 . catalog
420419 . ok_or_else ( || anyhow:: anyhow!( "Catalog manager not set" ) ) ?;
@@ -430,7 +429,7 @@ impl HotDataEngineBuilder {
430429 // Register storage with DataFusion
431430 storage. register_with_datafusion ( & df_ctx) ?;
432431
433- let mut engine = HotDataEngine {
432+ let mut engine = RivetEngine {
434433 catalog,
435434 df_ctx,
436435 storage,
@@ -443,9 +442,9 @@ impl HotDataEngineBuilder {
443442 }
444443}
445444
446- impl HotDataEngine {
447- pub fn builder ( ) -> HotDataEngineBuilder {
448- HotDataEngineBuilder :: new ( )
445+ impl RivetEngine {
446+ pub fn builder ( ) -> RivetEngineBuilder {
447+ RivetEngineBuilder :: new ( )
449448 }
450449
451450 /// Create a new engine from application configuration.
@@ -582,7 +581,7 @@ impl HotDataEngine {
582581 } ;
583582
584583 // Use builder to construct engine
585- HotDataEngine :: builder ( )
584+ RivetEngine :: builder ( )
586585 . metadata_dir ( metadata_dir)
587586 . catalog ( catalog)
588587 . storage ( storage)
@@ -615,7 +614,7 @@ mod tests {
615614 ) ) ;
616615
617616 // Build engine using builder pattern
618- let engine = HotDataEngine :: builder ( )
617+ let engine = RivetEngine :: builder ( )
619618 . metadata_dir ( metadata_dir. clone ( ) )
620619 . catalog ( catalog)
621620 . storage ( storage)
@@ -640,7 +639,7 @@ mod tests {
640639 async fn test_builder_pattern_missing_fields ( ) {
641640 // Test that builder fails when required fields are missing
642641 let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
643- let result = HotDataEngine :: builder ( )
642+ let result = RivetEngine :: builder ( )
644643 . metadata_dir ( temp_dir. path ( ) . to_path_buf ( ) )
645644 . build ( )
646645 . await ;
@@ -687,7 +686,7 @@ mod tests {
687686 } ,
688687 } ;
689688
690- let engine = HotDataEngine :: from_config ( & config) . await ;
689+ let engine = RivetEngine :: from_config ( & config) . await ;
691690 assert ! (
692691 engine. is_ok( ) ,
693692 "from_config should create engine successfully"
0 commit comments