-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Ftr: add extension module - adapt static registry by extension - adapt nacos registry by extension link #180 * cargo fmt all * fix ci error * fix nacos image version error * Rft: re-design extension register * Fix: cargo fix * Fix: add some license for every files - extract UrlParam to single file - fix github ci error * Fix: fmt all * Fix: Add license for extension_param.rs and registry_param.rs * Fix: rename query_param_by_kv method name
- Loading branch information
Showing
57 changed files
with
2,398 additions
and
1,258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ serde_yaml = "0.9.4" # yaml file parser | |
once_cell = "1.16.0" | ||
itertools = "0.10.1" | ||
bytes = "1.0" | ||
url = "2.5.0" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
use crate::{url::UrlParam, StdError}; | ||
use std::{borrow::Cow, convert::Infallible, str::FromStr}; | ||
|
||
pub struct ExtensionName(String); | ||
|
||
impl ExtensionName { | ||
pub fn new(name: String) -> Self { | ||
ExtensionName(name) | ||
} | ||
} | ||
|
||
impl UrlParam for ExtensionName { | ||
type TargetType = String; | ||
|
||
fn name() -> &'static str { | ||
"extension-name" | ||
} | ||
|
||
fn value(&self) -> Self::TargetType { | ||
self.0.clone() | ||
} | ||
|
||
fn as_str(&self) -> Cow<str> { | ||
self.0.as_str().into() | ||
} | ||
} | ||
|
||
impl FromStr for ExtensionName { | ||
type Err = StdError; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
Ok(ExtensionName::new(s.to_string())) | ||
} | ||
} | ||
|
||
pub enum ExtensionType { | ||
Registry, | ||
} | ||
|
||
impl UrlParam for ExtensionType { | ||
type TargetType = String; | ||
|
||
fn name() -> &'static str { | ||
"extension-type" | ||
} | ||
|
||
fn value(&self) -> Self::TargetType { | ||
match self { | ||
ExtensionType::Registry => "registry".to_owned(), | ||
} | ||
} | ||
|
||
fn as_str(&self) -> Cow<str> { | ||
match self { | ||
ExtensionType::Registry => Cow::Borrowed("registry"), | ||
} | ||
} | ||
} | ||
|
||
impl FromStr for ExtensionType { | ||
type Err = Infallible; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
match s { | ||
"registry" => Ok(ExtensionType::Registry), | ||
_ => panic!("the extension type enum is not in range"), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.