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

Method list_policies

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

Source from the content-addressed store, hash-verified

538 }
539
540 pub async fn list_policies(
541 &self,
542 sandbox_id: &str,
543 limit: u32,
544 offset: u32,
545 ) -> PersistenceResult<Vec<PolicyRecord>> {
546 let rows = sqlx::query(
547 r"
548SELECT id, scope, version, status, payload, created_at_ms
549FROM objects
550WHERE object_type = $1 AND scope = $2
551ORDER BY version DESC, created_at_ms DESC
552LIMIT $3 OFFSET $4
553",
554 )
555 .bind(POLICY_OBJECT_TYPE)
556 .bind(sandbox_id)
557 .bind(i64::from(limit))
558 .bind(i64::from(offset))
559 .fetch_all(&self.pool)
560 .await
561 .map_err(|e| map_db_error(&e))?;
562
563 rows.into_iter().map(row_to_policy_record).collect()
564 }
565
566 pub async fn update_policy_status(
567 &self,

Callers

nothing calls this directly

Calls 1

map_db_errorFunction · 0.85

Tested by

no test coverage detected