Class LocalHostDiscovery
- java.lang.Object
-
- org.drasyl.peer.connection.localhost.LocalHostDiscovery
-
- All Implemented Interfaces:
AutoCloseable
,DrasylNodeComponent
public class LocalHostDiscovery extends Object implements DrasylNodeComponent
Uses the file system to discover other drasyl nodes running on the local computer.To do this, all nodes regularly write their current endpoints to the file system. At the same time the file system is monitored to detect new nodes. If the file system does not support monitoring, a fallback to polling is used.
The discovery directory is scanned whenever communication with another peer occur.
This discovery mechanism does not itself establish connections to other peers. Only
PeerInformation
are discovered and passed to thePeersManager
. These information can then be used by theDirectConnectionsManager
to establish connections.Inspired by: https://github.com/actoron/jadex/blob/10e464b230d7695dfd9bf2b36f736f93d69ee314/platform/base/src/main/java/jadex/platform/service/awareness/LocalHostAwarenessAgent.java
-
-
Constructor Summary
Constructors Constructor Description LocalHostDiscovery(DrasylConfig config, CompressedPublicKey ownPublicKey, PeersManager peersManager, Set<Endpoint> endpoints, io.reactivex.rxjava3.core.Observable<CompressedPublicKey> communicationOccurred)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Stops the component.void
open()
Starts the component.
-
-
-
Constructor Detail
-
LocalHostDiscovery
public LocalHostDiscovery(DrasylConfig config, CompressedPublicKey ownPublicKey, PeersManager peersManager, Set<Endpoint> endpoints, io.reactivex.rxjava3.core.Observable<CompressedPublicKey> communicationOccurred)
-
-
Method Detail
-
open
public void open()
Description copied from interface:DrasylNodeComponent
Starts the component.- Specified by:
open
in interfaceDrasylNodeComponent
-
close
public void close()
Description copied from interface:DrasylNodeComponent
Stops the component.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDrasylNodeComponent
-
-