mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-11-29 15:36:36 -05:00
cleanup visibility
This commit is contained in:
parent
2051292a26
commit
74e2f9a2c0
49 changed files with 207 additions and 361 deletions
|
|
@ -175,6 +175,7 @@ impl BucketEntryInner {
|
|||
}
|
||||
|
||||
// Less is faster
|
||||
#[allow(dead_code)]
|
||||
pub fn cmp_fastest(e1: &Self, e2: &Self) -> std::cmp::Ordering {
|
||||
// Lower latency to the front
|
||||
if let Some(e1_latency) = &e1.peer_stats.latency {
|
||||
|
|
@ -234,6 +235,7 @@ impl BucketEntryInner {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn sort_fastest_reliable_fn(cur_ts: Timestamp) -> impl FnMut(&Self, &Self) -> std::cmp::Ordering {
|
||||
move |e1, e2| Self::cmp_fastest_reliable(cur_ts, e1, e2)
|
||||
}
|
||||
|
|
@ -537,6 +539,7 @@ impl BucketEntryInner {
|
|||
self.envelope_support = envelope_support;
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn envelope_support(&self) -> Vec<u8> {
|
||||
self.envelope_support.clone()
|
||||
}
|
||||
|
|
@ -617,12 +620,8 @@ impl BucketEntryInner {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_updated_since_last_network_change(&mut self, updated: bool) {
|
||||
self.updated_since_last_network_change = updated;
|
||||
}
|
||||
|
||||
pub fn has_updated_since_last_network_change(&self) -> bool {
|
||||
self.updated_since_last_network_change
|
||||
pub fn reset_updated_since_last_network_change(&mut self) {
|
||||
self.updated_since_last_network_change = false;
|
||||
}
|
||||
|
||||
///// stats methods
|
||||
|
|
|
|||
|
|
@ -20,20 +20,20 @@ use super::*;
|
|||
use crate::crypto::*;
|
||||
use crate::network_manager::*;
|
||||
use crate::rpc_processor::*;
|
||||
|
||||
use bucket::*;
|
||||
use hashlink::LruCache;
|
||||
|
||||
pub use bucket_entry::*;
|
||||
pub use debug::*;
|
||||
pub use find_peers::*;
|
||||
pub use node_ref::*;
|
||||
pub use node_ref_filter::*;
|
||||
pub use privacy::*;
|
||||
pub use route_spec_store::*;
|
||||
pub use routing_domain_editor::*;
|
||||
pub use routing_domains::*;
|
||||
pub use routing_table_inner::*;
|
||||
pub use stats_accounting::*;
|
||||
pub(crate) use bucket_entry::*;
|
||||
pub(crate) use node_ref::*;
|
||||
pub(crate) use node_ref_filter::*;
|
||||
pub(crate) use privacy::*;
|
||||
pub(crate) use route_spec_store::*;
|
||||
pub(crate) use routing_domain_editor::*;
|
||||
pub(crate) use routing_domains::*;
|
||||
pub(crate) use routing_table_inner::*;
|
||||
pub(crate) use stats_accounting::*;
|
||||
|
||||
pub use types::*;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -64,7 +64,7 @@ pub struct LowLevelPortInfo {
|
|||
pub low_level_protocol_ports: LowLevelProtocolPorts,
|
||||
pub protocol_to_port: ProtocolToPortMapping,
|
||||
}
|
||||
pub type RoutingTableEntryFilter<'t> =
|
||||
pub(crate) type RoutingTableEntryFilter<'t> =
|
||||
Box<dyn FnMut(&RoutingTableInner, Option<Arc<BucketEntry>>) -> bool + Send + 't>;
|
||||
|
||||
type SerializedBuckets = Vec<Vec<u8>>;
|
||||
|
|
@ -487,24 +487,10 @@ impl RoutingTable {
|
|||
self.inner.read().relay_node_last_keepalive(domain)
|
||||
}
|
||||
|
||||
pub fn has_dial_info(&self, domain: RoutingDomain) -> bool {
|
||||
self.inner.read().has_dial_info(domain)
|
||||
}
|
||||
|
||||
pub fn dial_info_details(&self, domain: RoutingDomain) -> Vec<DialInfoDetail> {
|
||||
self.inner.read().dial_info_details(domain)
|
||||
}
|
||||
|
||||
pub fn first_filtered_dial_info_detail(
|
||||
&self,
|
||||
routing_domain_set: RoutingDomainSet,
|
||||
filter: &DialInfoFilter,
|
||||
) -> Option<DialInfoDetail> {
|
||||
self.inner
|
||||
.read()
|
||||
.first_filtered_dial_info_detail(routing_domain_set, filter)
|
||||
}
|
||||
|
||||
pub fn all_filtered_dial_info_details(
|
||||
&self,
|
||||
routing_domain_set: RoutingDomainSet,
|
||||
|
|
@ -521,16 +507,6 @@ impl RoutingTable {
|
|||
.ensure_dial_info_is_valid(domain, dial_info)
|
||||
}
|
||||
|
||||
pub fn node_info_is_valid_in_routing_domain(
|
||||
&self,
|
||||
routing_domain: RoutingDomain,
|
||||
node_info: &NodeInfo,
|
||||
) -> bool {
|
||||
self.inner
|
||||
.read()
|
||||
.node_info_is_valid_in_routing_domain(routing_domain, node_info)
|
||||
}
|
||||
|
||||
pub fn signed_node_info_is_valid_in_routing_domain(
|
||||
&self,
|
||||
routing_domain: RoutingDomain,
|
||||
|
|
@ -587,20 +563,6 @@ impl RoutingTable {
|
|||
self.inner.read().get_network_class(routing_domain)
|
||||
}
|
||||
|
||||
/// Return the domain's filter for what we can receivein the form of a dial info filter
|
||||
pub fn get_inbound_dial_info_filter(&self, routing_domain: RoutingDomain) -> DialInfoFilter {
|
||||
self.inner
|
||||
.read()
|
||||
.get_inbound_dial_info_filter(routing_domain)
|
||||
}
|
||||
|
||||
/// Return the domain's filter for what we can receive in the form of a node ref filter
|
||||
pub fn get_inbound_node_ref_filter(&self, routing_domain: RoutingDomain) -> NodeRefFilter {
|
||||
self.inner
|
||||
.read()
|
||||
.get_inbound_node_ref_filter(routing_domain)
|
||||
}
|
||||
|
||||
/// Return the domain's filter for what we can send out in the form of a dial info filter
|
||||
pub fn get_outbound_dial_info_filter(&self, routing_domain: RoutingDomain) -> DialInfoFilter {
|
||||
self.inner
|
||||
|
|
@ -625,27 +587,7 @@ impl RoutingTable {
|
|||
self.inner.write().purge_last_connections();
|
||||
}
|
||||
|
||||
pub fn get_entry_count(
|
||||
&self,
|
||||
routing_domain_set: RoutingDomainSet,
|
||||
min_state: BucketEntryState,
|
||||
crypto_kinds: &[CryptoKind],
|
||||
) -> usize {
|
||||
self.inner
|
||||
.read()
|
||||
.get_entry_count(routing_domain_set, min_state, crypto_kinds)
|
||||
}
|
||||
|
||||
pub fn get_entry_count_per_crypto_kind(
|
||||
&self,
|
||||
routing_domain_set: RoutingDomainSet,
|
||||
min_state: BucketEntryState,
|
||||
) -> BTreeMap<CryptoKind, usize> {
|
||||
self.inner
|
||||
.read()
|
||||
.get_entry_count_per_crypto_kind(routing_domain_set, min_state)
|
||||
}
|
||||
|
||||
/// See which nodes need to be pinged
|
||||
pub fn get_nodes_needing_ping(
|
||||
&self,
|
||||
routing_domain: RoutingDomain,
|
||||
|
|
@ -656,11 +598,6 @@ impl RoutingTable {
|
|||
.get_nodes_needing_ping(self.clone(), routing_domain, cur_ts)
|
||||
}
|
||||
|
||||
pub fn get_all_nodes(&self, cur_ts: Timestamp) -> Vec<NodeRef> {
|
||||
let inner = self.inner.read();
|
||||
inner.get_all_nodes(self.clone(), cur_ts)
|
||||
}
|
||||
|
||||
fn queue_bucket_kicks(&self, node_ids: TypedKeyGroup) {
|
||||
for node_id in node_ids.iter() {
|
||||
// Skip node ids we didn't add to buckets
|
||||
|
|
@ -780,12 +717,6 @@ impl RoutingTable {
|
|||
out
|
||||
}
|
||||
|
||||
pub fn touch_recent_peer(&self, node_id: TypedKey, last_connection: ConnectionDescriptor) {
|
||||
self.inner
|
||||
.write()
|
||||
.touch_recent_peer(node_id, last_connection)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Find Nodes
|
||||
|
||||
|
|
@ -984,27 +915,6 @@ impl RoutingTable {
|
|||
out
|
||||
}
|
||||
|
||||
pub fn find_peers_with_sort_and_filter<C, T, O>(
|
||||
&self,
|
||||
node_count: usize,
|
||||
cur_ts: Timestamp,
|
||||
filters: VecDeque<RoutingTableEntryFilter>,
|
||||
compare: C,
|
||||
transform: T,
|
||||
) -> Vec<O>
|
||||
where
|
||||
C: for<'a, 'b> FnMut(
|
||||
&'a RoutingTableInner,
|
||||
&'b Option<Arc<BucketEntry>>,
|
||||
&'b Option<Arc<BucketEntry>>,
|
||||
) -> core::cmp::Ordering,
|
||||
T: for<'r> FnMut(&'r RoutingTableInner, Option<Arc<BucketEntry>>) -> O + Send,
|
||||
{
|
||||
self.inner
|
||||
.read()
|
||||
.find_peers_with_sort_and_filter(node_count, cur_ts, filters, compare, transform)
|
||||
}
|
||||
|
||||
pub fn find_preferred_fastest_nodes<'a, T, O>(
|
||||
&self,
|
||||
node_count: usize,
|
||||
|
|
|
|||
|
|
@ -112,12 +112,6 @@ pub(crate) trait NodeRefBase: Sized {
|
|||
fn best_node_id(&self) -> TypedKey {
|
||||
self.operate(|_rti, e| e.best_node_id())
|
||||
}
|
||||
fn has_updated_since_last_network_change(&self) -> bool {
|
||||
self.operate(|_rti, e| e.has_updated_since_last_network_change())
|
||||
}
|
||||
fn set_updated_since_last_network_change(&self) {
|
||||
self.operate_mut(|_rti, e| e.set_updated_since_last_network_change(true));
|
||||
}
|
||||
fn update_node_status(&self, routing_domain: RoutingDomain, node_status: NodeStatus) {
|
||||
self.operate_mut(|_rti, e| {
|
||||
e.update_node_status(routing_domain, node_status);
|
||||
|
|
@ -583,9 +577,9 @@ impl<'a> NodeRefLockedMut<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn unlocked(&self) -> NodeRef {
|
||||
self.nr.clone()
|
||||
}
|
||||
// pub fn unlocked(&self) -> NodeRef {
|
||||
// self.nr.clone()
|
||||
// }
|
||||
}
|
||||
|
||||
impl<'a> NodeRefBase for NodeRefLockedMut<'a> {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ impl NodeRefFilter {
|
|||
self.dial_info_filter = self.dial_info_filter.with_protocol_type(protocol_type);
|
||||
self
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub fn with_protocol_type_set(mut self, protocol_set: ProtocolTypeSet) -> Self {
|
||||
self.dial_info_filter = self.dial_info_filter.with_protocol_type_set(protocol_set);
|
||||
self
|
||||
|
|
@ -43,6 +44,7 @@ impl NodeRefFilter {
|
|||
self.dial_info_filter = self.dial_info_filter.with_address_type(address_type);
|
||||
self
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub fn with_address_type_set(mut self, address_set: AddressTypeSet) -> Self {
|
||||
self.dial_info_filter = self.dial_info_filter.with_address_type_set(address_set);
|
||||
self
|
||||
|
|
@ -54,6 +56,7 @@ impl NodeRefFilter {
|
|||
.filtered(&other_filter.dial_info_filter);
|
||||
self
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub fn is_dead(&self) -> bool {
|
||||
self.dial_info_filter.is_dead() || self.routing_domain_set.is_empty()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,14 +121,6 @@ pub(crate) struct PrivateRoute {
|
|||
}
|
||||
|
||||
impl PrivateRoute {
|
||||
/// Empty private route is the form used when receiving the last hop
|
||||
pub fn new_empty(public_key: TypedKey) -> Self {
|
||||
Self {
|
||||
public_key,
|
||||
hop_count: 0,
|
||||
hops: PrivateRouteHops::Empty,
|
||||
}
|
||||
}
|
||||
/// Stub route is the form used when no privacy is required, but you need to specify the destination for a safety route
|
||||
pub fn new_stub(public_key: TypedKey, node: RouteNode) -> Self {
|
||||
Self {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use super::*;
|
||||
use crate::veilid_api::*;
|
||||
|
||||
mod permutation;
|
||||
mod remote_private_route_info;
|
||||
|
|
@ -7,15 +8,14 @@ mod route_spec_store_cache;
|
|||
mod route_spec_store_content;
|
||||
mod route_stats;
|
||||
|
||||
pub use remote_private_route_info::*;
|
||||
pub use route_set_spec_detail::*;
|
||||
pub use route_spec_store_cache::*;
|
||||
pub use route_spec_store_content::*;
|
||||
pub use route_stats::*;
|
||||
|
||||
use crate::veilid_api::*;
|
||||
|
||||
use permutation::*;
|
||||
use remote_private_route_info::*;
|
||||
use route_set_spec_detail::*;
|
||||
use route_spec_store_cache::*;
|
||||
use route_spec_store_content::*;
|
||||
|
||||
pub(crate) use route_spec_store_cache::CompiledRoute;
|
||||
pub(crate) use route_stats::*;
|
||||
|
||||
/// The size of the remote private route cache
|
||||
const REMOTE_PRIVATE_ROUTE_CACHE_SIZE: usize = 1024;
|
||||
|
|
@ -27,14 +27,14 @@ const ROUTE_MIN_IDLE_TIME_MS: u32 = 30_000;
|
|||
const COMPILED_ROUTE_CACHE_SIZE: usize = 256;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RouteSpecStoreInner {
|
||||
struct RouteSpecStoreInner {
|
||||
/// Serialize RouteSpecStore content
|
||||
content: RouteSpecStoreContent,
|
||||
/// RouteSpecStore cache
|
||||
cache: RouteSpecStoreCache,
|
||||
}
|
||||
|
||||
pub struct RouteSpecStoreUnlockedInner {
|
||||
struct RouteSpecStoreUnlockedInner {
|
||||
/// Handle to routing table
|
||||
routing_table: RoutingTable,
|
||||
/// Maximum number of hops in a route
|
||||
|
|
@ -54,7 +54,7 @@ impl fmt::Debug for RouteSpecStoreUnlockedInner {
|
|||
|
||||
/// The routing table's storage for private/safety routes
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RouteSpecStore {
|
||||
pub(crate) struct RouteSpecStore {
|
||||
inner: Arc<Mutex<RouteSpecStoreInner>>,
|
||||
unlocked_inner: Arc<RouteSpecStoreUnlockedInner>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use super::*;
|
|||
|
||||
/// What remote private routes have seen
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct RemotePrivateRouteInfo {
|
||||
pub(crate) struct RemotePrivateRouteInfo {
|
||||
/// The private routes themselves
|
||||
private_routes: Vec<PrivateRoute>,
|
||||
/// Did this remote private route see our node info due to no safety route in use
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use super::*;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct RouteSpecDetail {
|
||||
pub(crate) struct RouteSpecDetail {
|
||||
/// Crypto kind
|
||||
pub crypto_kind: CryptoKind,
|
||||
/// Secret key
|
||||
|
|
@ -11,7 +11,7 @@ pub struct RouteSpecDetail {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct RouteSetSpecDetail {
|
||||
pub(crate) struct RouteSetSpecDetail {
|
||||
/// Route set per crypto kind
|
||||
route_set: BTreeMap<PublicKey, RouteSpecDetail>,
|
||||
/// Route noderefs
|
||||
|
|
@ -53,9 +53,6 @@ impl RouteSetSpecDetail {
|
|||
pub fn get_route_by_key(&self, key: &PublicKey) -> Option<&RouteSpecDetail> {
|
||||
self.route_set.get(key)
|
||||
}
|
||||
pub fn get_route_by_key_mut(&mut self, key: &PublicKey) -> Option<&mut RouteSpecDetail> {
|
||||
self.route_set.get_mut(key)
|
||||
}
|
||||
pub fn get_route_set_keys(&self) -> TypedKeyGroup {
|
||||
let mut tks = TypedKeyGroup::new();
|
||||
for (k, v) in &self.route_set {
|
||||
|
|
@ -74,11 +71,6 @@ impl RouteSetSpecDetail {
|
|||
) -> alloc::collections::btree_map::Iter<PublicKey, RouteSpecDetail> {
|
||||
self.route_set.iter()
|
||||
}
|
||||
pub fn iter_route_set_mut(
|
||||
&mut self,
|
||||
) -> alloc::collections::btree_map::IterMut<PublicKey, RouteSpecDetail> {
|
||||
self.route_set.iter_mut()
|
||||
}
|
||||
pub fn get_stats(&self) -> &RouteStats {
|
||||
&self.stats
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ struct CompiledRouteCacheKey {
|
|||
|
||||
/// Compiled route (safety route + private route)
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CompiledRoute {
|
||||
pub(crate) struct CompiledRoute {
|
||||
/// The safety route attached to the private route
|
||||
pub safety_route: SafetyRoute,
|
||||
/// The secret used to encrypt the message payload
|
||||
|
|
@ -20,7 +20,7 @@ pub struct CompiledRoute {
|
|||
|
||||
/// Ephemeral data used to help the RouteSpecStore operate efficiently
|
||||
#[derive(Debug)]
|
||||
pub struct RouteSpecStoreCache {
|
||||
pub(super) struct RouteSpecStoreCache {
|
||||
/// How many times nodes have been used
|
||||
used_nodes: HashMap<PublicKey, usize>,
|
||||
/// How many times nodes have been used at the terminal point of a route
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use super::*;
|
|||
|
||||
/// The core representation of the RouteSpecStore that can be serialized
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
pub struct RouteSpecStoreContent {
|
||||
pub(super) struct RouteSpecStoreContent {
|
||||
/// All of the route sets we have allocated so far indexed by key
|
||||
id_by_key: HashMap<PublicKey, RouteId>,
|
||||
/// All of the route sets we have allocated so far
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use super::*;
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
pub struct RouteStats {
|
||||
pub(crate) struct RouteStats {
|
||||
/// Consecutive failed to send count
|
||||
#[serde(skip)]
|
||||
pub failed_to_send: u32,
|
||||
|
|
@ -94,6 +94,7 @@ impl RouteStats {
|
|||
}
|
||||
|
||||
/// Get the transfer stats
|
||||
#[allow(dead_code)]
|
||||
pub fn transfer_stats(&self) -> &TransferStatsDownUp {
|
||||
&self.transfer_stats_down_up
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ enum RoutingDomainChange {
|
|||
},
|
||||
}
|
||||
|
||||
pub struct RoutingDomainEditor {
|
||||
pub(crate) struct RoutingDomainEditor {
|
||||
routing_table: RoutingTable,
|
||||
routing_domain: RoutingDomain,
|
||||
changes: Vec<RoutingDomainChange>,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use super::*;
|
|||
|
||||
/// Mechanism required to contact another node
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum ContactMethod {
|
||||
pub(crate) enum ContactMethod {
|
||||
/// Node is not reachable by any means
|
||||
Unreachable,
|
||||
/// Connection should have already existed
|
||||
|
|
@ -20,7 +20,7 @@ pub enum ContactMethod {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RoutingDomainDetailCommon {
|
||||
pub(crate) struct RoutingDomainDetailCommon {
|
||||
routing_domain: RoutingDomain,
|
||||
network_class: Option<NetworkClass>,
|
||||
outbound_protocols: ProtocolTypeSet,
|
||||
|
|
@ -216,6 +216,7 @@ impl RoutingDomainDetailCommon {
|
|||
f(cpi.as_ref().unwrap())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn inbound_dial_info_filter(&self) -> DialInfoFilter {
|
||||
DialInfoFilter::all()
|
||||
.with_protocol_type_set(self.inbound_protocols)
|
||||
|
|
@ -233,7 +234,7 @@ impl RoutingDomainDetailCommon {
|
|||
}
|
||||
|
||||
/// General trait for all routing domains
|
||||
pub trait RoutingDomainDetail {
|
||||
pub(crate) trait RoutingDomainDetail {
|
||||
// Common accessors
|
||||
fn common(&self) -> &RoutingDomainDetailCommon;
|
||||
fn common_mut(&mut self) -> &mut RoutingDomainDetailCommon;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ impl RoutingTableInner {
|
|||
self.with_routing_domain(domain, |rd| rd.common().relay_node_last_keepalive())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn has_dial_info(&self, domain: RoutingDomain) -> bool {
|
||||
self.with_routing_domain(domain, |rd| !rd.common().dial_info_details().is_empty())
|
||||
}
|
||||
|
|
@ -233,7 +234,7 @@ impl RoutingTableInner {
|
|||
let cur_ts = get_aligned_timestamp();
|
||||
self.with_entries_mut(cur_ts, BucketEntryState::Dead, |rti, v| {
|
||||
v.with_mut(rti, |_rti, e| {
|
||||
e.set_updated_since_last_network_change(false)
|
||||
e.reset_updated_since_last_network_change();
|
||||
});
|
||||
Option::<()>::None
|
||||
});
|
||||
|
|
@ -265,6 +266,7 @@ impl RoutingTableInner {
|
|||
}
|
||||
|
||||
/// Return the domain's filter for what we can receivein the form of a dial info filter
|
||||
#[allow(dead_code)]
|
||||
pub fn get_inbound_dial_info_filter(&self, routing_domain: RoutingDomain) -> DialInfoFilter {
|
||||
self.with_routing_domain(routing_domain, |rdd| {
|
||||
rdd.common().inbound_dial_info_filter()
|
||||
|
|
@ -272,6 +274,7 @@ impl RoutingTableInner {
|
|||
}
|
||||
|
||||
/// Return the domain's filter for what we can receive in the form of a node ref filter
|
||||
#[allow(dead_code)]
|
||||
pub fn get_inbound_node_ref_filter(&self, routing_domain: RoutingDomain) -> NodeRefFilter {
|
||||
let dif = self.get_inbound_dial_info_filter(routing_domain);
|
||||
NodeRefFilter::new()
|
||||
|
|
@ -336,7 +339,7 @@ impl RoutingTableInner {
|
|||
self.with_entries_mut(cur_ts, BucketEntryState::Dead, |rti, e| {
|
||||
e.with_mut(rti, |_rti, e| {
|
||||
e.clear_signed_node_info(RoutingDomain::LocalNetwork);
|
||||
e.set_updated_since_last_network_change(false);
|
||||
e.reset_updated_since_last_network_change();
|
||||
});
|
||||
Option::<()>::None
|
||||
});
|
||||
|
|
@ -462,32 +465,6 @@ impl RoutingTableInner {
|
|||
count
|
||||
}
|
||||
|
||||
/// Count entries per crypto kind that match some criteria
|
||||
pub fn get_entry_count_per_crypto_kind(
|
||||
&self,
|
||||
routing_domain_set: RoutingDomainSet,
|
||||
min_state: BucketEntryState,
|
||||
) -> BTreeMap<CryptoKind, usize> {
|
||||
let mut counts = BTreeMap::new();
|
||||
let cur_ts = get_aligned_timestamp();
|
||||
self.with_entries(cur_ts, min_state, |rti, e| {
|
||||
if let Some(crypto_kinds) = e.with_inner(|e| {
|
||||
if e.best_routing_domain(rti, routing_domain_set).is_some() {
|
||||
Some(e.crypto_kinds())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}) {
|
||||
// Got crypto kinds, add to map
|
||||
for ck in crypto_kinds {
|
||||
counts.entry(ck).and_modify(|x| *x += 1).or_insert(1);
|
||||
}
|
||||
}
|
||||
Option::<()>::None
|
||||
});
|
||||
counts
|
||||
}
|
||||
|
||||
/// Iterate entries with a filter
|
||||
pub fn with_entries<T, F: FnMut(&RoutingTableInner, Arc<BucketEntry>) -> Option<T>>(
|
||||
&self,
|
||||
|
|
@ -527,7 +504,7 @@ impl RoutingTableInner {
|
|||
None
|
||||
}
|
||||
|
||||
pub fn get_nodes_needing_ping(
|
||||
pub(super) fn get_nodes_needing_ping(
|
||||
&self,
|
||||
outer_self: RoutingTable,
|
||||
routing_domain: RoutingDomain,
|
||||
|
|
@ -575,6 +552,7 @@ impl RoutingTableInner {
|
|||
node_refs
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_all_nodes(&self, outer_self: RoutingTable, cur_ts: Timestamp) -> Vec<NodeRef> {
|
||||
let mut node_refs = Vec::<NodeRef>::with_capacity(self.bucket_entry_count());
|
||||
self.with_entries(cur_ts, BucketEntryState::Unreliable, |_rti, entry| {
|
||||
|
|
|
|||
|
|
@ -109,10 +109,8 @@ impl RoutingTable {
|
|||
|
||||
unord.push(
|
||||
async move {
|
||||
let out = rpc
|
||||
.rpc_call_status(Destination::direct(relay_nr_filtered), true)
|
||||
.await;
|
||||
out
|
||||
rpc.rpc_call_status(Destination::direct(relay_nr_filtered), true)
|
||||
.await
|
||||
}
|
||||
.instrument(Span::current())
|
||||
.boxed(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue