stinger-ipc 0.0.26__tar.gz → 0.0.27__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stinger_ipc-0.0.26/stinger_ipc.egg-info → stinger_ipc-0.0.27}/PKG-INFO +1 -1
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/pyproject.toml +1 -1
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27/stinger_ipc.egg-info}/PKG-INFO +1 -1
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/server/Cargo.toml.jinja2 +1 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/server/examples/server.rs.jinja2 +7 -9
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/server/src/lib.rs.jinja2 +11 -11
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/LICENSE +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/README.md +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/setup.cfg +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stinger_ipc.egg-info/SOURCES.txt +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stinger_ipc.egg-info/dependency_links.txt +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stinger_ipc.egg-info/entry_points.txt +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stinger_ipc.egg-info/requires.txt +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stinger_ipc.egg-info/top_level.txt +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/__init__.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/args.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/asyncapi.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/components.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/connection.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/exceptions.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/interface.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/lang_symb.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/schema/schema.yaml +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/CMakeLists.txt.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/examples/client_main.cpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/examples/server_main.cpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/broker.hpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/client.hpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/enums.hpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/ibrokerconnection.hpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/property_structs.hpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/return_types.hpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/server.hpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/structs.hpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/partials/args.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/partials/deserialize.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/partials/serialize.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/src/broker.cpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/src/client.cpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/src/property_structs.cpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/src/server.cpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/src/structs.cpp.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/html/app.js.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/html/index.html.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/html/styles.css.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/markdown/index.md.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/python/__init__.py.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/python/client.py.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/python/connection.py.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/python/interface_types.py.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/python/method_codes.py.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/python/pyproject.toml.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/python/server.py.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/Cargo.toml.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/client/Cargo.toml.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/client/examples/client.rs.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/client/src/lib.rs.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/payloads/Cargo.toml.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/payloads/examples/pub_and_recv.rs.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/payloads/src/lib.rs.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/payloads/src/payloads.rs.jinja2 +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/tools/__init__.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/tools/cli.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/tools/cpp_generator.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/tools/markdown_generator.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/tools/python_generator.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/tools/rust_generator.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/topic.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/tests/test_args.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/tests/test_enum.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/tests/test_examples.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/tests/test_interface.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/tests/test_signal.py +0 -0
- {stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/tests/test_topics.py +0 -0
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/server/examples/server.rs.jinja2
RENAMED
@@ -10,9 +10,10 @@ use mqttier::MqttierClient;
|
|
10
10
|
use {{stinger.rust.server_package_name}}::{ {{stinger.rust.server_struct_name}}{%if stinger.methods|length>0%}, {{stinger.name | UpperCamelCase }}MethodHandlers{%endif%} };
|
11
11
|
use tokio::time::{sleep, Duration};
|
12
12
|
{%if stinger.methods|length > 0%}
|
13
|
-
|
14
|
-
|
15
|
-
use
|
13
|
+
use std::sync::Arc;
|
14
|
+
use tokio::sync::Mutex;
|
15
|
+
use async_trait::async_trait;
|
16
|
+
{%endif%}
|
16
17
|
#[allow(unused_imports)]
|
17
18
|
use {{stinger.rust.common_package_name}}::payloads::{MethodResultCode, *};
|
18
19
|
|
@@ -29,15 +30,16 @@ impl {{stinger.name | UpperCamelCase }}MethodImpl {
|
|
29
30
|
}
|
30
31
|
}
|
31
32
|
|
33
|
+
#[async_trait]
|
32
34
|
impl {{stinger.name | UpperCamelCase }}MethodHandlers for {{stinger.name | UpperCamelCase }}MethodImpl {
|
33
35
|
|
34
|
-
fn initialize(&mut self, server: {{stinger.rust.server_struct_name}}) -> Result<(), MethodResultCode> {
|
36
|
+
async fn initialize(&mut self, server: {{stinger.rust.server_struct_name}}) -> Result<(), MethodResultCode> {
|
35
37
|
self.server = Some(server.clone());
|
36
38
|
Ok(())
|
37
39
|
}
|
38
40
|
|
39
41
|
{%for method_name, method in stinger.methods.items()%}
|
40
|
-
fn handle_{{method_name|snake_case}}(&self, {%for arg in method.arg_list%}_{{arg.name|snake_case}}: {{arg.rust_type}}{%if not loop.last%}, {%endif%}{%endfor%}) -> Result<{{method.return_value_rust_type}}, MethodResultCode> {
|
42
|
+
async fn handle_{{method_name|snake_case}}(&self, {%for arg in method.arg_list%}_{{arg.name|snake_case}}: {{arg.rust_type}}{%if not loop.last%}, {%endif%}{%endfor%}) -> Result<{{method.return_value_rust_type}}, MethodResultCode> {
|
41
43
|
println!("Handling {{method_name}}");
|
42
44
|
{%-if method.return_value_type == 'struct'%}
|
43
45
|
let rv = {{method.return_value_rust_type}} {
|
@@ -58,12 +60,8 @@ impl {{stinger.name | UpperCamelCase }}MethodHandlers for {{stinger.name | Upper
|
|
58
60
|
self
|
59
61
|
}
|
60
62
|
}
|
61
|
-
|
62
|
-
|
63
63
|
{%endif%}
|
64
64
|
|
65
|
-
|
66
|
-
|
67
65
|
#[tokio::main]
|
68
66
|
async fn main() {
|
69
67
|
env_logger::Builder::from_default_env()
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/server/src/lib.rs.jinja2
RENAMED
@@ -13,9 +13,8 @@ use mqttier::{MqttierClient{%if stinger.methods|length > 0 or stinger.properties
|
|
13
13
|
use {{stinger.rust.common_package_name}}::payloads::{*, MethodResultCode};
|
14
14
|
use std::any::Any;
|
15
15
|
{%if stinger.methods|length > 0 %}
|
16
|
-
|
17
|
-
|
18
|
-
//pub use handler::{{stinger.name | UpperCamelCase }}MethodHandlers;
|
16
|
+
use async_trait::async_trait;
|
17
|
+
use tokio::sync::Mutex as AsyncMutex;
|
19
18
|
use std::sync::{Arc, Mutex};
|
20
19
|
{%endif%}
|
21
20
|
{%if stinger.methods|length > 0 or stinger.properties|length > 0 %}
|
@@ -68,7 +67,7 @@ pub struct {{stinger.rust.server_struct_name}} {
|
|
68
67
|
{%endif%}
|
69
68
|
{%if stinger.methods|length > 0 %}
|
70
69
|
/// Struct contains all the method handlers.
|
71
|
-
method_handlers: Arc<
|
70
|
+
method_handlers: Arc<AsyncMutex<Box<dyn {{stinger.name | UpperCamelCase }}MethodHandlers>>>,
|
72
71
|
{%endif%}
|
73
72
|
{%if stinger.properties|length > 0%}
|
74
73
|
/// Struct contains all the properties.
|
@@ -85,7 +84,7 @@ pub struct {{stinger.rust.server_struct_name}} {
|
|
85
84
|
}
|
86
85
|
|
87
86
|
impl {{stinger.rust.server_struct_name}} {
|
88
|
-
pub async fn new(connection: &mut MqttierClient{%if stinger.methods|length > 0%}, method_handlers: Arc<
|
87
|
+
pub async fn new(connection: &mut MqttierClient{%if stinger.methods|length > 0%}, method_handlers: Arc<AsyncMutex<Box<dyn {{stinger.name | UpperCamelCase }}MethodHandlers>>> {%endif%}) -> Self {
|
89
88
|
{%if stinger.methods|length > 0 or stinger.properties|length > 0 %}
|
90
89
|
// Create a channel for messages to get from the MqttierClient object to this {{stinger.rust.server_struct_name}} object.
|
91
90
|
// The Connection object uses a clone of the tx side of the channel.
|
@@ -152,7 +151,7 @@ impl {{stinger.rust.server_struct_name}} {
|
|
152
151
|
|
153
152
|
{%for method_name, method in stinger.methods.items()-%}
|
154
153
|
/// Handles a request message for the {{method_name}} method.
|
155
|
-
async fn handle_{{method_name|snake_case}}_request(publisher: MqttierClient, handlers: Arc<
|
154
|
+
async fn handle_{{method_name|snake_case}}_request(publisher: MqttierClient, handlers: Arc<AsyncMutex<Box<dyn {{stinger.name | UpperCamelCase }}MethodHandlers>>>, msg: ReceivedMessage) {
|
156
155
|
let opt_corr_data = msg.correlation_data;
|
157
156
|
let opt_resp_topic = msg.response_topic;
|
158
157
|
{%if method.arg_list | length > 0 -%}
|
@@ -161,8 +160,8 @@ impl {{stinger.rust.server_struct_name}} {
|
|
161
160
|
{%endif%}{# has arg_list #}
|
162
161
|
// call the method handler
|
163
162
|
let rv: Result<{{method.return_value_rust_type}}, MethodResultCode> = {
|
164
|
-
let handler_guard = handlers.lock().
|
165
|
-
|
163
|
+
let handler_guard = handlers.lock().await;
|
164
|
+
handler_guard.handle_{{method_name|snake_case}}({%for arg in method.arg_list%}payload.{{arg.name}}{%if not loop.last%}, {%endif%}{%endfor%}).await
|
166
165
|
};
|
167
166
|
|
168
167
|
if let Some(resp_topic) = opt_resp_topic {
|
@@ -267,7 +266,7 @@ impl {{stinger.rust.server_struct_name}} {
|
|
267
266
|
|
268
267
|
{%if stinger.methods|length > 0 -%}
|
269
268
|
let method_handlers = self.method_handlers.clone();
|
270
|
-
self.method_handlers.lock().
|
269
|
+
self.method_handlers.lock().await.initialize(self.clone()).await;
|
271
270
|
{%endif-%}
|
272
271
|
|
273
272
|
let sub_ids = self.subscription_ids.clone();
|
@@ -304,13 +303,14 @@ impl {{stinger.rust.server_struct_name}} {
|
|
304
303
|
|
305
304
|
}
|
306
305
|
{%if stinger.methods|length > 0 %}
|
306
|
+
#[async_trait]
|
307
307
|
pub trait {{stinger.name | UpperCamelCase }}MethodHandlers: Send + Sync {
|
308
308
|
|
309
|
-
fn initialize(&mut self, server: {{stinger.rust.server_struct_name}}) -> Result<(), MethodResultCode>;
|
309
|
+
async fn initialize(&mut self, server: {{stinger.rust.server_struct_name}}) -> Result<(), MethodResultCode>;
|
310
310
|
|
311
311
|
{%for method_name, method in stinger.methods.items()-%}
|
312
312
|
/// Pointer to a function to handle the {{method_name}} method request.
|
313
|
-
fn handle_{{method_name|snake_case}}(&self, {%for arg in method.arg_list%}{{arg.name|snake_case}}: {{arg.rust_type}}{%if not loop.last%}, {%endif%}{%endfor%}) -> Result<{{method.return_value_rust_type}}, MethodResultCode>;
|
313
|
+
async fn handle_{{method_name|snake_case}}(&self, {%for arg in method.arg_list%}{{arg.name|snake_case}}: {{arg.rust_type}}{%if not loop.last%}, {%endif%}{%endfor%}) -> Result<{{method.return_value_rust_type}}, MethodResultCode>;
|
314
314
|
|
315
315
|
{%endfor%}
|
316
316
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/examples/client_main.cpp.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/examples/server_main.cpp.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/broker.hpp.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/client.hpp.jinja2
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/return_types.hpp.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/server.hpp.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/include/structs.hpp.jinja2
RENAMED
File without changes
|
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/partials/deserialize.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/partials/serialize.jinja2
RENAMED
File without changes
|
File without changes
|
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/cpp/src/property_structs.cpp.jinja2
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/python/interface_types.py.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/python/method_codes.py.jinja2
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/client/Cargo.toml.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/client/examples/client.rs.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/client/src/lib.rs.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/payloads/Cargo.toml.jinja2
RENAMED
File without changes
|
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/payloads/src/lib.rs.jinja2
RENAMED
File without changes
|
{stinger_ipc-0.0.26 → stinger_ipc-0.0.27}/stingeripc/templates/rust/payloads/src/payloads.rs.jinja2
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|