From 4d5ac14885c0ac9d8a124e6208eb4700de067300 Mon Sep 17 00:00:00 2001 From: TC Johnson Date: Wed, 21 Jun 2023 14:59:50 +0000 Subject: [PATCH 1/2] Temp added package command to distribution stage --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 473bc2ab..436a9c56 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,6 +61,7 @@ distribute_amd64: - linux - amd64 script: + - earthly +package-linux-amd64 - /home/gitlab-runner/distribute-packages.sh From addfd64473915fc9006511f9222c666e7ebaf221 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 22 Jun 2023 17:42:34 -0400 Subject: [PATCH 2/2] xfer --- Cargo.lock | 31 +++++++++++------ doc/config/sample.config | 2 +- doc/config/veilid-server-config.md | 2 +- veilid-core/src/routing_table/mod.rs | 47 +++++++++++++++++++++++--- veilid-flutter/lib/default_config.dart | 4 +-- veilid-server/src/settings.rs | 2 +- 6 files changed, 69 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cbee5f60..f7d5ed30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1502,7 +1502,7 @@ dependencies = [ "flexi_logger", "lazy_static", "log", - "time 0.3.9", + "time 0.3.22", "unicode-width", ] @@ -1544,7 +1544,7 @@ dependencies = [ "owning_ref", "serde_json", "serde_yaml", - "time 0.3.9", + "time 0.3.22", "tokio 1.28.2", "toml 0.7.4", "unicode-segmentation", @@ -2055,7 +2055,7 @@ dependencies = [ "regex", "rustversion", "thiserror", - "time 0.3.9", + "time 0.3.22", ] [[package]] @@ -5317,7 +5317,7 @@ checksum = "acee08041c5de3d5048c8b3f6f13fafb3026b24ba43c6a695a0c76179b844369" dependencies = [ "log", "termcolor", - "time 0.3.9", + "time 0.3.22", ] [[package]] @@ -5668,16 +5668,24 @@ dependencies = [ [[package]] name = "time" -version = "0.3.9" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa", "libc", "num_threads", - "time-macros 0.2.4", + "serde", + "time-core", + "time-macros 0.2.9", ] +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + [[package]] name = "time-macros" version = "0.1.1" @@ -5690,9 +5698,12 @@ dependencies = [ [[package]] name = "time-macros" -version = "0.2.4" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +dependencies = [ + "time-core", +] [[package]] name = "time-macros-impl" @@ -6004,7 +6015,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" dependencies = [ "crossbeam-channel", - "time 0.3.9", + "time 0.3.22", "tracing-subscriber", ] diff --git a/doc/config/sample.config b/doc/config/sample.config index 3fd37b59..41a6a2f7 100644 --- a/doc/config/sample.config +++ b/doc/config/sample.config @@ -52,7 +52,7 @@ core: routing_table: node_id: null node_id_secret: null - bootstrap: ['bootstrap.dev.veilid.net'] + bootstrap: ['bootstrap.veilid.net'] limit_over_attached: 64 limit_fully_attached: 32 limit_attached_strong: 16 diff --git a/doc/config/veilid-server-config.md b/doc/config/veilid-server-config.md index 388e3b0f..a76b328b 100644 --- a/doc/config/veilid-server-config.md +++ b/doc/config/veilid-server-config.md @@ -190,7 +190,7 @@ network: hole_punch_receipt_time_ms: 5000 node_id: '' node_id_secret: '' - bootstrap: ['bootstrap.dev.veilid.net'] + bootstrap: ['bootstrap.veilid.net'] upnp: true detect_address_changes: true enable_local_peer_scope: false diff --git a/veilid-core/src/routing_table/mod.rs b/veilid-core/src/routing_table/mod.rs index 2223d189..97279d08 100644 --- a/veilid-core/src/routing_table/mod.rs +++ b/veilid-core/src/routing_table/mod.rs @@ -346,14 +346,53 @@ impl RoutingTable { } /// Deserialize routing table from table store async fn load_buckets(&self) -> EyreResult<()> { + // Make a cache validity key of all our node ids and our bootstrap choice + let mut cache_validity_key: Vec = Vec::new(); + { + let c = self.unlocked_inner.config.get(); + for ck in VALID_CRYPTO_KINDS { + cache_validity_key.append( + &mut c + .network + .routing_table + .node_id + .get(ck) + .unwrap() + .value + .bytes + .to_vec(), + ); + } + for b in &c.network.routing_table.bootstrap { + cache_validity_key.append(&mut b.as_bytes().to_vec()); + } + }; + // Deserialize bucket map and all entries from the table store - let tstore = self.unlocked_inner.network_manager().table_store(); - let tdb = tstore.open("routing_table", 1).await?; - let Some(serialized_bucket_map): Option = tdb.load_rkyv(0, b"serialized_bucket_map").await? else { + let table_store = self.unlocked_inner.network_manager().table_store(); + let db = table_store.open("routing_table", 1).await?; + + let caches_valid = match db.load(0, b"cache_validity_key").await? { + Some(v) => v == cache_validity_key, + None => false, + }; + if !caches_valid { + // Caches not valid, start over + log_rtab!(debug "cache validity key changed, emptying routing table"); + drop(db); + table_store.delete("routing_table").await?; + let db = table_store.open("routing_table", 1).await?; + db.store(0, b"cache_validity_key", &cache_validity_key) + .await?; + return Ok(()); + } + + // Caches valid, load saved routing table + let Some(serialized_bucket_map): Option = db.load_rkyv(0, b"serialized_bucket_map").await? else { log_rtab!(debug "no bucket map in saved routing table"); return Ok(()); }; - let Some(all_entry_bytes): Option = tdb.load_rkyv(0, b"all_entry_bytes").await? else { + let Some(all_entry_bytes): Option = db.load_rkyv(0, b"all_entry_bytes").await? else { log_rtab!(debug "no all_entry_bytes in saved routing table"); return Ok(()); }; diff --git a/veilid-flutter/lib/default_config.dart b/veilid-flutter/lib/default_config.dart index 1337a68f..c323b70f 100644 --- a/veilid-flutter/lib/default_config.dart +++ b/veilid-flutter/lib/default_config.dart @@ -97,8 +97,8 @@ Future getDefaultVeilidConfig(String programName) async { nodeId: [], nodeIdSecret: [], bootstrap: kIsWeb - ? ["ws://bootstrap.dev.veilid.net:5150/ws"] - : ["bootstrap.dev.veilid.net"], + ? ["ws://bootstrap.veilid.net:5150/ws"] + : ["bootstrap.veilid.net"], limitOverAttached: 64, limitFullyAttached: 32, limitAttachedStrong: 16, diff --git a/veilid-server/src/settings.rs b/veilid-server/src/settings.rs index d6ee6f3b..a38d861b 100644 --- a/veilid-server/src/settings.rs +++ b/veilid-server/src/settings.rs @@ -72,7 +72,7 @@ core: routing_table: node_id: null node_id_secret: null - bootstrap: ['bootstrap.dev.veilid.net'] + bootstrap: ['bootstrap.veilid.net'] limit_over_attached: 64 limit_fully_attached: 32 limit_attached_strong: 16