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

Method get_policy_by_version

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

Source from the content-addressed store, hash-verified

537 }
538
539 pub async fn get_policy_by_version(
540 &self,
541 sandbox_id: &str,
542 version: i64,
543 ) -> PersistenceResult<Option<PolicyRecord>> {
544 let row = sqlx::query(
545 r#"
546SELECT "id", "scope", "version", "status", "payload", "created_at_ms"
547FROM "objects"
548WHERE "object_type" = ?1 AND "scope" = ?2 AND "version" = ?3
549"#,
550 )
551 .bind(POLICY_OBJECT_TYPE)
552 .bind(sandbox_id)
553 .bind(version)
554 .fetch_optional(&self.pool)
555 .await
556 .map_err(|e| map_db_error(&e))?;
557
558 row.map(row_to_policy_record).transpose()
559 }
560
561 pub async fn list_policies(
562 &self,

Callers 5

update_policy_statusMethod · 0.45
policy_get_by_versionFunction · 0.45
policy_supersede_olderFunction · 0.45

Calls 1

map_db_errorFunction · 0.85

Tested by 3

policy_get_by_versionFunction · 0.36
policy_supersede_olderFunction · 0.36