MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / merge_effective_settings

Function merge_effective_settings

crates/openshell-server/src/grpc/policy.rs:3834–3877  ·  view source on GitHub ↗
(
    global: &StoredSettings,
    sandbox: &StoredSettings,
)

Source from the content-addressed store, hash-verified

3832}
3833
3834fn merge_effective_settings(
3835 global: &StoredSettings,
3836 sandbox: &StoredSettings,
3837) -> Result<HashMap<String, EffectiveSetting>, Status> {
3838 let mut merged = HashMap::new();
3839
3840 for registered in settings::REGISTERED_SETTINGS {
3841 merged.insert(
3842 registered.key.to_string(),
3843 EffectiveSetting {
3844 value: None,
3845 scope: SettingScope::Unspecified.into(),
3846 },
3847 );
3848 }
3849
3850 for (key, value) in &sandbox.settings {
3851 if key == POLICY_SETTING_KEY || settings::setting_for_key(key).is_none() {
3852 continue;
3853 }
3854 merged.insert(
3855 key.clone(),
3856 EffectiveSetting {
3857 value: Some(stored_setting_to_proto(value)?),
3858 scope: SettingScope::Sandbox.into(),
3859 },
3860 );
3861 }
3862
3863 for (key, value) in &global.settings {
3864 if key == POLICY_SETTING_KEY || settings::setting_for_key(key).is_none() {
3865 continue;
3866 }
3867 merged.insert(
3868 key.clone(),
3869 EffectiveSetting {
3870 value: Some(stored_setting_to_proto(value)?),
3871 scope: SettingScope::Global.into(),
3872 },
3873 );
3874 }
3875
3876 Ok(merged)
3877}
3878
3879fn materialize_global_settings(
3880 global: &StoredSettings,

Calls 2

setting_for_keyFunction · 0.85
stored_setting_to_protoFunction · 0.85