nacos-sdk-rust-binding-node 0.2.0 → 0.2.1
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.
- package/Cargo.toml +4 -2
- package/package.json +15 -15
- package/src/lib.rs +1 -1
- package/src/plugin.rs +14 -29
package/Cargo.toml
CHANGED
|
@@ -18,12 +18,14 @@ crate-type = ["cdylib"]
|
|
|
18
18
|
napi = { version = "2", default-features = false, features = ["napi4", "async"] }
|
|
19
19
|
napi-derive = "2"
|
|
20
20
|
|
|
21
|
-
nacos-sdk = { version = "0.3.0-
|
|
21
|
+
nacos-sdk = { version = "0.3.0-beta", features = ["async"] }
|
|
22
22
|
#nacos-sdk = { git = "https://github.com/nacos-group/nacos-sdk-rust.git", features = ["async"] }
|
|
23
23
|
|
|
24
|
-
tracing-subscriber = { version = "0.3", features = ["
|
|
24
|
+
tracing-subscriber = { version = "0.3", features = ["default"] }
|
|
25
|
+
#tracing-subscriber = { version = "0.3", features = ["env-filter", "local-time"] } # occur `<unknown time>`
|
|
25
26
|
tracing-appender = "0.2"
|
|
26
27
|
lazy_static = "1.4.0"
|
|
28
|
+
async-trait = "0.1"
|
|
27
29
|
|
|
28
30
|
[build-dependencies]
|
|
29
31
|
napi-build = "2"
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"binding",
|
|
8
8
|
"ffi"
|
|
9
9
|
],
|
|
10
|
-
"version": "0.2.
|
|
10
|
+
"version": "0.2.1",
|
|
11
11
|
"bugs": "https://github.com/opc-source/nacos-sdk-rust-binding-node/issues",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"repository": {
|
|
@@ -55,19 +55,19 @@
|
|
|
55
55
|
},
|
|
56
56
|
"packageManager": "yarn@3.4.1",
|
|
57
57
|
"optionalDependencies": {
|
|
58
|
-
"nacos-sdk-rust-binding-node-win32-x64-msvc": "0.2.
|
|
59
|
-
"nacos-sdk-rust-binding-node-darwin-x64": "0.2.
|
|
60
|
-
"nacos-sdk-rust-binding-node-linux-x64-gnu": "0.2.
|
|
61
|
-
"nacos-sdk-rust-binding-node-darwin-arm64": "0.2.
|
|
62
|
-
"nacos-sdk-rust-binding-node-android-arm64": "0.2.
|
|
63
|
-
"nacos-sdk-rust-binding-node-linux-arm64-gnu": "0.2.
|
|
64
|
-
"nacos-sdk-rust-binding-node-linux-arm64-musl": "0.2.
|
|
65
|
-
"nacos-sdk-rust-binding-node-win32-arm64-msvc": "0.2.
|
|
66
|
-
"nacos-sdk-rust-binding-node-linux-arm-gnueabihf": "0.2.
|
|
67
|
-
"nacos-sdk-rust-binding-node-linux-x64-musl": "0.2.
|
|
68
|
-
"nacos-sdk-rust-binding-node-freebsd-x64": "0.2.
|
|
69
|
-
"nacos-sdk-rust-binding-node-win32-ia32-msvc": "0.2.
|
|
70
|
-
"nacos-sdk-rust-binding-node-android-arm-eabi": "0.2.
|
|
71
|
-
"nacos-sdk-rust-binding-node-darwin-universal": "0.2.
|
|
58
|
+
"nacos-sdk-rust-binding-node-win32-x64-msvc": "0.2.1",
|
|
59
|
+
"nacos-sdk-rust-binding-node-darwin-x64": "0.2.1",
|
|
60
|
+
"nacos-sdk-rust-binding-node-linux-x64-gnu": "0.2.1",
|
|
61
|
+
"nacos-sdk-rust-binding-node-darwin-arm64": "0.2.1",
|
|
62
|
+
"nacos-sdk-rust-binding-node-android-arm64": "0.2.1",
|
|
63
|
+
"nacos-sdk-rust-binding-node-linux-arm64-gnu": "0.2.1",
|
|
64
|
+
"nacos-sdk-rust-binding-node-linux-arm64-musl": "0.2.1",
|
|
65
|
+
"nacos-sdk-rust-binding-node-win32-arm64-msvc": "0.2.1",
|
|
66
|
+
"nacos-sdk-rust-binding-node-linux-arm-gnueabihf": "0.2.1",
|
|
67
|
+
"nacos-sdk-rust-binding-node-linux-x64-musl": "0.2.1",
|
|
68
|
+
"nacos-sdk-rust-binding-node-freebsd-x64": "0.2.1",
|
|
69
|
+
"nacos-sdk-rust-binding-node-win32-ia32-msvc": "0.2.1",
|
|
70
|
+
"nacos-sdk-rust-binding-node-android-arm-eabi": "0.2.1",
|
|
71
|
+
"nacos-sdk-rust-binding-node-darwin-universal": "0.2.1"
|
|
72
72
|
}
|
|
73
73
|
}
|
package/src/lib.rs
CHANGED
|
@@ -19,7 +19,7 @@ lazy_static::lazy_static! {
|
|
|
19
19
|
|
|
20
20
|
tracing_subscriber::fmt()
|
|
21
21
|
.with_writer(non_blocking)
|
|
22
|
-
.with_timer(tracing_subscriber::fmt::time::LocalTime::rfc_3339())
|
|
22
|
+
// .with_timer(tracing_subscriber::fmt::time::LocalTime::rfc_3339()) // occur `<unknown time>`
|
|
23
23
|
.with_thread_names(true)
|
|
24
24
|
.with_thread_ids(true)
|
|
25
25
|
.with_max_level(tracing_subscriber::filter::LevelFilter::INFO)
|
package/src/plugin.rs
CHANGED
|
@@ -7,8 +7,9 @@ pub struct NacosConfigFilter {
|
|
|
7
7
|
pub(crate) func: Arc<ThreadsafeFunction<(Option<NacosConfigReq>, Option<NacosConfigResp>)>>,
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
#[async_trait::async_trait]
|
|
10
11
|
impl nacos_sdk::api::plugin::ConfigFilter for NacosConfigFilter {
|
|
11
|
-
fn filter(
|
|
12
|
+
async fn filter(
|
|
12
13
|
&self,
|
|
13
14
|
config_req: Option<&mut nacos_sdk::api::plugin::ConfigReq>,
|
|
14
15
|
config_resp: Option<&mut nacos_sdk::api::plugin::ConfigResp>,
|
|
@@ -22,21 +23,13 @@ impl nacos_sdk::api::plugin::ConfigFilter for NacosConfigFilter {
|
|
|
22
23
|
encrypted_data_key: config_req.encrypted_data_key.clone(),
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
let (
|
|
26
|
-
|
|
27
|
-
Ok((Some(js_config_req), None))
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Option<NacosConfigReq>,
|
|
31
|
-
Option<NacosConfigResp>,
|
|
32
|
-
)| {
|
|
33
|
-
let after_js_config_req = after_js_config_req.unwrap();
|
|
34
|
-
let _ = tx.send(after_js_config_req);
|
|
35
|
-
Ok(())
|
|
36
|
-
},
|
|
37
|
-
);
|
|
26
|
+
let (after_js_config_req, _): (Option<NacosConfigReq>, Option<NacosConfigResp>) = self
|
|
27
|
+
.func
|
|
28
|
+
.call_async(Ok((Some(js_config_req), None)))
|
|
29
|
+
.await
|
|
30
|
+
.unwrap();
|
|
38
31
|
|
|
39
|
-
let ret =
|
|
32
|
+
let ret = after_js_config_req.unwrap();
|
|
40
33
|
config_req.data_id = ret.data_id;
|
|
41
34
|
config_req.group = ret.group;
|
|
42
35
|
config_req.namespace = ret.namespace;
|
|
@@ -53,21 +46,13 @@ impl nacos_sdk::api::plugin::ConfigFilter for NacosConfigFilter {
|
|
|
53
46
|
encrypted_data_key: config_resp.encrypted_data_key.clone(),
|
|
54
47
|
};
|
|
55
48
|
|
|
56
|
-
let (
|
|
57
|
-
|
|
58
|
-
Ok((None, Some(js_config_resp)))
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Option<NacosConfigReq>,
|
|
62
|
-
Option<NacosConfigResp>,
|
|
63
|
-
)| {
|
|
64
|
-
let after_js_config_resp = after_js_config_resp.unwrap();
|
|
65
|
-
let _ = tx.send(after_js_config_resp);
|
|
66
|
-
Ok(())
|
|
67
|
-
},
|
|
68
|
-
);
|
|
49
|
+
let (_, after_js_config_resp): (Option<NacosConfigReq>, Option<NacosConfigResp>) = self
|
|
50
|
+
.func
|
|
51
|
+
.call_async(Ok((None, Some(js_config_resp))))
|
|
52
|
+
.await
|
|
53
|
+
.unwrap();
|
|
69
54
|
|
|
70
|
-
let ret =
|
|
55
|
+
let ret = after_js_config_resp.unwrap();
|
|
71
56
|
config_resp.data_id = ret.data_id;
|
|
72
57
|
config_resp.group = ret.group;
|
|
73
58
|
config_resp.namespace = ret.namespace;
|