mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Replace indexmap-amortized with plain (ahash) indexmap
This commit is contained in:
parent
beb8c52fe6
commit
b42d55b003
7 changed files with 11 additions and 50 deletions
33
Cargo.lock
generated
33
Cargo.lock
generated
|
|
@ -81,7 +81,6 @@ dependencies = [
|
|||
"hex",
|
||||
"hwloc",
|
||||
"indexmap",
|
||||
"indexmap-amortized",
|
||||
"libc",
|
||||
"log",
|
||||
"privdrop",
|
||||
|
|
@ -417,12 +416,6 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atone"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a8a5a5e2e3b1e128ec3783765c91c1f392172c1fffc90fd1b96a13bb18e0dd6"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
|
|
@ -1228,15 +1221,6 @@ dependencies = [
|
|||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "griddle"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e46a17d0c5d05b045e3814403914aeeb952aa9832f47b1d7ab123ab3d1660454"
|
||||
dependencies = [
|
||||
"hashbrown 0.9.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "1.8.2"
|
||||
|
|
@ -1253,12 +1237,6 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
|
|
@ -1457,17 +1435,6 @@ dependencies = [
|
|||
"hashbrown 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap-amortized"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81b5a05ffb45214e51fdd40c1f773ab57c74d2a7b41cfadc7ea443acf0359df1"
|
||||
dependencies = [
|
||||
"atone",
|
||||
"autocfg",
|
||||
"griddle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indicatif"
|
||||
version = "0.17.3"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ git-testament = "0.2"
|
|||
hashbrown = "0.13"
|
||||
hex = "0.4"
|
||||
indexmap = "1"
|
||||
indexmap-amortized = "1"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
privdrop = "0.5"
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@ pub mod rustls_config;
|
|||
/// IndexMap using AHash hasher
|
||||
pub type IndexMap<K, V> = indexmap::IndexMap<K, V, RandomState>;
|
||||
|
||||
/// Amortized IndexMap using AHash hasher
|
||||
pub type AmortizedIndexMap<K, V> = indexmap_amortized::IndexMap<K, V, RandomState>;
|
||||
|
||||
/// Peer, connection or similar valid until this instant
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct ValidUntil(SecondsSinceServerStart);
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@ use rand::SeedableRng;
|
|||
use smartstring::{LazyCompact, SmartString};
|
||||
|
||||
use aquatic_common::access_list::{create_access_list_cache, AccessListArcSwap, AccessListCache};
|
||||
use aquatic_common::{extract_response_peers, IndexMap, PanicSentinel};
|
||||
use aquatic_common::{AmortizedIndexMap, CanonicalSocketAddr};
|
||||
use aquatic_common::{SecondsSinceServerStart, ServerStartInstant, ValidUntil};
|
||||
use aquatic_common::{
|
||||
extract_response_peers, CanonicalSocketAddr, IndexMap, PanicSentinel, SecondsSinceServerStart,
|
||||
ServerStartInstant, ValidUntil,
|
||||
};
|
||||
use aquatic_http_protocol::common::*;
|
||||
use aquatic_http_protocol::request::*;
|
||||
use aquatic_http_protocol::response::ResponsePeer;
|
||||
|
|
@ -117,7 +118,7 @@ impl<I: Ip> TorrentData<I> {
|
|||
}
|
||||
}
|
||||
|
||||
pub type TorrentMap<I> = AmortizedIndexMap<InfoHash, TorrentData<I>>;
|
||||
pub type TorrentMap<I> = IndexMap<InfoHash, TorrentData<I>>;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TorrentMaps {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
|
||||
use aquatic_common::{
|
||||
AmortizedIndexMap, IndexMap, SecondsSinceServerStart, ServerStartInstant, ValidUntil,
|
||||
};
|
||||
use aquatic_common::{IndexMap, SecondsSinceServerStart, ServerStartInstant, ValidUntil};
|
||||
use aquatic_http_protocol::common::{AnnounceEvent, InfoHash, PeerId};
|
||||
use aquatic_http_protocol::response::ResponsePeer;
|
||||
|
||||
|
|
@ -76,7 +74,7 @@ impl<I: Ip> Default for TorrentData<I> {
|
|||
}
|
||||
}
|
||||
|
||||
pub type TorrentMap<I> = AmortizedIndexMap<InfoHash, TorrentData<I>>;
|
||||
pub type TorrentMap<I> = IndexMap<InfoHash, TorrentData<I>>;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TorrentMaps {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use aquatic_common::SecondsSinceServerStart;
|
|||
use aquatic_common::ServerStartInstant;
|
||||
use aquatic_common::{
|
||||
access_list::{create_access_list_cache, AccessListArcSwap, AccessListCache, AccessListMode},
|
||||
extract_response_peers, AmortizedIndexMap, ValidUntil,
|
||||
extract_response_peers, ValidUntil,
|
||||
};
|
||||
|
||||
use aquatic_udp_protocol::*;
|
||||
|
|
@ -144,7 +144,7 @@ impl<I: Ip> Default for TorrentData<I> {
|
|||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TorrentMap<I: Ip>(pub AmortizedIndexMap<InfoHash, TorrentData<I>>);
|
||||
pub struct TorrentMap<I: Ip>(pub IndexMap<InfoHash, TorrentData<I>>);
|
||||
|
||||
impl<I: Ip> TorrentMap<I> {
|
||||
/// Remove forbidden or inactive torrents, reclaim space and return number of remaining peers
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ use hashbrown::HashMap;
|
|||
use rand::{rngs::SmallRng, SeedableRng};
|
||||
|
||||
use aquatic_common::{
|
||||
extract_response_peers, AmortizedIndexMap, IndexMap, PanicSentinel, SecondsSinceServerStart,
|
||||
ServerStartInstant,
|
||||
extract_response_peers, IndexMap, PanicSentinel, SecondsSinceServerStart, ServerStartInstant,
|
||||
};
|
||||
use aquatic_ws_protocol::*;
|
||||
|
||||
|
|
@ -87,7 +86,7 @@ impl TorrentData {
|
|||
}
|
||||
}
|
||||
|
||||
type TorrentMap = AmortizedIndexMap<InfoHash, TorrentData>;
|
||||
type TorrentMap = IndexMap<InfoHash, TorrentData>;
|
||||
|
||||
#[derive(Default)]
|
||||
struct TorrentMaps {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue