(&mut self, storage: Arc<StorageManager>)
| 556 | |
| 557 | impl CatalogProvider for SecurityCatalog { |
| 558 | fn init(&mut self, storage: Arc<StorageManager>) -> CatalogResult<()> { |
| 559 | self.storage = Some(storage.clone()); |
| 560 | |
| 561 | // Try to load persisted state from storage |
| 562 | match storage.load_catalog_provider("security") { |
| 563 | Ok(Some(data)) => { |
| 564 | // Load persisted catalog state |
| 565 | match self.load(&data) { |
| 566 | Ok(_) => { |
| 567 | log::info!( |
| 568 | "Security catalog loaded from storage with {} users, {} roles", |
| 569 | self.users.len(), |
| 570 | self.roles.len() |
| 571 | ); |
| 572 | } |
| 573 | Err(e) => { |
| 574 | log::warn!("Failed to deserialize security catalog from storage: {}. Using defaults.", e); |
| 575 | } |
| 576 | } |
| 577 | } |
| 578 | Ok(None) => { |
| 579 | // This is expected on first run - no catalog data exists yet |
| 580 | log::debug!("No persisted security catalog found. Using default initialization."); |
| 581 | } |
| 582 | Err(e) => { |
| 583 | log::warn!( |
| 584 | "Error loading security catalog: {}. Using default initialization.", |
| 585 | e |
| 586 | ); |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | Ok(()) |
| 591 | } |
| 592 | |
| 593 | fn execute(&mut self, op: CatalogOperation) -> CatalogResult<CatalogResponse> { |
| 594 | match op { |
nothing calls this directly
no test coverage detected