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

swarm: Remove functions deprecated in 0.41.0 #3119

Closed
Closed
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ce2cb5c
Initial prototype commit
umgefahren Nov 8, 2022
6cb302f
Merge branch 'master' into executor-aware-swarm
umgefahren Nov 8, 2022
b69dc35
Update swarm/src/connection/pool.rs
umgefahren Nov 9, 2022
12e0a32
Moving tokio and async std executors
umgefahren Nov 9, 2022
ad2ad9b
Implement other changes
umgefahren Nov 9, 2022
92da6a2
Formatted
umgefahren Nov 9, 2022
e7253d1
Update swarm/src/connection/pool.rs
umgefahren Nov 10, 2022
3a24540
Update swarm/src/lib.rs
umgefahren Nov 10, 2022
98dc7ce
Implemented changes
umgefahren Nov 10, 2022
38b21d7
Merge branch 'executor-aware-swarm' of github.com:umgefahren/rust-lib…
umgefahren Nov 10, 2022
804b7d6
Merge branch 'master' into executor-aware-swarm
umgefahren Nov 10, 2022
8fd5e56
Fix tests
umgefahren Nov 10, 2022
ee9354c
Modified CI
umgefahren Nov 10, 2022
5381a2c
Corrected some clippy issues
umgefahren Nov 10, 2022
dc5f1b7
Update core/Cargo.toml
umgefahren Nov 10, 2022
b82db0b
Merge branch 'master' into executor-aware-swarm
umgefahren Nov 11, 2022
5365389
Implemented suggested changes
umgefahren Nov 11, 2022
50ee927
Merge branch 'master' into executor-aware-swarm
umgefahren Nov 12, 2022
e055d2a
Apply suggestions from code review
umgefahren Nov 12, 2022
5feb2e5
Implemented requested changes
umgefahren Nov 12, 2022
e6761c6
Use new api
umgefahren Nov 13, 2022
20c5a09
Update swarm/src/lib.rs
umgefahren Nov 13, 2022
eb7836d
Update swarm/src/lib.rs
umgefahren Nov 13, 2022
361ec51
Update swarm/src/lib.rs
umgefahren Nov 13, 2022
da955ba
Implemented more ergonomic api
umgefahren Nov 13, 2022
7d8cbe3
Move executor
umgefahren Nov 13, 2022
15607ba
Merge branch 'master' into executor-aware-swarm
umgefahren Nov 13, 2022
f0493ed
Correct bad merge
umgefahren Nov 13, 2022
91676a9
Do fmt
umgefahren Nov 13, 2022
d99b802
Added changelog entries
umgefahren Nov 13, 2022
05deb81
Merge branch 'master' into executor-aware-swarm
umgefahren Nov 13, 2022
69fa671
Apply suggestions from code review
umgefahren Nov 13, 2022
f27fdf8
Implement small changes
umgefahren Nov 13, 2022
742f555
Merge branch 'master' into executor-aware-swarm
umgefahren Nov 13, 2022
f61686d
Apply suggestions from code review
umgefahren Nov 14, 2022
d193da3
Merge branch 'master' into executor-aware-swarm
umgefahren Nov 14, 2022
30c5020
Addressed Max's concerns.
umgefahren Nov 14, 2022
2a87f5b
Removed deprecated APIs
umgefahren Nov 14, 2022
ee51f81
Merge branch 'master' into remove-deprecated-swarm-functions
umgefahren Nov 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions swarm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,26 +342,8 @@ impl<TBehaviour> Swarm<TBehaviour>
where
TBehaviour: NetworkBehaviour,
{
/// Builds a new `Swarm`.
#[deprecated(
since = "0.41.0",
note = "This constructor is considered ambiguous regarding the executor. Use one of the new, executor-specific constructors or `Swarm::with_threadpool_executor` for the same behaviour."
)]
pub fn new(
transport: transport::Boxed<(PeerId, StreamMuxerBox)>,
behaviour: TBehaviour,
local_peer_id: PeerId,
) -> Self {
Self::with_threadpool_executor(transport, behaviour, local_peer_id)
}

/// Builds a new `Swarm` with a provided executor.
pub fn with_executor(
transport: transport::Boxed<(PeerId, StreamMuxerBox)>,
behaviour: TBehaviour,
local_peer_id: PeerId,
executor: impl Executor + Send + 'static,
) -> Self {
SwarmBuilder::with_executor(transport, behaviour, local_peer_id, executor).build()
}

Expand Down Expand Up @@ -1432,35 +1414,6 @@ impl<TBehaviour> SwarmBuilder<TBehaviour>
where
TBehaviour: NetworkBehaviour,
{
/// Creates a new `SwarmBuilder` from the given transport, behaviour and
/// local peer ID. The `Swarm` with its underlying `Network` is obtained
/// via [`SwarmBuilder::build`].
#[deprecated(
since = "0.41.0",
note = "Use `SwarmBuilder::with_executor` or `SwarmBuilder::without_executor` instead."
)]
pub fn new(
transport: transport::Boxed<(PeerId, StreamMuxerBox)>,
behaviour: TBehaviour,
local_peer_id: PeerId,
) -> Self {
let executor: Option<Box<dyn Executor + Send>> = match ThreadPoolBuilder::new()
.name_prefix("libp2p-swarm-task-")
.create()
.ok()
{
Some(tp) => Some(Box::new(tp)),
None => None,
};
SwarmBuilder {
local_peer_id,
transport,
behaviour,
pool_config: PoolConfig::new(executor),
connection_limits: Default::default(),
}
}

/// Creates a new [`SwarmBuilder`] from the given transport, behaviour, local peer ID and
/// executor. The `Swarm` with its underlying `Network` is obtained via
/// [`SwarmBuilder::build`].
Expand Down Expand Up @@ -1538,17 +1491,6 @@ where
}
}

/// Configures the `Executor` to use for spawning background tasks.
///
/// By default, unless another executor has been configured,
/// [`SwarmBuilder::build`] will try to set up a
/// [`ThreadPool`](futures::executor::ThreadPool).
#[deprecated(since = "0.41.0", note = "Use `SwarmBuilder::with_executor` instead.")]
pub fn executor(mut self, executor: Box<dyn Executor + Send>) -> Self {
self.pool_config = self.pool_config.with_executor(executor);
self
}

/// Configures the number of events from the [`NetworkBehaviour`] in
/// destination to the [`ConnectionHandler`] that can be buffered before
/// the [`Swarm`] has to wait. An individual buffer with this number of
Expand Down