Use ctor instead of lazy_static

This commit is contained in:
David Palm
2021-03-27 23:00:36 +01:00
parent 8d2441b7fb
commit bbfe118965
3 changed files with 30 additions and 20 deletions
+15 -5
View File
@@ -588,6 +588,16 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "ctor"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "derive_more"
version = "0.99.11"
@@ -1303,9 +1313,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.7"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
dependencies = [
"proc-macro2",
]
@@ -1726,9 +1736,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.48"
version = "1.0.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663"
dependencies = [
"proc-macro2",
"quote",
@@ -1752,8 +1762,8 @@ dependencies = [
"bytes",
"chrono",
"clap",
"ctor",
"fnv",
"lazy_static",
"log",
"num-traits",
"parking_lot",
+1 -1
View File
@@ -23,7 +23,7 @@ parking_lot = "0.11"
reqwest = { version = "0.11.1", features = ["blocking", "json"] }
rustc-hash = "1.1.0"
clap = "3.0.0-beta.2"
lazy_static = "1"
ctor = "0.1.20"
[profile.release]
lto = true
+14 -14
View File
@@ -1,7 +1,7 @@
use std::collections::{HashMap, HashSet};
use actix::prelude::*;
use actix_web_actors::ws::{CloseReason, CloseCode};
use lazy_static::lazy_static;
use ctor::ctor;
use crate::node::connector::{Mute, NodeConnector};
use crate::feed::connector::{FeedConnector, Connected, FeedId};
@@ -30,20 +30,20 @@ pub struct ChainEntry {
max_nodes: usize,
}
lazy_static! {
/// Labels of chains we consider "first party". These chains allow any
/// number of nodes to connect.
static ref FIRST_PARTY_NETWORKS: HashSet<&'static str> = {
let mut set = HashSet::new();
set.insert("Polkadot");
set.insert("Kusama");
set.insert("Westend");
set.insert("Rococo");
set
};
}
#[ctor]
/// Labels of chains we consider "first party". These chains allow any
/// number of nodes to connect.
static FIRST_PARTY_NETWORKS: HashSet<&'static str> = {
let mut set = HashSet::new();
set.insert("Polkadot");
set.insert("Kusama");
set.insert("Westend");
set.insert("Rococo");
set
};
/// Max number of nodes allowed to connect to the telemetry server.
const THIRD_PARTY_NETWORKS_MAX_NODES: usize = 2;
const THIRD_PARTY_NETWORKS_MAX_NODES: usize = 500;
impl Aggregator {
pub fn new(denylist: HashSet<String>) -> Self {