1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
// SPDX-License-Identifier: MIT // Copyright (c) 2026 eunomia-bpf org. use crate::model::ViewResult; use crate::sinks::sqlite::SqliteStore; use crate::view::MaterializedView; use std::path::Path; pub(crate) fn load_view(path: impl AsRef<Path>) -> ViewResult<MaterializedView> { let store = SqliteStore::open_readonly(path)?; let mut view = MaterializedView::new(); view.set_source("sqlite"); if let Ok(rows) = store.all_llm_call_rows() { for row in rows { view.apply_llm_call(&row); } } if let Ok(rows) = store.token_usage_rows() { for row in rows { view.apply_token_usage(&row); } } if let Ok(rows) = store.all_audit_event_rows() { for row in rows { view.apply_audit_event(&row); } } if let Ok(rows) = store.process_node_rows() { for row in rows { view.upsert_process_node(&row); } } if let Ok(rows) = store.tool_call_rows() { for row in rows { view.apply_tool_call(&row); } } if let Ok(rows) = store.network_target_rows() { for row in rows { view.upsert_network_target(&row); } } if let Ok(rows) = store.resource_sample_rows() { for row in rows { view.apply_resource_sample(&row); } } Ok(view) }