Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(swarm): Remove deprecated functions #3170

Merged
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@

# `libp2p` facade crate

# 0.51.0 [unreleased]

- Update individual crates.
- Update to [`libp2p-swarm` `v0.42.0`](swarm/CHANGELOG.md#0420).

# 0.50.0

This is a large release. After > 4 years, rust-libp2p ships with an [(alpha) QUIC
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p"
edition = "2021"
rust-version = "1.62.0"
description = "Peer-to-peer networking library"
version = "0.50.0"
version = "0.51.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down Expand Up @@ -107,7 +107,7 @@ libp2p-pnet = { version = "0.22.2", path = "transports/pnet", optional = true }
libp2p-relay = { version = "0.14.0", path = "protocols/relay", optional = true }
libp2p-rendezvous = { version = "0.11.0", path = "protocols/rendezvous", optional = true }
libp2p-request-response = { version = "0.23.0", path = "protocols/request-response", optional = true }
libp2p-swarm = { version = "0.41.0", path = "swarm" }
libp2p-swarm = { version = "0.42.0", path = "swarm" }
libp2p-uds = { version = "0.37.0", path = "transports/uds", optional = true }
libp2p-wasm-ext = { version = "0.38.0", path = "transports/wasm-ext", optional = true }
libp2p-yamux = { version = "0.42.0", path = "muxers/yamux", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions misc/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ libp2p-identify = { version = "0.41.0", path = "../../protocols/identify", optio
libp2p-kad = { version = "0.42.0", path = "../../protocols/kad", optional = true }
libp2p-ping = { version = "0.41.0", path = "../../protocols/ping", optional = true }
libp2p-relay = { version = "0.14.0", path = "../../protocols/relay", optional = true }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
prometheus-client = "0.18.0"

[target.'cfg(not(target_os = "unknown"))'.dependencies]
Expand All @@ -39,7 +39,7 @@ libp2p = { path = "../..", features = ["full"] }
hyper = { version="0.14", features = ["server", "tcp", "http1"] }
tokio = { version = "1", features = ["rt-multi-thread"] }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/autonat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ futures = "0.3"
futures-timer = "3.0"
instant = "0.1"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
libp2p-request-response = { version = "0.23.0", path = "../request-response" }
log = "0.4"
rand = "0.8"
Expand All @@ -31,7 +31,7 @@ env_logger = "0.10"
clap = { version = "4.0.13", features = ["derive"] }
libp2p = { path = "../..", features = ["full"] }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/dcutr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ futures = "0.3.1"
futures-timer = "3.0"
instant = "0.1.11"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
log = "0.4"
prost-codec = { version = "0.3", path = "../../misc/prost-codec" }
prost = "0.11"
Expand All @@ -34,7 +34,7 @@ libp2p = { path = "../..", features = ["full"] }
rand = "0.8"
clap = { version = "4.0.13", features = ["derive"] }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/floodsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cuckoofilter = "0.5.0"
fnv = "1.0"
futures = "0.3.1"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
log = "0.4"
prost = "0.11"
rand = "0.8"
Expand All @@ -25,7 +25,7 @@ thiserror = "1.0.37"
[build-dependencies]
prost-build = "0.11"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/gossipsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]

[dependencies]
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
libp2p-core = { version = "0.38.0", path = "../../core" }
bytes = "1.0"
byteorder = "1.3.4"
Expand Down Expand Up @@ -46,7 +46,7 @@ derive_builder = "0.11.1"
[build-dependencies]
prost-build = "0.11"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/gossipsub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
//! libp2p_gossipsub::Gossipsub::new(message_authenticity, gossipsub_config).unwrap();
//! // subscribe to the topic
//! gossipsub.subscribe(&topic);
//! // create the swarm
//! libp2p_swarm::Swarm::new(
//! // create the swarm (use an executor in a real example)
//! libp2p_swarm::Swarm::without_executor(
//! transport,
//! gossipsub,
//! local_peer_id,
Expand Down
4 changes: 2 additions & 2 deletions protocols/identify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ asynchronous-codec = "0.6"
futures = "0.3.1"
futures-timer = "3.0.2"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
log = "0.4.1"
lru = "0.8.0"
prost-codec = { version = "0.3", path = "../../misc/prost-codec" }
Expand All @@ -32,7 +32,7 @@ libp2p = { path = "../..", features = ["full"] }
[build-dependencies]
prost-build = "0.11"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/kad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ asynchronous-codec = "0.6"
futures = "0.3.1"
log = "0.4"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
prost = "0.11"
rand = "0.8"
sha2 = "0.10.0"
Expand All @@ -44,7 +44,7 @@ prost-build = "0.11"
[features]
serde = ["dep:serde", "bytes/serde"]

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/mdns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data-encoding = "2.3.2"
futures = "0.3.13"
if-watch = "3.0.0"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
log = "0.4.14"
rand = "0.8.3"
smallvec = "1.6.1"
Expand Down Expand Up @@ -45,7 +45,7 @@ name = "use-tokio"
required-features = ["tokio"]


# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/ping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ futures = "0.3.1"
futures-timer = "3.0.2"
instant = "0.1.11"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
log = "0.4.1"
rand = "0.8"
void = "1.0"
Expand All @@ -25,7 +25,7 @@ async-std = "1.6.2"
libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ futures = "0.3.1"
futures-timer = "3"
instant = "0.1.11"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
log = "0.4"
pin-project = "1"
prost-codec = { version = "0.3", path = "../../misc/prost-codec" }
Expand All @@ -38,7 +38,7 @@ libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
clap = { version = "4.0.13", features = ["derive"] }

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/rendezvous/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ futures = { version = "0.3", default-features = false, features = ["std"] }
futures-timer = "3.0.2"
instant = "0.1.11"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
log = "0.4"
prost = "0.11"
prost-codec = { version = "0.3.0", path = "../../misc/prost-codec" }
Expand All @@ -37,7 +37,7 @@ tokio = { version = "1.15", features = [ "rt-multi-thread", "time", "macros", "s
[build-dependencies]
prost-build = "0.11"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions protocols/request-response/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bytes = "1"
futures = "0.3.1"
instant = "0.1.11"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-swarm = { version = "0.41.0", path = "../../swarm" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
log = "0.4.11"
rand = "0.8"
smallvec = "1.6.1"
Expand All @@ -28,7 +28,7 @@ env_logger = "0.10.0"
libp2p = { path = "../..", features = ["full"] }
rand = "0.8"

# Passing arguments to the docsrs builder in order to properly document cfg's.
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
Expand Down
6 changes: 3 additions & 3 deletions src/tutorials/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
//! // can be observed.
//! let behaviour = ping::Behaviour::new(ping::Config::new().with_keep_alive(true));
//!
//! let mut swarm = Swarm::new(transport, behaviour, local_peer_id);
//! let mut swarm = Swarm::with_async_std_executor(transport, behaviour, local_peer_id);
//!
//! Ok(())
//! }
Expand Down Expand Up @@ -245,7 +245,7 @@
//! // can be observed.
//! let behaviour = ping::Behaviour::new(ping::Config::new().with_keep_alive(true));
//!
//! let mut swarm = Swarm::new(transport, behaviour, local_peer_id);
//! let mut swarm = Swarm::with_async_std_executor(transport, behaviour, local_peer_id);
//!
//! // Tell the swarm to listen on all interfaces and a random, OS-assigned
//! // port.
Expand Down Expand Up @@ -290,7 +290,7 @@
//! // can be observed.
//! let behaviour = ping::Behaviour::new(ping::Config::new().with_keep_alive(true));
//!
//! let mut swarm = Swarm::new(transport, behaviour, local_peer_id);
//! let mut swarm = Swarm::with_async_std_executor(transport, behaviour, local_peer_id);
//!
//! // Tell the swarm to listen on all interfaces and a random, OS-assigned
//! // port.
Expand Down
6 changes: 6 additions & 0 deletions swarm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.42.0 [unreleased]

- Removed deprecated Swarm constructors. For transition notes see [0.41.0](#0.41.0). See [PR 3170].

[PR 3170]: https://github.com/libp2p/rust-libp2p/pull/3170

# 0.41.1

- Update to `libp2p-swarm-derive` `v0.31.0`.
Expand Down
2 changes: 1 addition & 1 deletion swarm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-swarm"
edition = "2021"
rust-version = "1.62.0"
description = "The libp2p swarm"
version = "0.41.1"
version = "0.42.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
2 changes: 1 addition & 1 deletion swarm/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ pub enum NetworkBehaviourAction<
/// # .multiplex(yamux::YamuxConfig::default())
/// # .boxed();
/// #
/// # let mut swarm = Swarm::new(transport, MyBehaviour::default(), local_peer_id);
/// # let mut swarm = Swarm::with_threadpool_executor(transport, MyBehaviour::default(), local_peer_id);
/// #
/// // Super precious message that we should better not lose.
/// let message = PreciousMessage("My precious message".to_string());
Expand Down
6 changes: 0 additions & 6 deletions swarm/src/connection/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1102,12 +1102,6 @@ impl PoolConfig {
}
}

/// Configures the executor to use for spawning connection background tasks.
pub fn with_executor(mut self, executor: Box<dyn Executor + Send>) -> Self {
self.executor = Some(executor);
self
}

/// Sets the maximum number of events sent to a connection's background task
/// that may be buffered, if the task cannot keep up with their consumption and
/// delivery to the connection handler.
Expand Down
4 changes: 2 additions & 2 deletions swarm/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct TokioExecutor;
))]
impl Executor for TokioExecutor {
fn exec(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>) {
let _ = tokio::spawn(future);
tokio::spawn(future);
}
}

Expand All @@ -56,7 +56,7 @@ pub struct AsyncStdExecutor;
))]
impl Executor for AsyncStdExecutor {
fn exec(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>) {
let _ = async_std::task::spawn(future);
async_std::task::spawn(future);
}
}

Expand Down