Compare dashmaps

This commit is contained in:
Ara Sadoyan
2025-03-12 13:09:55 +01:00
parent a824912a84
commit d559db65b5
2 changed files with 60 additions and 24 deletions

View File

@@ -153,6 +153,7 @@ pub fn build_upstreams(d: &str, kind: &str) -> UpstreamMap {
pub fn build_upstreams2(d: &str, kind: &str) -> UpstresmDashMap {
let upstreams: UpstresmDashMap = DashMap::new();
let hopar: UpstresmDashMap = DashMap::new();
let mut contents = d.to_string();
match kind {
"filepath" => {
@@ -209,7 +210,14 @@ pub fn build_upstreams2(d: &str, kind: &str) -> UpstresmDashMap {
.or_insert_with(|| (Vec::new(), AtomicUsize::new(0)))
.0
.push((ip.to_string(), port, ssl, proto.to_string()));
let entry = hopar.entry(hostname.to_string()).or_insert_with(DashMap::new);
entry
.entry(path.to_string())
.or_insert_with(|| (Vec::new(), AtomicUsize::new(0)))
.0
.push((ip.to_string(), port, ssl, proto.to_string()));
}
// println!("\n\nResult ===> {} <===\n\n", dam(&hopar, &upstreams));
// println!("{:?}", hopar);
upstreams
}