e2dd8ac743
* squashing localnet-v2 commits (again) cargo fmt fixes to localnet purge provide path in the error message output args log failed exec print based on tty check-prerequisites cmd checked iptables update basic kernel features check enable ipv6 rules add forwarding rules squashing localnet-v2 commits additional changes propagate custom-dns flag to all run containers remove is_mock from EcashManager another localnet squash unused import chore: remove redundant testnet manager missing impl additional linux fixes command to rebuild container image wait for at least 2 blocks additional node startup fixes added --custom-dns flag to nym node setup add gateway probe + wait for DKG magic file fixed localnet down on linux container ls re-enable state resync additional feature locking macos adjustments working nyxd startup on linux wip linux box wip separating network inspect betweewn macos and linux initial linux feature locking moved all container commands into a single location finally working initial node performance squashing orchestrator commits cleanup fixed condition for naive rearrangement added cache of cosmwasm contracts for speed up on subsequent runs 'down' command refreshing described cache after nodes are bonded nym nodes setup + wip on nym api refresh nodes setup WIP first pass cleanup placeholder for nym-node setup bypassing the dkg further progress on nym-api setup wip: api setup up/down/purge placeholders persisting contract setup data fix contract upload by forcing amd64 container platform wip: contracts setup4 wip: contracts setup3 wip: contracts setup2 wip: contracts setup include network setup init and spawn nyxd build nyxd image in dedicated orchestrator build nyxd image squashed cherry-picked lp changes Bits and bobs to make everything work Title MacOS setup instructions Docker/Container localnet * clippy * fixes on non-unix targets --------- Co-authored-by: durch <durch@users.noreply.github.com>
62 lines
2.4 KiB
Rust
62 lines
2.4 KiB
Rust
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
use self::cache::refresher::NodeStatusCacheRefresher;
|
|
use crate::node_describe_cache::cache::DescribedNodes;
|
|
use crate::node_performance::provider::NodePerformanceProvider;
|
|
use crate::support::caching::cache::SharedCache;
|
|
use crate::support::caching::refresher::RefreshRequester;
|
|
use crate::support::config;
|
|
use crate::{
|
|
mixnet_contract_cache::cache::MixnetContractCache,
|
|
support::{self},
|
|
};
|
|
pub(crate) use cache::NodeStatusCache;
|
|
use nym_task::ShutdownManager;
|
|
use std::path::PathBuf;
|
|
use std::time::Duration;
|
|
use tokio::sync::watch;
|
|
|
|
pub(crate) mod cache;
|
|
pub(crate) mod handlers;
|
|
pub(crate) mod helpers;
|
|
pub(crate) mod models;
|
|
pub(crate) mod uptime_updater;
|
|
pub(crate) mod utils;
|
|
|
|
pub(crate) const FIFTEEN_MINUTES: Duration = Duration::from_secs(900);
|
|
pub(crate) const ONE_HOUR: Duration = Duration::from_secs(3600);
|
|
pub(crate) const ONE_DAY: Duration = Duration::from_secs(86400);
|
|
|
|
/// Spawn the node status cache refresher.
|
|
///
|
|
/// It is primarily refreshed in-sync with the contract cache and described, however provide a fallback
|
|
/// caching interval that is twice the nym contract cache
|
|
#[allow(clippy::too_many_arguments)]
|
|
pub(crate) fn start_cache_refresh(
|
|
config: &config::NodeStatusAPI,
|
|
nym_contract_cache_state: &MixnetContractCache,
|
|
described_cache: &SharedCache<DescribedNodes>,
|
|
node_status_cache_state: &NodeStatusCache,
|
|
performance_provider: Box<dyn NodePerformanceProvider + Send + Sync>,
|
|
nym_contract_cache_listener: watch::Receiver<support::caching::CacheNotification>,
|
|
described_cache_cache_listener: watch::Receiver<support::caching::CacheNotification>,
|
|
on_disk_file: PathBuf,
|
|
shutdown_manager: &ShutdownManager,
|
|
) -> RefreshRequester {
|
|
let mut nym_api_cache_refresher = NodeStatusCacheRefresher::new(
|
|
node_status_cache_state.to_owned(),
|
|
config.debug.caching_interval,
|
|
nym_contract_cache_state.to_owned(),
|
|
described_cache.clone(),
|
|
nym_contract_cache_listener,
|
|
described_cache_cache_listener,
|
|
performance_provider,
|
|
on_disk_file,
|
|
);
|
|
let refresh_requester = nym_api_cache_refresher.refresh_requester();
|
|
let shutdown_listener = shutdown_manager.clone_shutdown_token();
|
|
tokio::spawn(async move { nym_api_cache_refresher.run(shutdown_listener).await });
|
|
refresh_requester
|
|
}
|