Repository: ClickHouse/ClickHouse
File: base/poco/Util/include/Poco/Util/LayeredConfiguration.h (C/C++)

Code before:

        ConfigPtr find(const std::string & label) const;
        /// Finds and returns the configuration with the given label.
        ///
        /// Returns null if no such configuration can be found.

        //@ deprecated
        void addFront(AbstractConfiguration * pConfig);
        /// Adds a read-only configuration to the front of the LayeredConfiguration.
        /// The LayeredConfiguration does not take ownership of the given
        /// configuration. In other words, the configuration's reference
        /// count is incremented.

        //@ deprecated
        void addFront(AbstractConfiguration * pConfig, bool shared);
        /// Adds a read-only configuration to the front of the LayeredConfiguration.
        /// If shared is true, the LayeredConfiguration takes ownership
        /// of the given configuration.

        void removeConfiguration(AbstractConfiguration * pConfig);
        /// Removes the given configuration from the LayeredConfiguration.
        ///
        /// Does nothing if the given configuration is not part of the
        /// LayeredConfiguration.

        void replaceByLabel(const std::string & label, AbstractConfiguration * pNewConfig, int priority, bool shared);
        /// Atomically replaces the configuration with the given label.
        /// If no configuration with that label exists, adds it as new.
        /// This method is thread-safe with respect to concurrent readers
        /// that access the configuration through public methods of
        /// AbstractConfiguration (which lock _mutex).

    protected:
        struct ConfigItem
        {
            ConfigPtr pConfig;
            int priority;
            bool writeable;
            std::string label;
        };

        bool getRaw(const std::string & key, std::string & value) const;
        void setRaw(const std::string & key, const std::string & value);
        void enumerate(const std::string & key, Keys & range) const;
        void removeRaw(const std::string & key);

        int lowest() const;
        int highest() const;
        void insert(const ConfigItem & item);

        ~LayeredConfiguration();

Review comment (suggestion):
I guess more natural name will be just `replace` (as for `add`, there is specializations with `label` and without)

Code after:

        ConfigPtr find(const std::string & label) const;
        /// Finds and returns the configuration with the given label.
        ///
        /// Returns null if no such configuration can be found.

        //@ deprecated
        void addFront(AbstractConfiguration * pConfig);
        /// Adds a read-only configuration to the front of the LayeredConfiguration.
        /// The LayeredConfiguration does not take ownership of the given
        /// configuration. In other words, the configuration's reference
        /// count is incremented.

        //@ deprecated
        void addFront(AbstractConfiguration * pConfig, bool shared);
        /// Adds a read-only configuration to the front of the LayeredConfiguration.
        /// If shared is true, the LayeredConfiguration takes ownership
        /// of the given configuration.

        void removeConfiguration(AbstractConfiguration * pConfig);
        /// Removes the given configuration from the LayeredConfiguration.
        ///
        /// Does nothing if the given configuration is not part of the
        /// LayeredConfiguration.

        void replace(const std::string & label, AbstractConfiguration * pNewConfig, int priority, bool shared);
        /// Atomically replaces the configuration with the given label.
        /// If no configuration with that label exists, adds it as new.
        /// This method is thread-safe with respect to concurrent readers
        /// that access the configuration through public methods of
        /// AbstractConfiguration (which lock _mutex).

    protected:
        struct ConfigItem
        {
            ConfigPtr pConfig;
            int priority;
            bool writeable;
            std::string label;
        };

        bool getRaw(const std::string & key, std::string & value) const;
        void setRaw(const std::string & key, const std::string & value);
        void enumerate(const std::string & key, Keys & range) const;
        void removeRaw(const std::string & key);

        int lowest() const;
        int highest() const;
        void insert(const ConfigItem & item);

        ~LayeredConfiguration();