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

Method get_policy_by_version

crates/openshell-server/src/persistence/postgres.rs:518–538  ·  view source on GitHub ↗
(
        &self,
        sandbox_id: &str,
        version: i64,
    )

Source from the content-addressed store, hash-verified

516 }
517
518 pub async fn get_policy_by_version(
519 &self,
520 sandbox_id: &str,
521 version: i64,
522 ) -> PersistenceResult<Option<PolicyRecord>> {
523 let row = sqlx::query(
524 r"
525SELECT id, scope, version, status, payload, created_at_ms
526FROM objects
527WHERE object_type = $1 AND scope = $2 AND version = $3
528",
529 )
530 .bind(POLICY_OBJECT_TYPE)
531 .bind(sandbox_id)
532 .bind(version)
533 .fetch_optional(&self.pool)
534 .await
535 .map_err(|e| map_db_error(&e))?;
536
537 row.map(row_to_policy_record).transpose()
538 }
539
540 pub async fn list_policies(
541 &self,

Callers 1

update_policy_statusMethod · 0.45

Calls 1

map_db_errorFunction · 0.85

Tested by

no test coverage detected