bool operator==( const ResourceProviderInfo& left, const ResourceProviderInfo& right) { if (left.id() != right.id()) { return false; } if (Attributes(left.attributes()) != Attributes(right.attributes())) { return false; } if (Resources(left.resources()) != Resources(right.resources())) { return false; } return true; }
bool operator==( const ResourceProviderInfo& left, const ResourceProviderInfo& right) { // Order of reservations is important. if (left.default_reservations_size() != right.default_reservations_size()) { return false; } for (int i = 0; i < left.default_reservations_size(); i++) { if (left.default_reservations(i) != right.default_reservations(i)) { return false; } } return left.has_id() == right.has_id() && (!left.has_id() || left.id() == right.id()) && Attributes(left.attributes()) == Attributes(right.attributes()) && left.type() == right.type() && left.name() == right.name() && left.has_storage() == right.has_storage() && (!left.has_storage() || left.storage() == right.storage()); }
void ResourceProviderManagerProcess::subscribe( const HttpConnection& http, const Call::Subscribe& subscribe) { ResourceProviderInfo resourceProviderInfo = subscribe.resource_provider_info(); resourceProviderInfo.mutable_id()->CopyFrom(newResourceProviderId()); ResourceProvider resourceProvider(resourceProviderInfo, http); Event event; event.set_type(Event::SUBSCRIBED); event.mutable_subscribed()->mutable_provider_id()->CopyFrom( resourceProvider.info.id()); if (!resourceProvider.http.send(event)) { LOG(WARNING) << "Unable to send event to resource provider " << stringify(resourceProvider.info.id()) << ": connection closed"; } resourceProviders.put(resourceProviderInfo.id(), std::move(resourceProvider)); }