Handles a node that is currently syncing.

 @param [Node] node the syncing node
 @param [Hash<Node, NodeSnapshot>] snapshots the current set of snapshots
966300
def handle_syncing(node, snapshots)
      reconcile(node)

      if node.syncing_with_master? && node.prohibits_stale_reads?
        logger.info("Node #{node} not ready yet, still syncing with master.")
        force_unavailable_slave(node)
      else
        # otherwise, we can use this node
        handle_available(node, snapshots)
      end
    end
1149575
def process_snapshot_job(query = {}, report_email = nil, postback_url = nil, options = {})
      data = options
      data['query'] = query
      process_job(:snapshot, data, report_email, postback_url)
    end
1251811
def snapshot(name = nil, **kwords)
      # TODO: 1.0
      if name.nil? && !kwords.key?(:Name)
        # backwards compatible handling allows name to be passed though
        # kwords or the argument. Argument is preferred.
        raise ArgumentError, 'wrong number of arguments (given 0, expected 1)'
      end
      kwords[:Name] = name unless name.nil?
      response = connection.send(:post, "/repos/#{self.Name}/snapshots",
                                 body: JSON.generate(kwords))
      Aptly::Snapshot.new(::Aptly::Connection.new, JSON.parse(response.body))
    end
917025
def refresh_peers(node, &block)
      node.peers.each do |node|
        if node.address.resolved
          block.call(node) unless seeds.include?(node)
          peers.push(node) unless peers.include?(node)
        end
      end
    end
916700
def monitor_node
      failures = 0

      loop do
        begin
          break if @done
          sleep(WATCHER_SLEEP_TIME)
          latency = Benchmark.realtime { @node.ping }
          failures = 0
          notify(:available, latency)
          @node.wait
        rescue NodeUnavailableError => ex
          logger.debug("Failed to communicate with node #{@node}: #{ex.inspect}")
          failures += 1
          if failures >= @max_failures
            notify(:unavailable)
            failures = 0
          end
        rescue Exception => ex
          logger.error("Unexpected error while monitoring node #{@node}: #{ex.inspect}")
          logger.error(ex.backtrace.join("\n"))
        end
      end
    end
842479
def update_nodes!(nodes)
      @node_names.each do |node_name|
        # find out if the node is already in the array
        found = nodes.index { |n| n['name'] == node_name }
        if found.nil?
          nodes.push(node_export(node_name))
        else
          nodes[found] = node_export(node_name)
        end
      end
    end
792877
function syncStrategy(node, oAggregation, mAggregations) {
			var childNode,
				vChild,
				aChildren = [];

			for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) {
				vChild = fnCallback(node, oAggregation, mAggregations, childNode);
				if (vChild) {
					aChildren.push(unwrapSyncPromise(vChild));
				}
			}
			return SyncPromise.resolve(aChildren);
		}
255731
def on_send(node)
      name     = node.children[1].to_s
      name     = SEND_MAPPING.fetch(name, name)
      callback = "on_send_#{name}"

      value_stack.add_stack

      execute_callback(callback, node)
    end
631061
def snapshot(*args)
      sn = Snapshot.new self, *args
      if block_given?
        begin
          yield sn
        ensure
          sn.release
        end
      else
        sn
      end
    end
43080
function(syncAction){
    var oldAction = this.syncAction;

    if (typeof syncAction != 'function')
      syncAction = null;

    this.syncAction = syncAction;

    if (syncAction)
    {
      if (!oldAction)
        this.addHandler(this.syncEvents);
      if (this.isSyncRequired())
        callSyncAction(this);
    }
    else
    {
      if (oldAction)
        this.removeHandler(this.syncEvents);
    }
  }
611950
def node_updated(self, node):
        
        if self._capture_node and node == self._capture_node["node"] and node.status != "started":
            yield from self.stop_capture()
510077
def current_node_snapshots
      nodes = {}
      snapshots = Hash.new { |h, k| h[k] = NodeSnapshot.new(k) }
      fetch_node_manager_states.each do |node_manager, states|
        available, unavailable = states.values_at(:available, :unavailable)
        available.each do |node_string, latency|
          node = nodes[node_string] ||= node_from(node_string)
          snapshots[node].viewable_by(node_manager, latency)
        end
        unavailable.each do |node_string|
          node = nodes[node_string] ||= node_from(node_string)
          snapshots[node].unviewable_by(node_manager)
        end
      end

      snapshots
    end
1155838
private void handleJoinEvent(Node node) {
    SwimMember member = new SwimMember(MemberId.from(node.id().id()), node.address());
    if (!members.containsKey(member.id())) {
      probe(member.copy());
    }
  }
1248396
private void handleMasterNodeChange() {
    try {
      synchronized (hasActiveServer) {
        if (ZooKeeperUtil.watchAndCheckExists(this, masterZnode)) {
          // A master node exists, there is an active master
          if (LOG.isDebugEnabled()) {
            LOG.debug("A master is now available");
          }
          hasActiveServer.set(true);
        } else {
          // Node is no longer there, cluster does not have an active master
          if (LOG.isDebugEnabled()) {
            LOG.debug("No master available. Notifying waiting threads");
          }
          hasActiveServer.set(false);
          // Notify any thread waiting to become the active master
          hasActiveServer.notifyAll();
        }
      }
    } catch (KeeperException ke) {
      LOG.error("Received an unexpected KeeperException, aborting", ke);
    }
  }
1301901
def sync(self, recursive=False):
        
        self.syncTree(recursive=recursive)
        self.syncView(recursive=recursive)
731565
public void heartbeatNode (String nodeName)
    {
        updatePartial(NodeRecord.getKey(nodeName),
                      NodeRecord.LAST_UPDATED, new Timestamp(System.currentTimeMillis()));
    }
917600
def method_missing(meth, *args, &block)
      if @node.respond_to?(meth)
        @node.send meth, *args, &block
      elsif @node.children.respond_to?(meth)
        @node.children.send meth, *args, &block
      else
        super
      end
    end