feat: implement production cas v1

This commit is contained in:
2026-06-28 12:39:17 +08:00
parent dd53e3054e
commit b202d7b231
33 changed files with 1082 additions and 447 deletions
+14
View File
@@ -22,6 +22,14 @@ pub enum CasError {
#[error("Object not found: {0}")]
ObjectNotFound(String),
/// Hash 格式无效
#[error("Invalid hash: {0}")]
InvalidHash(String),
/// 引用计数下溢
#[error("Reference count is already zero: {0}")]
ReferenceUnderflow(String),
/// 数据库错误
#[error("Database error: {0}")]
Database(String),
@@ -33,3 +41,9 @@ pub enum CasError {
/// CAS Engine Result 类型
pub type Result<T> = std::result::Result<T, CasError>;
impl From<sqlx::Error> for CasError {
fn from(error: sqlx::Error) -> Self {
Self::Database(error.to_string())
}
}