aboutsummaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-02-14 10:04:46 +0100
committerAlex Auvolat <alex@adnab.me>2024-02-15 12:15:35 +0100
commit125c662860621f9c834e254d62b29b5d5ace5dd4 (patch)
treeeb32dadec4de88e5ec69dbdf5e73f68f9299201a /src/net
parent5766befb245efba7d9241e2e2c68bcf4ed28d7a4 (diff)
downloadgarage-125c662860621f9c834e254d62b29b5d5ace5dd4.tar.gz
garage-125c662860621f9c834e254d62b29b5d5ace5dd4.zip
[import-netapp] move and rename FullMeshPeeringSrategy to PeeringManagerimport-netapp
Diffstat (limited to 'src/net')
-rw-r--r--src/net/peering.rs (renamed from src/net/peering/fullmesh.rs)9
-rw-r--r--src/net/peering/mod.rs1
-rw-r--r--src/net/test.rs6
3 files changed, 8 insertions, 8 deletions
diff --git a/src/net/peering/fullmesh.rs b/src/net/peering.rs
index 8e666044..32199cf8 100644
--- a/src/net/peering/fullmesh.rs
+++ b/src/net/peering.rs
@@ -177,7 +177,7 @@ impl KnownHosts {
/// A "Full Mesh" peering strategy is a peering strategy that tries
/// to establish and maintain a direct connection with all of the
/// known nodes in the network.
-pub struct FullMeshPeeringStrategy {
+pub struct PeeringManager {
netapp: Arc<NetApp>,
known_hosts: RwLock<KnownHosts>,
public_peer_list: ArcSwap<Vec<PeerInfo>>,
@@ -189,7 +189,7 @@ pub struct FullMeshPeeringStrategy {
ping_timeout_millis: AtomicU64,
}
-impl FullMeshPeeringStrategy {
+impl PeeringManager {
/// Create a new Full Mesh peering strategy.
/// The strategy will not be run until `.run()` is called and awaited.
/// Once that happens, the peering strategy will try to connect
@@ -216,6 +216,7 @@ impl FullMeshPeeringStrategy {
);
}
+ // TODO for v0.10 / v1.0 : rename the endpoint (it will break compatibility)
let strat = Arc::new(Self {
netapp: netapp.clone(),
known_hosts: RwLock::new(known_hosts),
@@ -588,7 +589,7 @@ impl FullMeshPeeringStrategy {
}
#[async_trait]
-impl EndpointHandler<PingMessage> for FullMeshPeeringStrategy {
+impl EndpointHandler<PingMessage> for PeeringManager {
async fn handle(self: &Arc<Self>, ping: &PingMessage, from: NodeID) -> PingMessage {
let ping_resp = PingMessage {
id: ping.id,
@@ -600,7 +601,7 @@ impl EndpointHandler<PingMessage> for FullMeshPeeringStrategy {
}
#[async_trait]
-impl EndpointHandler<PeerListMessage> for FullMeshPeeringStrategy {
+impl EndpointHandler<PeerListMessage> for PeeringManager {
async fn handle(
self: &Arc<Self>,
peer_list: &PeerListMessage,
diff --git a/src/net/peering/mod.rs b/src/net/peering/mod.rs
deleted file mode 100644
index 044b1dfe..00000000
--- a/src/net/peering/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub mod fullmesh;
diff --git a/src/net/test.rs b/src/net/test.rs
index d4da6f23..c6259752 100644
--- a/src/net/test.rs
+++ b/src/net/test.rs
@@ -9,7 +9,7 @@ use sodiumoxide::crypto::auth;
use sodiumoxide::crypto::sign::ed25519;
use crate::netapp::*;
-use crate::peering::fullmesh::*;
+use crate::peering::*;
use crate::NodeID;
#[tokio::test(flavor = "current_thread")]
@@ -100,10 +100,10 @@ fn run_netapp(
) -> (
tokio::task::JoinHandle<()>,
Arc<NetApp>,
- Arc<FullMeshPeeringStrategy>,
+ Arc<PeeringManager>,
) {
let netapp = NetApp::new(0u64, netid, sk);
- let peering = FullMeshPeeringStrategy::new(netapp.clone(), bootstrap_peers, None);
+ let peering = PeeringManager::new(netapp.clone(), bootstrap_peers, None);
let peering2 = peering.clone();
let netapp2 = netapp.clone();