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

Method open

nodedb/src/control/state/init_prod.rs:27–505  ·  view source on GitHub ↗

Create shared state with persistent credential store (for production).

(
        dispatcher: Dispatcher,
        wal: Arc<WalManager>,
        catalog_path: &std::path::Path,
        auth_config: &crate::config::auth::AuthConfig,
        tuning: TuningConfig,
        qui

Source from the content-addressed store, hash-verified

25impl SharedState {
26 /// Create shared state with persistent credential store (for production).
27 pub fn open(
28 dispatcher: Dispatcher,
29 wal: Arc<WalManager>,
30 catalog_path: &std::path::Path,
31 auth_config: &crate::config::auth::AuthConfig,
32 tuning: TuningConfig,
33 quiesce: Arc<crate::bridge::quiesce::CollectionQuiesce>,
34 array_catalog: crate::control::array_catalog::ArrayCatalogHandle,
35 ) -> crate::Result<Arc<Self>> {
36 let mut credentials = CredentialStore::open(catalog_path)?;
37 credentials.set_lockout_policy_with_grace(
38 auth_config.max_failed_logins,
39 auth_config.lockout_duration_secs,
40 auth_config.password_expiry_days,
41 auth_config.password_expiry_grace_days,
42 );
43 credentials.set_argon2_config(auth_config.argon2.clone());
44
45 let api_keys = ApiKeyStore::new();
46 let roles = RoleStore::new();
47 let permissions = PermissionStore::new();
48 let blacklist = crate::control::security::blacklist::store::BlacklistStore::new();
49 let trigger_registry = crate::control::trigger::TriggerRegistry::new();
50 let stream_registry = Arc::new(crate::event::cdc::StreamRegistry::new());
51 let group_registry = crate::event::cdc::GroupRegistry::new();
52 let schedule_registry = Arc::new(crate::event::scheduler::ScheduleRegistry::new());
53 let synonym_registry = Arc::new(crate::control::synonym::SynonymRegistry::new());
54 let custom_type_registry = Arc::new(crate::control::custom_type::CustomTypeRegistry::new());
55 let retention_policy_registry =
56 Arc::new(crate::engine::timeseries::retention_policy::RetentionPolicyRegistry::new());
57 let alert_registry = Arc::new(crate::event::alert::AlertRegistry::new());
58 let alert_hysteresis = Arc::new(crate::event::alert::hysteresis::HysteresisManager::new());
59 let ep_topic_registry = crate::event::topic::EpTopicRegistry::new();
60 let mv_registry = Arc::new(crate::event::streaming_mv::MvRegistry::new());
61 let sequence_registry = Arc::new(crate::control::sequence::SequenceRegistry::new());
62 let rls_store = RlsPolicyStore::new();
63 let mut audit_start_seq = 1u64;
64 if let Some(catalog) = credentials.catalog() {
65 api_keys.load_from(catalog)?;
66 roles.load_from(catalog)?;
67 permissions.load_from(catalog)?;
68 blacklist.load_from(catalog)?;
69 trigger_registry.load_all(catalog);
70 stream_registry.load_from_catalog(catalog);
71 group_registry.load_from_catalog(catalog);
72 schedule_registry.load_from_catalog(catalog);
73 if let Err(e) = synonym_registry.reload_from_catalog(catalog) {
74 tracing::warn!(error = %e, "boot: failed to load synonym groups from catalog");
75 }
76 if let Err(e) = custom_type_registry.reload_from_catalog(catalog) {
77 tracing::warn!(error = %e, "boot: failed to load custom types from catalog");
78 }
79 if let Ok(rp_defs) = catalog.load_all_retention_policies() {
80 retention_policy_registry.load(rp_defs);
81 }
82 alert_registry.load_from_catalog(catalog);
83 ep_topic_registry.load_from_catalog(catalog);
84 mv_registry.load_from_catalog(catalog);

Callers

nothing calls this directly

Calls 15

init_security_busesFunction · 0.85
set_argon2_configMethod · 0.80
load_all_rls_policiesMethod · 0.80
load_audit_max_seqMethod · 0.80
set_next_seqMethod · 0.80
get_database_hwmMethod · 0.80
get_surrogate_hwmMethod · 0.80
load_all_collectionsMethod · 0.80
register_tree_defMethod · 0.80

Tested by

no test coverage detected