diff --git a/Cargo.lock b/Cargo.lock index 2c1dc845..991619c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1170,32 +1170,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" -[[package]] -name = "core-foundation" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" -dependencies = [ - "core-foundation-sys 0.7.0", - "libc", -] - [[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys 0.8.4", + "core-foundation-sys", "libc", ] -[[package]] -name = "core-foundation-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" - [[package]] name = "core-foundation-sys" version = "0.8.4" @@ -1209,7 +1193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.3", + "core-foundation", "core-graphics-types", "foreign-types", "libc", @@ -1222,7 +1206,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.3", + "core-foundation", "libc", ] @@ -1821,28 +1805,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - [[package]] name = "fallible-iterator" version = "0.2.0" @@ -2279,15 +2241,6 @@ dependencies = [ "ahash 0.7.6", ] -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.3", -] - [[package]] name = "hashbrown" version = "0.14.0" @@ -2298,15 +2251,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "hashlink" -version = "0.8.2" -source = "git+https://gitlab.com/veilid/hashlink.git?rev=add585db56765b4553b45d535e0f8d0a62a975c6#add585db56765b4553b45d535e0f8d0a62a975c6" -dependencies = [ - "hashbrown 0.13.2", - "serde", -] - [[package]] name = "hashlink" version = "0.8.4" @@ -2316,6 +2260,15 @@ dependencies = [ "hashbrown 0.14.0", ] +[[package]] +name = "hashlink" +version = "0.8.4" +source = "git+https://gitlab.com/veilid/hashlink.git?rev=14ea55b8b148f51b834c0c7ad5755066400d8c71#14ea55b8b148f51b834c0c7ad5755066400d8c71" +dependencies = [ + "hashbrown 0.14.0", + "serde", +] + [[package]] name = "hdrhistogram" version = "7.5.2" @@ -2482,7 +2435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", - "core-foundation-sys 0.8.4", + "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", @@ -2619,9 +2572,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -2722,30 +2672,19 @@ dependencies = [ "serde", ] -[[package]] -name = "keychain-services" -version = "0.1.2" -source = "git+https://github.com/iqlusioninc/keychain-services.rs.git?rev=7410fb8baf4ecdf04cdcd7d06d02658f4f158d77#7410fb8baf4ecdf04cdcd7d06d02658f4f158d77" -dependencies = [ - "core-foundation 0.7.0", - "failure", - "failure_derive", - "zeroize", -] - [[package]] name = "keyring-manager" version = "0.5.0" -source = "git+https://gitlab.com/veilid/keyring-manager.git?rev=e00be7d4130f3e3f69548121de26b24aeb935df2#e00be7d4130f3e3f69548121de26b24aeb935df2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c023f807de9a2f26e86c6ec3b5a3e0ea5681301999dcda9e262069ab3efb63e" dependencies = [ "byteorder", "cfg-if 1.0.0", - "core-foundation 0.9.3", - "core-foundation-sys 0.8.4", + "core-foundation", + "core-foundation-sys", "directories 5.0.1", "fs4", "jni", - "keychain-services", "lazy_static", "log", "ndk", @@ -2762,7 +2701,8 @@ dependencies = [ [[package]] name = "keyvaluedb" version = "0.1.0" -source = "git+https://gitlab.com/veilid/keyvaluedb.git?rev=1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0#1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8833bc9e937f44bac0e8d129b3ccda60dee6ca5fa2757d7e05a5e04503df02fb" dependencies = [ "smallvec", ] @@ -2770,7 +2710,8 @@ dependencies = [ [[package]] name = "keyvaluedb-memorydb" version = "0.1.0" -source = "git+https://gitlab.com/veilid/keyvaluedb.git?rev=1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0#1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14fdc324ae658318df46f62e64159c5662b94bcc99f9b6403d47d20ca7768b21" dependencies = [ "keyvaluedb", "parking_lot 0.12.1", @@ -2779,7 +2720,8 @@ dependencies = [ [[package]] name = "keyvaluedb-sqlite" version = "0.1.0" -source = "git+https://gitlab.com/veilid/keyvaluedb.git?rev=1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0#1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6bad95a1ad34c10ad4823fae1cb655be7fec022de642c95fbfafad360ba2f54" dependencies = [ "hex", "keyvaluedb", @@ -2791,7 +2733,8 @@ dependencies = [ [[package]] name = "keyvaluedb-web" version = "0.1.0" -source = "git+https://gitlab.com/veilid/keyvaluedb.git?rev=1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0#1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26cc6bb420f98cdd63a72c95eaa06947cdbd04e60a8d296b87f466196bacf068" dependencies = [ "async-lock", "flume", @@ -2800,7 +2743,7 @@ dependencies = [ "keyvaluedb", "keyvaluedb-memorydb", "log", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "send_wrapper 0.6.0", "wasm-bindgen", "web-sys", @@ -4239,7 +4182,7 @@ dependencies = [ "bitflags 2.4.0", "fallible-iterator", "fallible-streaming-iterator", - "hashlink 0.8.4", + "hashlink 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "libsqlite3-sys", "smallvec", ] @@ -4417,8 +4360,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.3", - "core-foundation-sys 0.8.4", + "core-foundation", + "core-foundation-sys", "libc", "security-framework-sys", ] @@ -4429,7 +4372,7 @@ version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ - "core-foundation-sys 0.8.4", + "core-foundation-sys", "libc", ] @@ -4887,18 +4830,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", -] - [[package]] name = "sysinfo" version = "0.28.4" @@ -4906,7 +4837,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c2f3ca6693feb29a89724516f016488e9aafc7f37264f898593ee4b942f31b" dependencies = [ "cfg-if 1.0.0", - "core-foundation-sys 0.8.4", + "core-foundation-sys", "libc", "ntapi", "once_cell", @@ -4956,18 +4887,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", @@ -5556,12 +5487,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "unicode_categories" version = "0.1.1" @@ -5707,7 +5632,7 @@ dependencies = [ "futures-util", "generic-array 0.14.7", "getrandom 0.2.10", - "hashlink 0.8.2", + "hashlink 0.8.4 (git+https://gitlab.com/veilid/hashlink.git?rev=14ea55b8b148f51b834c0c7ad5755066400d8c71)", "hex", "ifstructs", "igd", diff --git a/veilid-core/Cargo.toml b/veilid-core/Cargo.toml index 28e760cc..202268c5 100644 --- a/veilid-core/Cargo.toml +++ b/veilid-core/Cargo.toml @@ -83,11 +83,11 @@ thiserror = "1.0.47" # Data structures enumset = { version = "1.1.2", features = ["serde"] } -keyvaluedb = { version = "0.1.0", git = "https://gitlab.com/veilid/keyvaluedb.git", rev = "1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0" } +keyvaluedb = "0.1.0" range-set-blaze = "0.1.9" weak-table = "0.3.2" generic-array = "0.14.7" -hashlink = { version = "0.8.2", git = "https://gitlab.com/veilid/hashlink.git", rev = "add585db56765b4553b45d535e0f8d0a62a975c6", features = [ +hashlink = { version = "0.8.4", git = "https://gitlab.com/veilid/hashlink.git", rev = "14ea55b8b148f51b834c0c7ad5755066400d8c71", features = [ "serde_impl", ] } @@ -166,8 +166,8 @@ futures-util = { version = "0.3.28", default-features = false, features = [ ] } # Data structures -keyring-manager = { version = "0.5.0", git = "https://gitlab.com/veilid/keyring-manager.git", rev = "e00be7d4130f3e3f69548121de26b24aeb935df2" } -keyvaluedb-sqlite = { version = "0.1.0", git = "https://gitlab.com/veilid/keyvaluedb.git", rev = "1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0" } +keyring-manager = "0.5.0" +keyvaluedb-sqlite = "0.1.0" # Network async-tungstenite = { version = "0.23.0", features = ["async-tls"] } @@ -208,7 +208,7 @@ wasm-logger = "0.2.0" tracing-wasm = "0.2.1" # Data Structures -keyvaluedb-web = { version = "0.1.0", git = "https://gitlab.com/veilid/keyvaluedb.git", rev = "1430135c7e3b1d0176c0b45f64e8c0a9d85d44d0" } +keyvaluedb-web = "0.1.0" ### Configuration for WASM32 'web-sys' crate [target.'cfg(target_arch = "wasm32")'.dependencies.web-sys] diff --git a/veilid-core/src/crypto/dh_cache.rs b/veilid-core/src/crypto/dh_cache.rs index 17c5d4ae..47382a50 100644 --- a/veilid-core/src/crypto/dh_cache.rs +++ b/veilid-core/src/crypto/dh_cache.rs @@ -40,6 +40,6 @@ pub fn bytes_to_cache(bytes: &[u8], cache: &mut DHCache) { let v = DHCacheValue { shared_secret: SharedSecret::new(d[64..96].try_into().expect("asdf")), }; - cache.insert(k, v, |_k, _v| {}); + cache.insert(k, v); } } diff --git a/veilid-core/src/crypto/mod.rs b/veilid-core/src/crypto/mod.rs index 89213932..e424eb46 100644 --- a/veilid-core/src/crypto/mod.rs +++ b/veilid-core/src/crypto/mod.rs @@ -310,13 +310,10 @@ impl Crypto { secret: &SecretKey, ) -> VeilidAPIResult { Ok( - match self.inner.lock().dh_cache.entry( - DHCacheKey { - key: *key, - secret: *secret, - }, - |_k, _v| {}, - ) { + match self.inner.lock().dh_cache.entry(DHCacheKey { + key: *key, + secret: *secret, + }) { Entry::Occupied(e) => e.get().shared_secret, Entry::Vacant(e) => { let shared_secret = vcrypto.compute_dh(key, secret)?; diff --git a/veilid-core/src/network_manager/connection_table.rs b/veilid-core/src/network_manager/connection_table.rs index a6d60ec6..be39fb3b 100644 --- a/veilid-core/src/network_manager/connection_table.rs +++ b/veilid-core/src/network_manager/connection_table.rs @@ -168,9 +168,7 @@ impl ConnectionTable { }; // Add the connection to the table - let res = inner.conn_by_id[protocol_index].insert(id, network_connection, |_k, _v| { - // never lrus, unbounded - }); + let res = inner.conn_by_id[protocol_index].insert(id, network_connection); assert!(res.is_none()); // if we have reached the maximum number of connections per protocol type diff --git a/veilid-core/src/network_manager/mod.rs b/veilid-core/src/network_manager/mod.rs index 2bac8c5e..dc9756fa 100644 --- a/veilid-core/src/network_manager/mod.rs +++ b/veilid-core/src/network_manager/mod.rs @@ -454,9 +454,7 @@ impl NetworkManager { pub fn update_client_whitelist(&self, client: TypedKey) { let mut inner = self.inner.lock(); - match inner.client_whitelist.entry(client, |_k, _v| { - // do nothing on LRU evict - }) { + match inner.client_whitelist.entry(client) { hashlink::lru_cache::Entry::Occupied(mut entry) => { entry.get_mut().last_seen_ts = get_aligned_timestamp() } @@ -472,9 +470,7 @@ impl NetworkManager { pub fn check_client_whitelist(&self, client: TypedKey) -> bool { let mut inner = self.inner.lock(); - match inner.client_whitelist.entry(client, |_k, _v| { - // do nothing on LRU evict - }) { + match inner.client_whitelist.entry(client) { hashlink::lru_cache::Entry::Occupied(mut entry) => { entry.get_mut().last_seen_ts = get_aligned_timestamp(); true diff --git a/veilid-core/src/network_manager/send_data.rs b/veilid-core/src/network_manager/send_data.rs index 64aa550f..0cc57375 100644 --- a/veilid-core/src/network_manager/send_data.rs +++ b/veilid-core/src/network_manager/send_data.rs @@ -461,7 +461,7 @@ impl NetworkManager { self.inner .lock() .node_contact_method_cache - .insert(ncm_key, ncm.clone(), |_, _| {}); + .insert(ncm_key, ncm.clone()); Ok(ncm) } diff --git a/veilid-core/src/network_manager/stats.rs b/veilid-core/src/network_manager/stats.rs index d5660470..24836707 100644 --- a/veilid-core/src/network_manager/stats.rs +++ b/veilid-core/src/network_manager/stats.rs @@ -45,9 +45,7 @@ impl NetworkManager { inner .stats .per_address_stats - .entry(PerAddressStatsKey(addr), |_k, _v| { - // do nothing on LRU evict - }) + .entry(PerAddressStatsKey(addr)) .or_insert(PerAddressStats::default()) .transfer_stats_accounting .add_up(bytes); @@ -63,9 +61,7 @@ impl NetworkManager { inner .stats .per_address_stats - .entry(PerAddressStatsKey(addr), |_k, _v| { - // do nothing on LRU evict - }) + .entry(PerAddressStatsKey(addr)) .or_insert(PerAddressStats::default()) .transfer_stats_accounting .add_down(bytes); diff --git a/veilid-core/src/network_manager/tasks/public_address_check.rs b/veilid-core/src/network_manager/tasks/public_address_check.rs index 34df3d3b..ec084c99 100644 --- a/veilid-core/src/network_manager/tasks/public_address_check.rs +++ b/veilid-core/src/network_manager/tasks/public_address_check.rs @@ -117,9 +117,7 @@ impl NetworkManager { .public_address_check_cache .entry(addr_proto_type_key) .or_insert_with(|| LruCache::new(PUBLIC_ADDRESS_CHECK_CACHE_SIZE)); - pacc.insert(ipblock, socket_address, |_k, _v| { - // do nothing on LRU evict - }); + pacc.insert(ipblock, socket_address); // Determine if our external address has likely changed let mut bad_public_address_detection_punishment: Option< diff --git a/veilid-core/src/routing_table/route_spec_store/route_spec_store_cache.rs b/veilid-core/src/routing_table/route_spec_store/route_spec_store_cache.rs index 3eb65e05..1ad861a8 100644 --- a/veilid-core/src/routing_table/route_spec_store/route_spec_store_cache.rs +++ b/veilid-core/src/routing_table/route_spec_store/route_spec_store_cache.rs @@ -148,10 +148,13 @@ impl RouteSpecStoreCache { } let mut dead = None; - self.remote_private_route_set_cache - .insert(id, rprinfo, |dead_id, dead_rpri| { + self.remote_private_route_set_cache.insert_with_callback( + id, + rprinfo, + |dead_id, dead_rpri| { dead = Some((dead_id, dead_rpri)); - }); + }, + ); if let Some((dead_id, dead_rpri)) = dead { // If anything LRUs out, remove from the by-key table @@ -285,12 +288,7 @@ impl RouteSpecStoreCache { pr_pubkey, }; - if let Some(v) = self - .compiled_route_cache - .insert(key, safety_route, |_k, _v| { - // Do nothing on LRU evict - }) - { + if let Some(v) = self.compiled_route_cache.insert(key, safety_route) { log_rtab!(error "route cache already contained key: sr_pubkey={:?}, pr_pubkey={:?}", v.public_key, pr_pubkey); } } diff --git a/veilid-core/src/routing_table/routing_table_inner.rs b/veilid-core/src/routing_table/routing_table_inner.rs index a86130ac..d71e934a 100644 --- a/veilid-core/src/routing_table/routing_table_inner.rs +++ b/veilid-core/src/routing_table/routing_table_inner.rs @@ -930,9 +930,7 @@ impl RoutingTableInner { pub fn touch_recent_peer(&mut self, node_id: TypedKey, last_connection: ConnectionDescriptor) { self.recent_peers - .insert(node_id, RecentPeersEntry { last_connection }, |_k, _v| { - // do nothing on lru eviction - }); + .insert(node_id, RecentPeersEntry { last_connection }); } ////////////////////////////////////////////////////////////////////// diff --git a/veilid-core/src/storage_manager/record_store.rs b/veilid-core/src/storage_manager/record_store.rs index 1a00c973..1de083f2 100644 --- a/veilid-core/src/storage_manager/record_store.rs +++ b/veilid-core/src/storage_manager/record_store.rs @@ -113,7 +113,7 @@ where } // add to index and ensure we deduplicate in the case of an error - if let Some(v) = self.record_index.insert(ri.0, ri.1, |k, v| { + if let Some(v) = self.record_index.insert_with_callback(ri.0, ri.1, |k, v| { // If the configuration change, we only want to keep the 'limits.max_records' records dead_records.push((k, v)); }) { @@ -143,10 +143,13 @@ where let record_data_total_size = record_data.total_size(); // Write to subkey cache let mut dead_size = 0usize; - if let Some(old_record_data) = self.subkey_cache.insert(key, record_data, |_, v| { - // LRU out - dead_size += v.total_size(); - }) { + if let Some(old_record_data) = + self.subkey_cache + .insert_with_callback(key, record_data, |_, v| { + // LRU out + dead_size += v.total_size(); + }) + { // Old data dead_size += old_record_data.total_size(); } @@ -305,7 +308,7 @@ where // Save to record index let mut dead_records = Vec::new(); - if let Some(v) = self.record_index.insert(rtk, record, |k, v| { + if let Some(v) = self.record_index.insert_with_callback(rtk, record, |k, v| { dead_records.push((k, v)); }) { // Shouldn't happen but log it