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

Method list_policies

crates/openshell-server/src/persistence/sqlite.rs:561–585  ·  view source on GitHub ↗
(
        &self,
        sandbox_id: &str,
        limit: u32,
        offset: u32,
    )

Source from the content-addressed store, hash-verified

559 }
560
561 pub async fn list_policies(
562 &self,
563 sandbox_id: &str,
564 limit: u32,
565 offset: u32,
566 ) -> PersistenceResult<Vec<PolicyRecord>> {
567 let rows = sqlx::query(
568 r#"
569SELECT "id", "scope", "version", "status", "payload", "created_at_ms"
570FROM "objects"
571WHERE "object_type" = ?1 AND "scope" = ?2
572ORDER BY "version" DESC, "created_at_ms" DESC
573LIMIT ?3 OFFSET ?4
574"#,
575 )
576 .bind(POLICY_OBJECT_TYPE)
577 .bind(sandbox_id)
578 .bind(i64::from(limit))
579 .bind(i64::from(offset))
580 .fetch_all(&self.pool)
581 .await
582 .map_err(|e| map_db_error(&e))?;
583
584 rows.into_iter().map(row_to_policy_record).collect()
585 }
586
587 pub async fn update_policy_status(
588 &self,

Calls 1

map_db_errorFunction · 0.85

Tested by 1