Update what we know about the cluter based on MetadataResponse

 @param [MetadataResponse] topic_metadata_response
 @return nil
5570
def update(topic_metadata_response)
      update_brokers(topic_metadata_response.brokers)
      update_topics(topic_metadata_response.topics)

      @last_refreshed_at = Time.now
      nil
    end
40471
def update(request)
      if options[:multiple]
        cats = request.every(options[:category])
        cats.each do |cat|
          if cat || options[:nils]
            @categories[cat] ||= 0
            @categories[cat] += 1
          end
        end

      else
        cat = @categorizer.call(request)
        if cat || options[:nils]
          @categories[cat] ||= 0
          @categories[cat] += 1
        end
      end
    end
764949
def update_metadata(uid)
      return false unless store_meta
      path = full_path(uid)
      meta = storage(:get_blob, container_name, path)[0].metadata
      return false if meta.present?
      meta = meta_from_file(path)
      return false if meta.blank?
      storage(:set_blob_metadata, container_name, path, meta)
      storage(:delete_blob, container_name, meta_path(path))
      true
    rescue Azure::Core::Http::HTTPError
      nil
    end
352083
public void modifyRequest(ResponseBuilder rb, SearchComponent who,
      ShardRequest sreq) {
    if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)) {
      if (sreq.params.getBool(PARAM_MTAS_PREFIX, false)
          && (sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {
        // do nothing
      } else {
        // remove prefix for other requests
        Set<String> keys = MtasSolrResultUtil
            .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_PREFIX);
        sreq.params.remove(PARAM_MTAS_PREFIX);
        for (String key : keys) {
          sreq.params.remove(
              PARAM_MTAS_PREFIX + "." + key + "." + NAME_MTAS_PREFIX_FIELD);
          sreq.params.remove(
              PARAM_MTAS_PREFIX + "." + key + "." + NAME_MTAS_PREFIX_KEY);
        }
      }
    }
  }
1036969
def update_metadata_image(sdc_url, token, vdc, product, metadata_image):
    
    print 'update metadata' 
    print product
    url = sdc_url+ "/catalog/product/"+product
    print url
    headers = {'X-Auth-Token': token, 'Tenant-Id': vdc,
               'Accept': "application/json",
               'Content-Type': 'application/json'}
    print headers
    response = http.get(url, headers)
    print url
    if response.status != 200:
        print 'error to get the product ' + str(response.status)
        return
    else:
       
        payload = '{"key":"image","value":"' + metadata_image + '"}'
        print payload
        response = http.put(url + "/metadatas/image", headers, payload)
        print response
        if response.status != 200:
            print 'error to update the product ' + product \
                  + ' ' + str(response.status)
1330211
def sort_replies(self, thats=False):
        
        # (Re)initialize the sort cache.
        self._sorted["topics"] = {}
        self._sorted["thats"]  = {}
        self._say("Sorting triggers...")

        # Loop through all the topics.
        for topic in self._topics.keys():
            self._say("Analyzing topic " + topic)

            # Collect a list of all the triggers we're going to worry about.
            # If this topic inherits another topic, we need to recursively add
            # those to the list as well.
            alltrig = inherit_utils.get_topic_triggers(self, topic, False)

            # Sort them.
            self._sorted["topics"][topic] = sorting.sort_trigger_set(alltrig, True, self._say)

            # Get all of the %Previous triggers for this topic.
            that_triggers = inherit_utils.get_topic_triggers(self, topic, True)

            # And sort them, too.
            self._sorted["thats"][topic] = sorting.sort_trigger_set(that_triggers, False, self._say)

        # And sort the substitution lists.
        if not "lists" in self._sorted:
            self._sorted["lists"] = {}
        self._sorted["lists"]["sub"] = sorting.sort_list(self._sub.keys())
        self._sorted["lists"]["person"] = sorting.sort_list(self._person.keys())
83996
def refresh_mrrt(responses, resource)
      logger.verbose("Attempting to obtain access token for #{resource} by " \
                     "refreshing 1 of #{responses.count(&:mrrt?)} matching " \
                     'MRRTs.')
      responses.each do |response|
        if response.mrrt?
          refresh_response = response.refresh(resource)
          return refresh_response if add(refresh_response)
        end
      end
      nil
    end
238669
def refresh_metadata
      @cloud_app = MnoEnterprise::App.find params[:id]
      result = @cloud_app.refresh_metadata! params[:metadata_url]
      if result && result[:errors].blank?
        render :show
      else
        render json: result, status: 400
      end
    end
