Skip to content

Commit

Permalink
bump: version=0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
CherishCai committed Sep 29, 2023
1 parent 2213dd0 commit 9633c79
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nacos-sdk-rust-binding-py"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
license = "Apache-2.0"
publish = false
Expand All @@ -20,7 +20,7 @@ doc = false
[dependencies]
pyo3 = "0.18"

nacos-sdk = { version = "0.3.1", features = ["default"] }
nacos-sdk = { version = "0.3.2", features = ["default"] }
#nacos-sdk = { git = "https://github.com/nacos-group/nacos-sdk-rust.git", features = ["default"] }

tracing-subscriber = { version = "0.3", features = ["default"] }
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ pip install nacos-sdk-rust-binding-py

环境变量 `NACOS_CLIENT_COMMON_THREAD_CORES=4` 可设置客户端核心线程数,默认是 CPU 数目 num_cpus

环境变量 `ENV_NACOS_CLIENT_NAMING_PUSH_EMPTY_PROTECTION=false` 可关闭 Naming 防推空保护,默认 true

更多环境变量请看 `nacos-sdk-rust`[文档说明](https://github.com/nacos-group/nacos-sdk-rust)

### Definition of ClientOptions

```python
Expand All @@ -39,6 +43,9 @@ class ClientOptions:
# Password for Auth
#[pyo3(set, get)]
password: Option<String>,
# naming push_empty_protection, default true
#[pyo3(set, get)]
naming_push_empty_protection: Option<bool>,

# Init
def __init__(self, server_addr, namespace, app_name, username, password):
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ pub struct ClientOptions {
/// Password for Auth
#[pyo3(set, get)]
pub password: Option<String>,
/// naming push_empty_protection, default true
#[pyo3(set, get)]
pub naming_push_empty_protection: Option<bool>,
}

#[pymethods]
Expand All @@ -81,13 +84,15 @@ impl ClientOptions {
app_name: Option<String>,
username: Option<String>,
password: Option<String>,
naming_push_empty_protection: Option<bool>,
) -> PyResult<ClientOptions> {
Ok(Self {
server_addr,
namespace,
app_name,
username,
password,
naming_push_empty_protection,
})
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/naming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ impl NacosNamingClient {
client_options
.app_name
.unwrap_or(nacos_sdk::api::constants::UNKNOWN.to_string()),
)
.naming_push_empty_protection(
client_options.naming_push_empty_protection.unwrap_or(true),
);

// need enable_auth_plugin_http with username & password
Expand Down

0 comments on commit 9633c79

Please sign in to comment.