summaryrefslogtreecommitdiff
path: root/ext/cache
diff options
context:
space:
mode:
Diffstat (limited to 'ext/cache')
-rw-r--r--ext/cache/lib.rs27
1 files changed, 15 insertions, 12 deletions
diff --git a/ext/cache/lib.rs b/ext/cache/lib.rs
index 1459af8cb..553dd1ee6 100644
--- a/ext/cache/lib.rs
+++ b/ext/cache/lib.rs
@@ -8,6 +8,7 @@ use std::sync::Arc;
use async_trait::async_trait;
use deno_core::error::AnyError;
use deno_core::op;
+use deno_core::op2;
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::ByteString;
@@ -129,10 +130,10 @@ where
cache.storage_open(cache_name).await
}
-#[op]
+#[op2(async)]
pub async fn op_cache_storage_has<CA>(
state: Rc<RefCell<OpState>>,
- cache_name: String,
+ #[string] cache_name: String,
) -> Result<bool, AnyError>
where
CA: Cache,
@@ -141,10 +142,10 @@ where
cache.storage_has(cache_name).await
}
-#[op]
+#[op2(async)]
pub async fn op_cache_storage_delete<CA>(
state: Rc<RefCell<OpState>>,
- cache_name: String,
+ #[string] cache_name: String,
) -> Result<bool, AnyError>
where
CA: Cache,
@@ -153,10 +154,11 @@ where
cache.storage_delete(cache_name).await
}
-#[op]
+#[op2(async)]
+#[smi]
pub async fn op_cache_put<CA>(
state: Rc<RefCell<OpState>>,
- request_response: CachePutRequest,
+ #[serde] request_response: CachePutRequest,
) -> Result<Option<ResourceId>, AnyError>
where
CA: Cache,
@@ -171,10 +173,10 @@ where
}
}
-#[op]
+#[op2(async)]
pub async fn op_cache_put_finish<CA>(
state: Rc<RefCell<OpState>>,
- rid: ResourceId,
+ #[smi] rid: ResourceId,
) -> Result<(), AnyError>
where
CA: Cache,
@@ -187,10 +189,11 @@ where
cache.put_finish(resource).await
}
-#[op]
+#[op2(async)]
+#[serde]
pub async fn op_cache_match<CA>(
state: Rc<RefCell<OpState>>,
- request: CacheMatchRequest,
+ #[serde] request: CacheMatchRequest,
) -> Result<Option<CacheMatchResponse>, AnyError>
where
CA: Cache,
@@ -206,10 +209,10 @@ where
}
}
-#[op]
+#[op2(async)]
pub async fn op_cache_delete<CA>(
state: Rc<RefCell<OpState>>,
- request: CacheDeleteRequest,
+ #[serde] request: CacheDeleteRequest,
) -> Result<bool, AnyError>
where
CA: Cache,