diff --git a/.gitmodules b/.gitmodules index 908883b..d231796 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "sdk"] - path = sdk - url = https://github.com/G-Core/FastEdge-sdk-rust.git +[submodule "crates/reactor/wit"] + path = crates/reactor/wit + url = https://github.com/G-Core/FastEdge-wit.git diff --git a/crates/key-value-store/src/lib.rs b/crates/key-value-store/src/lib.rs index 28808dc..1257bbd 100644 --- a/crates/key-value-store/src/lib.rs +++ b/crates/key-value-store/src/lib.rs @@ -18,7 +18,12 @@ pub use redis_impl::RedisStore; pub trait Store: Sync + Send { async fn get(&self, key: &str) -> Result, Error>; - async fn zrange(&self, key: &str, min: f64, max: f64) -> Result, Error>; + async fn zrange_by_score( + &self, + key: &str, + min: f64, + max: f64, + ) -> Result, Error>; async fn scan(&self, pattern: &str) -> Result, Error>; @@ -64,15 +69,15 @@ impl key_value::HostStore for KeyValueStore { KeyValueStore::scan(self, store_id, &pattern).await } - async fn zrange( + async fn zrange_by_score( &mut self, store: Resource, key: String, min: f64, max: f64, - ) -> Result, Error> { + ) -> Result, Error> { let store_id = store.rep(); - KeyValueStore::zrange(self, store_id, &key, min, max).await + KeyValueStore::zrange_by_score(self, store_id, &key, min, max).await } async fn zscan( @@ -135,17 +140,17 @@ impl KeyValueStore { /// Get a values from a store by key. #[instrument(skip(self), level = "trace", ret, err)] - pub async fn zrange( + pub async fn zrange_by_score( &self, store: u32, key: &str, min: f64, max: f64, - ) -> Result, Error> { + ) -> Result, Error> { let Some(store) = self.stores.get(store as usize) else { return Err(Error::NoSuchStore); }; - store.zrange(key, min, max).await + store.zrange_by_score(key, min, max).await } #[instrument(skip(self), level = "trace", ret, err)] diff --git a/crates/key-value-store/src/redis_impl.rs b/crates/key-value-store/src/redis_impl.rs index 3771aa8..e60acc8 100644 --- a/crates/key-value-store/src/redis_impl.rs +++ b/crates/key-value-store/src/redis_impl.rs @@ -33,10 +33,15 @@ impl Store for RedisStore { }) } - async fn zrange(&self, key: &str, min: f64, max: f64) -> Result, Error> { + async fn zrange_by_score( + &self, + key: &str, + min: f64, + max: f64, + ) -> Result, Error> { self.inner .clone() - .zrangebyscore(key, min, max) + .zrangebyscore_withscores(key, min, max) .await .map_err(|error| { tracing::warn!(cause=?error, "redis zrangebyscore"); diff --git a/crates/reactor/src/lib.rs b/crates/reactor/src/lib.rs index e15d649..2f116fb 100644 --- a/crates/reactor/src/lib.rs +++ b/crates/reactor/src/lib.rs @@ -1,7 +1,7 @@ #![allow(missing_docs)] wasmtime::component::bindgen!({ - path: "../../sdk/wit", + path: "wit", world: "reactor", imports: { default: async }, }); diff --git a/crates/reactor/wit b/crates/reactor/wit new file mode 160000 index 0000000..561aa99 --- /dev/null +++ b/crates/reactor/wit @@ -0,0 +1 @@ +Subproject commit 561aa99135425fb2a7a01feb989614fcbd083a50 diff --git a/sdk b/sdk deleted file mode 160000 index 67ae2a0..0000000 --- a/sdk +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 67ae2a07f4ffd4c251ccaec9cb3b41c1dd5a22e2