Class LocalHostDiscovery
java.lang.Object
org.drasyl.peer.connection.localhost.LocalHostDiscovery
- All Implemented Interfaces:
AutoCloseable,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 the PeersManager. These information can
then be used by the DirectConnectionsManager 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
ConstructorsConstructorDescriptionLocalHostDiscovery(DrasylConfig config, CompressedPublicKey ownPublicKey, PeersManager peersManager, Set<Endpoint> endpoints, Pipeline pipeline) -
Method Summary
-
Constructor Details
-
LocalHostDiscovery
public LocalHostDiscovery(DrasylConfig config, CompressedPublicKey ownPublicKey, PeersManager peersManager, Set<Endpoint> endpoints, Pipeline pipeline)
-
-
Method Details
-
open
public void open()Description copied from interface:DrasylNodeComponentStarts the component.- Specified by:
openin interfaceDrasylNodeComponent
-
close
public void close()Description copied from interface:DrasylNodeComponentStops the component.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDrasylNodeComponent
-