diff --git a/modules/rust_examples/Cargo.lock b/modules/rust_examples/Cargo.lock index 8b67abc72..6fda21ec3 100644 --- a/modules/rust_examples/Cargo.lock +++ b/modules/rust_examples/Cargo.lock @@ -115,7 +115,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "everestrs" version = "0.1.0" -source = "git+https://github.com/qwello/everest-framework.git?rev=64411bbc78b94e9d1d28f421bf0f3a8adb0dca92#64411bbc78b94e9d1d28f421bf0f3a8adb0dca92" +source = "git+https://github.com/qwello/everest-framework.git?rev=06983df646695303017137d00eea9f63b808fd71#06983df646695303017137d00eea9f63b808fd71" dependencies = [ "argh", "cxx", @@ -128,7 +128,7 @@ dependencies = [ [[package]] name = "everestrs-build" version = "0.1.0" -source = "git+https://github.com/qwello/everest-framework.git?rev=64411bbc78b94e9d1d28f421bf0f3a8adb0dca92#64411bbc78b94e9d1d28f421bf0f3a8adb0dca92" +source = "git+https://github.com/qwello/everest-framework.git?rev=06983df646695303017137d00eea9f63b808fd71#06983df646695303017137d00eea9f63b808fd71" dependencies = [ "anyhow", "argh", diff --git a/modules/rust_examples/Cargo.toml b/modules/rust_examples/Cargo.toml index 24b45bdb3..22f12ada6 100644 --- a/modules/rust_examples/Cargo.toml +++ b/modules/rust_examples/Cargo.toml @@ -6,5 +6,5 @@ members = [ ] [workspace.dependencies] -everestrs = { git = "https://github.com/qwello/everest-framework.git", rev = "64411bbc78b94e9d1d28f421bf0f3a8adb0dca92" } -everestrs-build = { git = "https://github.com/qwello/everest-framework.git", rev = "64411bbc78b94e9d1d28f421bf0f3a8adb0dca92" } +everestrs = { git = "https://github.com/qwello/everest-framework.git", rev = "06983df646695303017137d00eea9f63b808fd71" } +everestrs-build = { git = "https://github.com/qwello/everest-framework.git", rev = "06983df646695303017137d00eea9f63b808fd71" } diff --git a/modules/rust_examples/RsExample/src/main.rs b/modules/rust_examples/RsExample/src/main.rs index 7a4bd3545..16af881a6 100644 --- a/modules/rust_examples/RsExample/src/main.rs +++ b/modules/rust_examples/RsExample/src/main.rs @@ -4,8 +4,8 @@ include!(concat!(env!("OUT_DIR"), "/generated.rs")); use generated::{ - get_config, ExampleServiceSubscriber, KvsClientSubscriber, KvsServiceSubscriber, Module, - ModulePublisher, OnReadySubscriber, + get_config, Context, ExampleServiceSubscriber, KvsClientSubscriber, KvsServiceSubscriber, + Module, ModulePublisher, OnReadySubscriber, }; use std::sync::Arc; use std::{thread, time}; @@ -15,47 +15,44 @@ pub struct OneClass {} impl KvsServiceSubscriber for OneClass { fn store( &self, - pub_impl: &ModulePublisher, + context: &Context, key: String, value: serde_json::Value, ) -> ::everestrs::Result<()> { - pub_impl.their_store.store(key, value) + context.publisher.their_store.store(key, value) } - fn load( - &self, - pub_impl: &ModulePublisher, - key: String, - ) -> ::everestrs::Result { - pub_impl.their_store.load(key) + fn load(&self, context: &Context, key: String) -> ::everestrs::Result { + context.publisher.their_store.load(key) } - fn delete(&self, pub_impl: &ModulePublisher, key: String) -> ::everestrs::Result<()> { - pub_impl.their_store.delete(key) + fn delete(&self, context: &Context, key: String) -> ::everestrs::Result<()> { + context.publisher.their_store.delete(key) } - fn exists(&self, pub_impl: &ModulePublisher, key: String) -> ::everestrs::Result { - pub_impl.their_store.exists(key) + fn exists(&self, context: &Context, key: String) -> ::everestrs::Result { + context.publisher.their_store.exists(key) } } impl ExampleServiceSubscriber for OneClass { - fn uses_something(&self, pub_impl: &ModulePublisher, key: String) -> ::everestrs::Result { - if !pub_impl.their_store.exists(key.clone())? { + fn uses_something(&self, context: &Context, key: String) -> ::everestrs::Result { + if !context.publisher.their_store.exists(key.clone())? { println!("IT SHOULD NOT AND DOES NOT EXIST"); } let test_array = vec![1, 2, 3]; - pub_impl + context + .publisher .their_store .store(key.clone(), test_array.clone().into())?; - let exi = pub_impl.their_store.exists(key.clone())?; + let exi = context.publisher.their_store.exists(key.clone())?; if exi { println!("IT ACTUALLY EXISTS"); } - let ret: Vec = serde_json::from_value(pub_impl.their_store.load(key)?) + let ret: Vec = serde_json::from_value(context.publisher.their_store.load(key)?) .expect("Wanted an array as return value"); println!("loaded array: {ret:?}, original array: {test_array:?}"); diff --git a/modules/rust_examples/RsExampleUser/src/main.rs b/modules/rust_examples/RsExampleUser/src/main.rs index b830804fa..5c7220cfc 100644 --- a/modules/rust_examples/RsExampleUser/src/main.rs +++ b/modules/rust_examples/RsExampleUser/src/main.rs @@ -7,7 +7,7 @@ use std::sync::{Arc, Mutex}; use std::{thread, time}; use generated::{ - ExampleClientSubscriber, ExampleUserServiceSubscriber, Module, ModulePublisher, + Context, ExampleClientSubscriber, ExampleUserServiceSubscriber, Module, ModulePublisher, OnReadySubscriber, }; @@ -26,16 +26,17 @@ impl ExampleClient { } impl ExampleClientSubscriber for ExampleClient { - fn on_max_current(&self, publishers: &ModulePublisher, value: f64) { + fn on_max_current(&self, context: &Context, value: f64) { println!("Received the value {value}"); - let _ = publishers + let _ = context + .publisher .their_example .uses_something("hello_there".to_string()); *self.max_current.lock().unwrap() = Some(value); // Example where we start a thread with the publisher. The cloning is // only done if the user wants to offload the publisher into a thread. - let clone = publishers.clone(); + let clone = context.publisher.clone(); *self.thread.lock().unwrap() = Some(thread::spawn(move || { let _ = clone.another_example.uses_something("foo".to_string()); })) diff --git a/third-party/bazel/repos.bzl b/third-party/bazel/repos.bzl index af978e966..d37df9b92 100644 --- a/third-party/bazel/repos.bzl +++ b/third-party/bazel/repos.bzl @@ -13,6 +13,6 @@ def everest_core_repos(): maybe( http_archive, name = "everest-framework", - url = "https://github.com/qwello/everest-framework/archive/64411bbc78b94e9d1d28f421bf0f3a8adb0dca92.tar.gz", - strip_prefix = "everest-framework-64411bbc78b94e9d1d28f421bf0f3a8adb0dca92", - ) \ No newline at end of file + url = "https://github.com/qwello/everest-framework/archive/06983df646695303017137d00eea9f63b808fd71.tar.gz", + strip_prefix = "everest-framework-06983df646695303017137d00eea9f63b808fd71", + )