MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / load_array_catalog

Function load_array_catalog

nodedb/src/bootstrap/data_plane.rs:20–46  ·  view source on GitHub ↗

Load the persisted ND-array catalog from redb into the shared in-memory handle.

(
    config: &ServerConfig,
)

Source from the content-addressed store, hash-verified

18
19/// Load the persisted ND-array catalog from redb into the shared in-memory handle.
20pub fn load_array_catalog(
21 config: &ServerConfig,
22) -> crate::control::array_catalog::ArrayCatalogHandle {
23 let array_catalog = ArrayCatalog::handle();
24 let catalog_path = config.catalog_path();
25 match crate::control::security::catalog::SystemCatalog::open(&catalog_path) {
26 Ok(catalog) => match catalog.load_all_arrays() {
27 Ok(entries) => {
28 let mut guard = array_catalog
29 .write()
30 .expect("array catalog lock poisoned at startup");
31 for entry in entries {
32 if let Err(e) = guard.register(entry) {
33 tracing::warn!(error = %e, "failed to register array at startup");
34 }
35 }
36 }
37 Err(e) => {
38 tracing::warn!(error = %e, "failed to load _system.arrays at startup");
39 }
40 },
41 Err(e) => {
42 tracing::warn!(error = %e, "could not open system catalog to load arrays");
43 }
44 }
45 array_catalog
46}
47
48/// Shared Arc resources passed to each Data Plane core at spawn time.
49pub struct CoreSharedResources {

Callers 1

mainFunction · 0.85

Calls 6

catalog_pathMethod · 0.80
load_all_arraysMethod · 0.80
openFunction · 0.50
expectMethod · 0.45
writeMethod · 0.45
registerMethod · 0.45

Tested by

no test coverage detected