Skip to content

Commit f4cdfac

Browse files
committed
refactor: restore deprecated peer_id module for backwards compatibility
Address Copilot suggestion to maintain backwards compatibility when migrating to torrust-peer-id. Downstream code that imports torrust_tracker_primitives::peer_id::{PeerId, PeerClient} will continue to work with a deprecation warning, providing a smoother migration path until a planned major release removes this compatibility layer. Related-to: PR #1887
1 parent dac713b commit f4cdfac

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

packages/primitives/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ pub mod mode;
99
pub mod number_of_bytes;
1010
pub mod pagination;
1111
pub mod peer;
12+
#[deprecated(
13+
since = "3.0.0-develop",
14+
note = "import peer ID types from `torrust_peer_id` crate instead; \
15+
this module will be removed in a future release (see EPIC #1669)"
16+
)]
17+
pub mod peer_id;
1218
pub mod policy;
1319
pub mod scrape;
1420
pub mod swarm_metadata;
@@ -33,6 +39,15 @@ pub use scrape::ScrapeData;
3339
this re-export will be removed in a future release (see EPIC #1669)"
3440
)]
3541
pub use torrust_clock::DurationSinceUnixEpoch;
42+
/// **Deprecated**: import from [`torrust_peer_id`] instead via the [`peer_id`] module.
43+
/// This re-export is kept for backwards compatibility and will be removed in a
44+
/// future release. Removal is tracked as a follow-up cleanup subissue of EPIC
45+
/// [#1669](https://github.com/torrust/torrust-tracker/issues/1669).
46+
#[deprecated(
47+
since = "3.0.0-develop",
48+
note = "import peer ID types from `torrust_peer_id` crate instead; \
49+
this re-export will be removed in a future release (see EPIC #1669)"
50+
)]
3651
pub use torrust_peer_id::{PeerClient, PeerId};
3752

3853
/// Network service binding types.

packages/primitives/src/peer_id.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! Peer ID types.
2+
//!
3+
//! **Deprecated**: import from [`torrust_peer_id`] instead.
4+
//! This module is kept for backwards compatibility and will be removed in a
5+
//! future release. Removal is tracked as a follow-up cleanup subissue of EPIC
6+
//! [#1669](https://github.com/torrust/torrust-tracker/issues/1669).
7+
8+
#[deprecated(
9+
since = "3.0.0-develop",
10+
note = "import peer ID types from `torrust_peer_id` crate instead; \
11+
this module will be removed in a future release (see EPIC #1669)"
12+
)]
13+
pub use torrust_peer_id::{PeerClient, PeerId};

0 commit comments

Comments
 (0)