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

Function stored_setting_to_proto

crates/openshell-server/src/grpc/policy.rs:3680–3700  ·  view source on GitHub ↗
(value: &StoredSettingValue)

Source from the content-addressed store, hash-verified

3678}
3679
3680fn stored_setting_to_proto(value: &StoredSettingValue) -> Result<SettingValue, Status> {
3681 let proto = match value {
3682 StoredSettingValue::String(v) => SettingValue {
3683 value: Some(setting_value::Value::StringValue(v.clone())),
3684 },
3685 StoredSettingValue::Bool(v) => SettingValue {
3686 value: Some(setting_value::Value::BoolValue(*v)),
3687 },
3688 StoredSettingValue::Int(v) => SettingValue {
3689 value: Some(setting_value::Value::IntValue(*v)),
3690 },
3691 StoredSettingValue::Bytes(v) => {
3692 let decoded = hex::decode(v)
3693 .map_err(|e| Status::internal(format!("stored bytes decode failed: {e}")))?;
3694 SettingValue {
3695 value: Some(setting_value::Value::BytesValue(decoded)),
3696 }
3697 }
3698 };
3699 Ok(proto)
3700}
3701
3702fn upsert_setting_value(
3703 map: &mut BTreeMap<String, StoredSettingValue>,

Calls

no outgoing calls