fix(release): 完成分发身份与 CAS legacy ownership 收尾
bat-rust / Build and test Rust (push) Canceled after 0s
bat-rust / Build and test Go API (push) Canceled after 0s

This commit is contained in:
2026-09-13 10:44:24 +08:00
parent 786b739f99
commit 5bae90cb14
14 changed files with 867 additions and 109 deletions
+11
View File
@@ -389,6 +389,17 @@ impl SqliteRefCounter {
transaction.commit().await?;
Ok(true)
}
/// Returns whether the durable ledger contains any row for an ownership.
pub async fn has_release_ownership(&self, ownership_id: &str) -> Result<bool> {
let exists: i64 = sqlx::query_scalar(
"SELECT EXISTS(SELECT 1 FROM cas_release_references WHERE release_id = ?1)",
)
.bind(ownership_id)
.fetch_one(&self.pool)
.await?;
Ok(exists != 0)
}
}
#[cfg(test)]
+6
View File
@@ -176,6 +176,12 @@ impl FileSystemCasRepository {
.await
}
/// Returns whether the durable release ownership ledger has any row.
pub async fn has_release_ownership(&self, ownership_id: &str) -> Result<bool> {
let _lock = self.acquire_operation_lock().await?;
self.ref_counter.has_release_ownership(ownership_id).await
}
/// 获取存储统计信息。
pub async fn stats(&self) -> Result<StorageStats> {
let _lock = self.acquire_operation_lock().await?;