diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-09-20 04:39:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-19 20:39:27 -0600 |
commit | d77f3fba03abef07bf7aa7b83f86d6e99077f4b4 (patch) | |
tree | 7152469e3561660baa71743fc51e7640c21a88c8 /ext/cache | |
parent | 2a1781afcb1d19aa02277233049fb7f260f4b03c (diff) |
refactor: rewrite BC, cache exts to op2 (#20486)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Diffstat (limited to 'ext/cache')
-rw-r--r-- | ext/cache/lib.rs | 27 |
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, |