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

Method get_latest_policy

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

Source from the content-addressed store, hash-verified

472 }
473
474 pub async fn get_latest_policy(
475 &self,
476 sandbox_id: &str,
477 ) -> PersistenceResult<Option<PolicyRecord>> {
478 let row = sqlx::query(
479 r"
480SELECT id, scope, version, status, payload, created_at_ms
481FROM objects
482WHERE object_type = $1 AND scope = $2
483ORDER BY version DESC, created_at_ms DESC
484LIMIT 1
485",
486 )
487 .bind(POLICY_OBJECT_TYPE)
488 .bind(sandbox_id)
489 .fetch_optional(&self.pool)
490 .await
491 .map_err(|e| map_db_error(&e))?;
492
493 row.map(row_to_policy_record).transpose()
494 }
495
496 pub async fn get_latest_loaded_policy(
497 &self,

Callers

nothing calls this directly

Calls 1

map_db_errorFunction · 0.85

Tested by

no test coverage detected