314597
def update_metadata_for_node(self, node, metadata):
        
        return self.manager.update_metadata(self, metadata, node=node)
1150053
def list_topics
      response = random_broker.fetch_metadata(topics: nil)
      response.topics.select do |topic|
        topic.topic_error_code == 0
      end.map(&:topic_name)
    end
826993
ModbusResponse updateResponseWithHeader(ModbusResponse response, boolean ignoreFunctionCode) {

        // transfer header data
        response.setHeadless(isHeadless());
        if (!isHeadless()) {
            response.setTransactionID(getTransactionID());
            response.setProtocolID(getProtocolID());
        }
        else {
            response.setHeadless();
        }
        response.setUnitID(getUnitID());
        if (!ignoreFunctionCode) {
            response.setFunctionCode(getFunctionCode());
        }
        return response;
    }
281493
def update_with_missing(source_uri, missing_names)
      progress = ui.progress_reporter(missing_names.size,
          "Updating metadata for #{missing_names.size} gems from #{source_uri}")
      missing_names.each do |spec_name|
        gemspec = fetch_single_spec(source_uri, spec_name)
        if gemspec.nil? then
          ui.say "Failed to download spec #{spec_name} from #{source_uri}:\n" \
                   "\t#{@fetch_error.message}"
        else
          add_spec gemspec
          progress.updated spec_name
        end
        @fetch_error = nil
      end
      progress.done
      progress.count
    end
436038
def update(params={})
      machine.request_options = machine.request_options.merge(body: parse_params(params, :metadata).to_json)
      Zcloudjp::Client.put("/machines/#{machine.id}/metadata", machine.request_options)
    end
892700
def topic(id, options={})
      params = { :lang => @query_options[:lang], :limit => @query_options[:limit] }.merge(options)
      get(surl('topic') + id, params, format: :json).parsed_response
    end
1149205
def update_access_token(response)
      h = JSON.load(response)
      @access_token = String(h['access_token'])
      @access_token_expires_at = Time.at(Time.now.to_i + Integer(h['expires_in']))
    end
198904
def update_metadata(self, key, value):
        
        old_value = self.contents['metadata'].get(key)
        self.contents['metadata'][key] = value
        self._log('Updated metadata: %s=%s' % (key, value))
        return old_value
1097082
def _maybe_refresh_metadata(self, wakeup=False):
        
        ttl = self.cluster.ttl()
        wait_for_in_progress_ms = self.config['request_timeout_ms'] if self._metadata_refresh_in_progress else 0
        metadata_timeout = max(ttl, wait_for_in_progress_ms)

        if metadata_timeout > 0:
            return metadata_timeout

        # Beware that the behavior of this method and the computation of
        # timeouts for poll() are highly dependent on the behavior of
        # least_loaded_node()
        node_id = self.least_loaded_node()
        if node_id is None:
            log.debug("Give up sending metadata request since no node is available");
            return self.config['reconnect_backoff_ms']

        if self._can_send_request(node_id):
            topics = list(self._topics)
            if not topics and self.cluster.is_bootstrap(node_id):
                topics = list(self.config['bootstrap_topics_filter'])

            if self.cluster.need_all_topic_metadata or not topics:
                topics = [] if self.config['api_version'] < (0, 10) else None
            api_version = 0 if self.config['api_version'] < (0, 10) else 1
            request = MetadataRequest[api_version](topics)
            log.debug("Sending metadata request %s to node %s", request, node_id)
            future = self.send(node_id, request, wakeup=wakeup)
            future.add_callback(self.cluster.update_metadata)
            future.add_errback(self.cluster.failed_update)

            self._metadata_refresh_in_progress = True
            def refresh_done(val_or_error):
                self._metadata_refresh_in_progress = False
            future.add_callback(refresh_done)
            future.add_errback(refresh_done)
            return self.config['request_timeout_ms']

        # If there's any connection establishment underway, wait until it completes. This prevents
        # the client from unnecessarily connecting to additional nodes while a previous connection
        # attempt has not been completed.
        if self._connecting:
            return self.config['reconnect_backoff_ms']

        if self.maybe_connect(node_id, wakeup=wakeup):
            log.debug("Initializing connection to node %s for metadata request", node_id)
            return self.config['reconnect_backoff_ms']

        # connected but can't send more, OR connecting
        # In either case we just need to wait for a network event
        # to let us know the selected connection might be usable again.
        return float('inf')