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

Method get_draft_version

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

Source from the content-addressed store, hash-verified

831 }
832
833 pub async fn get_draft_version(&self, sandbox_id: &str) -> PersistenceResult<i64> {
834 let rows = sqlx::query(
835 r#"
836SELECT "payload"
837FROM "objects"
838WHERE "object_type" = ?1 AND "scope" = ?2
839"#,
840 )
841 .bind(DRAFT_CHUNK_OBJECT_TYPE)
842 .bind(sandbox_id)
843 .fetch_all(&self.pool)
844 .await
845 .map_err(|e| map_db_error(&e))?;
846
847 let mut max_version = 0_i64;
848 for row in rows {
849 let payload: Vec<u8> = row.get("payload");
850 let wrapper = draft_chunk_record_from_parts(
851 String::new(),
852 sandbox_id.to_string(),
853 String::new(),
854 0,
855 &payload,
856 0,
857 0,
858 )?;
859 max_version = max_version.max(wrapper.draft_version);
860 }
861 Ok(max_version)
862 }
863}
864
865/// Restrict the on-disk `SQLite` database file (and its WAL/SHM sidecars,

Callers 2

handle_get_draft_policyFunction · 0.45

Calls 3

map_db_errorFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected