From 0941c12512295941bd5c01ea33ad76c7761c59db Mon Sep 17 00:00:00 2001 From: Ruslan Pislari Date: Mon, 3 Nov 2025 10:25:19 +0200 Subject: [PATCH 1/3] refactor: rename zrange to zrange_by_score for clarity and update return type --- crates/key-value-store/src/lib.rs | 19 ++++++++++++------- crates/key-value-store/src/redis_impl.rs | 9 +++++++-- sdk | 2 +- 3 files changed, 20 insertions(+), 10 deletions(-) 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/sdk b/sdk index 67ae2a0..5842777 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 67ae2a07f4ffd4c251ccaec9cb3b41c1dd5a22e2 +Subproject commit 58427772b7f72dd2a7f5df58e6fa019c595f51a0 From d919920b18b6b575ae27fdd37c36f4f3fa3b53f3 Mon Sep 17 00:00:00 2001 From: Ruslan Pislari Date: Mon, 3 Nov 2025 16:30:41 +0200 Subject: [PATCH 2/3] Removed submodule sdk --- .gitmodules | 3 --- sdk | 1 - 2 files changed, 4 deletions(-) delete mode 160000 sdk diff --git a/.gitmodules b/.gitmodules index 908883b..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "sdk"] - path = sdk - url = https://github.com/G-Core/FastEdge-sdk-rust.git diff --git a/sdk b/sdk deleted file mode 160000 index 5842777..0000000 --- a/sdk +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 58427772b7f72dd2a7f5df58e6fa019c595f51a0 From 222a595f2d6f64f842cd1c3cbe885e51323feb86 Mon Sep 17 00:00:00 2001 From: Ruslan Pislari Date: Mon, 3 Nov 2025 16:35:08 +0200 Subject: [PATCH 3/3] fix: update wit path in component bindgen and add submodule configuration --- .gitmodules | 3 +++ crates/reactor/src/lib.rs | 2 +- crates/reactor/wit | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) create mode 160000 crates/reactor/wit diff --git a/.gitmodules b/.gitmodules index e69de29..d231796 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "crates/reactor/wit"] + path = crates/reactor/wit + url = https://github.com/G-Core/FastEdge-wit.git 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