// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "configkeyset.h" #include "configsnapshot.h" #include #include namespace config { /** * The SimpleConfigRetriever takes an entires set of keys and subscribes to * all of them. Once this is done, it cannot be resubscribed. You can poll this * for new snapshots. */ class SimpleConfigRetriever { public: typedef std::unique_ptr UP; SimpleConfigRetriever(const ConfigKeySet & keySet, std::shared_ptr context, vespalib::duration subscribeTimeout = DEFAULT_SUBSCRIBE_TIMEOUT); /** * Attempt retrieving a snapshot of configs. * @param timeout The amount of time to wait for a new snapshot. * @return A new snapshot. The snapshot is empty if timeout was reached or * if the retriever was closed. */ ConfigSnapshot getConfigs(vespalib::duration timeout = DEFAULT_GETCONFIGS_TIMEOUT); void close(); bool isClosed() const; private: ConfigSubscriptionSet _set; std::vector> _subscriptionList; }; } // namespace config