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

Method get_latest_policy

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

Source from the content-addressed store, hash-verified

493 }
494
495 pub async fn get_latest_policy(
496 &self,
497 sandbox_id: &str,
498 ) -> PersistenceResult<Option<PolicyRecord>> {
499 let row = sqlx::query(
500 r#"
501SELECT "id", "scope", "version", "status", "payload", "created_at_ms"
502FROM "objects"
503WHERE "object_type" = ?1 AND "scope" = ?2
504ORDER BY "version" DESC, "created_at_ms" DESC
505LIMIT 1
506"#,
507 )
508 .bind(POLICY_OBJECT_TYPE)
509 .bind(sandbox_id)
510 .fetch_optional(&self.pool)
511 .await
512 .map_err(|e| map_db_error(&e))?;
513
514 row.map(row_to_policy_record).transpose()
515 }
516
517 pub async fn get_latest_loaded_policy(
518 &self,

Calls 1

map_db_errorFunction · 0.85

Tested by 2