Skip to content

Commit 530f0a3

Browse files
authored
Merge pull request #229 from GOODBOY008/hotfix
refactor: fix typos and improve error messages
2 parents 80e2ca8 + b59cb34 commit 530f0a3

14 files changed

Lines changed: 30 additions & 30 deletions

File tree

src/common/limiter_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ impl TryFrom<&str> for LimiterData {
3434
let a: i32 = if let Some(e) = iter.next() {
3535
e.parse()?
3636
} else {
37-
return Err(anyhow::anyhow!("limiter is unvalid"));
37+
return Err(anyhow::anyhow!("limiter is invalid"));
3838
};
3939
let b: i32 = if let Some(e) = iter.next() {
4040
e.parse()?
4141
} else {
42-
return Err(anyhow::anyhow!("limiter is unvalid"));
42+
return Err(anyhow::anyhow!("limiter is invalid"));
4343
};
4444
let c: i64 = if let Some(e) = iter.next() {
4545
e.parse()?
4646
} else {
47-
return Err(anyhow::anyhow!("limiter is unvalid"));
47+
return Err(anyhow::anyhow!("limiter is invalid"));
4848
};
4949
Ok(Self::new(a, b, c))
5050
}

src/console/v2/naming_api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub async fn add_instance(
237237
if !namespace_privilege.check_permission(&instance.namespace_id) {
238238
user_no_namespace_permission!(&instance.namespace_id);
239239
}
240-
if !instance.check_vaild() {
240+
if !instance.check_valid() {
241241
HttpResponse::Ok().json(ApiResult::<()>::error(
242242
ERROR_CODE_SYSTEM_ERROR.to_string(),
243243
Some("instance check is invalid".to_string()),
@@ -274,7 +274,7 @@ pub async fn remove_instance(
274274
if !namespace_privilege.check_permission(&instance.namespace_id) {
275275
user_no_namespace_permission!(&instance.namespace_id);
276276
}
277-
if !instance.check_vaild() {
277+
if !instance.check_valid() {
278278
HttpResponse::Ok().json(ApiResult::<()>::error(
279279
ERROR_CODE_SYSTEM_ERROR.to_string(),
280280
Some("instance check is invalid".to_string()),

src/grpc/handler/naming_batch_instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl BatchInstanceRequestHandler {
6666
} else if !service_name.is_empty() {
6767
service_name.clone()
6868
} else {
69-
return Err(anyhow::format_err!("serivceName is unvaild!"));
69+
return Err(anyhow::format_err!("serviceName is invalid!"));
7070
};
7171

7272
let mut instance = Instance {

src/grpc/handler/naming_instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl InstanceRequestHandler {
6060
} else if let Some(v) = request.service_name {
6161
Arc::new(v)
6262
} else {
63-
return Err(anyhow::format_err!("serivceName is unvaild!"));
63+
return Err(anyhow::format_err!("serviceName is invalid!"));
6464
};
6565
let now = now_millis_i64();
6666
let mut instance = Instance {

src/naming/api_model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl ServiceInfoParam {
149149
pub(crate) fn build_service_info(self) -> anyhow::Result<ServiceDetailDto> {
150150
if let Some(service_name) = self.service_name {
151151
if service_name.is_empty() {
152-
return Err(anyhow::anyhow!("service_name is vaild"));
152+
return Err(anyhow::anyhow!("service_name is valid"));
153153
}
154154
let metadata = if let Some(metadata_str) = self.metadata {
155155
match NamingUtils::parse_metadata(&metadata_str) {

src/naming/cluster/node_manage.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::{
2525
#[derive(Debug, Clone, PartialEq, Eq)]
2626
pub enum NodeStatus {
2727
Valid,
28-
Unvalid,
28+
Invalid,
2929
}
3030

3131
impl Default for NodeStatus {
@@ -363,14 +363,14 @@ impl InnerNodeManage {
363363
*/
364364
if !node.is_local && node.status == NodeStatus::Valid && node.last_active_time < timeout
365365
{
366-
node.status = NodeStatus::Unvalid;
367-
Self::client_unvalid_instance(naming_actor, node);
366+
node.status = NodeStatus::Invalid;
367+
Self::client_invalid_instance(naming_actor, node);
368368
}
369369
}
370370
self.update_process_range();
371371
}
372372

373-
fn client_unvalid_instance(
373+
fn client_invalid_instance(
374374
naming_actor: &Option<Addr<NamingActor>>,
375375
node: &mut ClusterInnerNode,
376376
) {

src/naming/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ impl NamingActor {
385385
from_sync: bool,
386386
) -> UpdateInstanceType {
387387
instance.init();
388-
//assert!(instance.check_vaild());
388+
//assert!(instance.check_valid());
389389
self.create_empty_service(key);
390390
//let is_from_from_cluster = instance.is_from_cluster();
391391
let at_process_range = if let Some(range) = &self.current_range {

src/naming/dal/service_actor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ create index if not exists tb_service_key_idx on tb_service(namespace_id,service
6060
Ok(())
6161
}
6262
else{
63-
Err(anyhow::anyhow!("update_service:unvaild service info"))
63+
Err(anyhow::anyhow!("update_service:invalid service info"))
6464
}
6565
}
6666
}

src/naming/dal/service_do.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl ServiceDO {
3636
s
3737
}
3838

39-
pub fn check_vaild(&self) -> bool {
39+
pub fn check_valid(&self) -> bool {
4040
if let (Some(namespace_id),Some(service_name),Some(group_name)) =
4141
(self.namespace_id.as_ref(),self.service_name.as_ref(),self.group_name.as_ref()) {
4242
true

src/naming/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl NamingUtils {
3434
format!("{}@@{}", group_name, service_name)
3535
}
3636

37-
pub fn split_group_and_serivce_name(grouped_name: &str) -> Option<(String, String)> {
37+
pub fn split_group_and_service_name(grouped_name: &str) -> Option<(String, String)> {
3838
let split = grouped_name.split("@@").collect::<Vec<_>>();
3939
if split.is_empty() {
4040
return None;

0 commit comments

Comments
 (0)