Package com.privatechain.core.network
Interface PeerManagerLifecycle
- All Known Implementing Classes:
PeerManager
public interface PeerManagerLifecycle
Lifecycle interface for the P2P peer manager.
Defined in blockchain-core so that BlockchainNode
can reference the peer manager without introducing a hard dependency on the
blockchain-network module (design.md §7.1 — zero mandatory transitive deps
on blockchain-core).
The concrete implementation PeerManager lives in blockchain-network
and is injected via
BlockchainNode.setPeerManager(PeerManagerLifecycle)
during node assembly.
- Since:
- 1.0.0
- See Also:
-
Method Details
-
start
void start()Starts the peer manager (heartbeat scheduler, seed peer connections, etc.).- Throws:
IllegalStateException- if already started
-
stop
void stop()Stops the peer manager and disconnects all active peers cleanly. -
getConnectedPeerCount
int getConnectedPeerCount()Returns the number of currently connected peers.- Returns:
- connected peer count (≥ 0)
-