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

Function merge_chunk_into_policy

crates/openshell-server/src/grpc/policy.rs:3592–3605  ·  view source on GitHub ↗
(
    store: &Store,
    sandbox_id: &str,
    chunk: &DraftChunkRecord,
)

Source from the content-addressed store, hash-verified

3590}
3591
3592pub(super) async fn merge_chunk_into_policy(
3593 store: &Store,
3594 sandbox_id: &str,
3595 chunk: &DraftChunkRecord,
3596) -> Result<(i64, String), Status> {
3597 let rule = NetworkPolicyRule::decode(chunk.proposed_rule.as_slice())
3598 .map_err(|e| Status::internal(format!("decode proposed_rule failed: {e}")))?;
3599 let operations = [PolicyMergeOp::AddRule {
3600 rule_name: chunk.rule_name.clone(),
3601 rule,
3602 }];
3603 validate_merge_operations_for_server(&operations)?;
3604 apply_merge_operations_with_retry(store, sandbox_id, None, &operations).await
3605}
3606
3607async fn remove_chunk_from_policy(
3608 state: &ServerState,

Calls 3

as_sliceMethod · 0.80

Tested by

no test coverage detected