Skip to content

Commit

Permalink
Merge pull request #491 from weibocom/revert-464-main_kvector_hybrid_…
Browse files Browse the repository at this point in the history
…202405

Revert "Main kvector hybrid 202405"
  • Loading branch information
parabala authored Sep 6, 2024
2 parents a013b40 + 349d351 commit c4a1725
Show file tree
Hide file tree
Showing 34 changed files with 239 additions and 1,399 deletions.
17 changes: 8 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ds/src/mem/ring_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ impl RingSlice {
#[inline]
pub fn try_str_num(&self, r: impl Range) -> Option<usize> {
let (start, end) = r.range(self);
if start == end {
return None;
}
let mut num = 0usize;
for i in start..end {
if !self[i].is_ascii_digit() {
Expand Down
1 change: 0 additions & 1 deletion endpoint/src/topo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ procs::topology_dispatcher! {

pub trait Topology : Endpoint + Hash{
fn exp_sec(&self) -> u32 {86400}
fn has_attach(&self) -> bool {false}
} => where P:Protocol, E:Endpoint<Item = R>, R:Request, Topologies<E, P>: Endpoint

trait Inited {
Expand Down
162 changes: 0 additions & 162 deletions endpoint/src/vector/batch.rs

This file was deleted.

35 changes: 3 additions & 32 deletions endpoint/src/vector/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ pub struct VectorNamespace {
pub(crate) backends_flaten: Vec<String>,
#[serde(default)]
pub(crate) backends: HashMap<Years, Vec<String>>,
#[serde(default)]
pub(crate) si_backends: Vec<String>,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
Expand Down Expand Up @@ -46,20 +44,6 @@ pub struct Basic {
pub(crate) user: String,
#[serde(default)]
pub(crate) region_enabled: bool,
#[serde(default)]
pub(crate) si_db_name: String,
#[serde(default)]
pub(crate) si_table_name: String,
#[serde(default)]
pub(crate) si_db_count: u32,
#[serde(default)]
pub(crate) si_table_count: u32,
#[serde(default)]
pub(crate) si_user: String,
#[serde(default)]
pub(crate) si_password: String,
#[serde(default)]
pub(crate) si_cols: Vec<String>,
}

impl VectorNamespace {
Expand All @@ -82,7 +66,7 @@ impl VectorNamespace {
}
last_year = year.1;
}
match ns.decrypt_password(ns.basic.password.as_bytes()) {
match ns.decrypt_password() {
Ok(password) => ns.basic.password = password,
Err(e) => {
log::warn!("failed to decrypt password, e:{}", e);
Expand All @@ -93,19 +77,6 @@ impl VectorNamespace {
init.extend_from_slice(b.1);
init
});
if ns.basic.si_password.len() > 0 {
match ns.decrypt_password(ns.basic.si_password.as_bytes()) {
Ok(password) => ns.basic.si_password = password,
Err(e) => {
log::warn!("failed to decrypt si password, e:{}", e);
return None;
}
}
}
if ns.si_backends.len() > 0 {
ns.backends_flaten
.extend_from_slice(ns.si_backends.as_slice());
}
Some(ns)
}
Err(e) => {
Expand All @@ -116,9 +87,9 @@ impl VectorNamespace {
}

#[inline]
fn decrypt_password(&self, data: &[u8]) -> Result<String, Box<dyn std::error::Error>> {
fn decrypt_password(&self) -> Result<String, Box<dyn std::error::Error>> {
let key_pem = fs::read_to_string(&context::get().key_path)?;
let encrypted_data = general_purpose::STANDARD.decode(data)?;
let encrypted_data = general_purpose::STANDARD.decode(self.basic.password.as_bytes())?;
let decrypted_data = ds::decrypt::decrypt_password(&key_pem, &encrypted_data)?;
let decrypted_string = String::from_utf8(decrypted_data)?;
Ok(decrypted_string)
Expand Down
1 change: 0 additions & 1 deletion endpoint/src/vector/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mod batch;
pub(crate) mod config;
mod strategy;
pub mod topo;
Expand Down
Loading

0 comments on commit c4a1725

Please sign in to comment.