32 std::map<const Node*, data::discovery::Response>
_remotes;
68 bool _cacheValid =
true;
82 void HandleDiscoveryRequest(
const Node* node,
const data::Message*
message);
90 void CacheDiscoveryResponse(
const Node* node,
const data::Message*
message);
99 void HandleInvalidationRequest(
const Node* node,
const data::Message*
message);
111 :
Mailbox(endpoint), _performActiveDiscovery(performActiveDiscovery)
113 FinishConstruction();
145 std::map<const Node*, data::discovery::Response> GetCachedNodeInformation();
154 std::unique_lock<std::mutex> guard(_observersMutex);
155 _observers.insert(observer);
164 std::unique_lock<std::mutex> guard(_observersMutex);
165 _observers.erase(observer);
186 void UnregisterDiscoverable(
Discoverable* discoverable);
196 virtual bool ReceiveMessage(
const Node* sender,
const data::Message*
message)
override;
203 virtual void NodeDidJoin(
const Node* node) noexcept
override;
210 virtual void NodeWillLeave(
const Node* node) noexcept
override;
std::map< const Node *, data::discovery::Response > _remotes
Cache of remote node discovery responses.
Interface for discovery observers.
The Discovery Service makes it possible to query remote nodes for services.
Service(Endpoint *endpoint, bool performActiveDiscovery)
Construct a new Service object.
std::set< Observer * > _observers
List of discovery observers.
An Awaiter that returns discovery data on a remote node.
data::discovery::Response _cachedResponse
Cached discovery response.
std::mutex _remotesMutex
Mutex to protect remotes list.
std::mutex _observersMutex
Mutex to protect observer list.
Abstract base class for Endpoint implementations.
bool _performActiveDiscovery
Should we send discovery requests automatically?
std::mutex _discoverablesMutex
Mutex to protect discoverable list.
Interface for discoverable services.
void UnregisterObserver(Observer *observer)
Unregister a discovery observer.
Represents a Node the Endpoint knows about and can send messages to.
Abstract base class for Mailbox implementations.
void RegisterObserver(Observer *observer)
Register a new discovery observer.
std::set< Discoverable * > _discoverables
List of discoverable services.