Determines if each snapshot has a sufficient number of node managers.

 @param [Hash<Node, Snapshot>] snapshots the current snapshots
 @return [Boolean] true if sufficient, false otherwise
335948
def ensure_sufficient_node_managers(snapshots)
      currently_sufficient = true
      snapshots.each do |node, snapshot|
        node_managers = snapshot.node_managers
        if node_managers.size < @required_node_managers
          logger.error("Not enough Node Managers in snapshot for node #{node}. " +
            "Required: #{@required_node_managers}, " +
            "Available: #{node_managers.size} #{node_managers}")
          currently_sufficient = false
        end
      end

      if currently_sufficient && !@sufficient_node_managers
        logger.info("Required Node Managers are visible: #{@required_node_managers}")
      end

      @sufficient_node_managers = currently_sufficient
      @sufficient_node_managers
    end
313736
def snapshots(self):
        
        j, _ = self.datacenter.request('GET', self.path + '/snapshots')
        return [Snapshot(machine=self, data=s) for s in j]
652000
def snapshots
      return @snapshots if @snapshots

      @snapshots = []
      @files.each do |f|
        io = File.open(f)
        @parser.read(io)
        @snapshots << @parser.snapshot
      end

      return @snapshots
    end
58438
def handle_manual_failover(node, snapshots)
      # no-op if node to be failed over is already master
      return if @master == node
      logger.info("Handling manual failover")

      # ensure we can talk to the node
      node.ping

      # make current master a slave, and promote new master
      @slaves << @master if @master
      @slaves.delete(node)
      promote_new_master(snapshots, node)
    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
1253484
def file_snapshots
      @file_snapshots = Hash.new { |h, k| h[k] = [] }

      files.each do |f|
        io = File.open(f)

        begin
          @mpq_reader = self.class::MPQ_READER.new
          @mpq_reader.read(io)
          @file_snapshots[f] << @mpq_reader
          print "."
        rescue EOFError => e
          puts "#{e.inspect}\n#{f}"
        end
      end

      return @file_snapshots
    end
201088
function(nodes) {
      for (var i = 0, node; node = nodes[i]; i++)
        node._counted = true;
      return nodes;
    }
822511
def user_has_fork_of_repo?
      # The API doesn't provide a simple means of checking whether a user has
      # forked a repository.

      # First, if there are no forks for the repository, return false.
      return false if @repo[:forks_count] == 0

      # Then check whether it's worth getting the list of forks
      if @repo[:forks_count] <= 100
        repo_forks = @client.forks @repo[:full_name], :per_page => 100
        repo_forks.each do |f|
          return true if f[:owner][:login] == @user[:login]
        end
      end

      # Then try to directly find a repository with the same name as the
      # repository in which the commit exists.
      potential_fork_nwo = "#{@user[:login]}/#{@repo[:name]}"
      begin
        potential_fork = @client.repository potential_fork_nwo
        if potential_fork[:fork]
          return true if potential_fork[:parent][:full_name] == @repo[:full_name]
        end
      rescue Octokit::NotFound
        # Keep going...
      end

      # Otherwise, get the user's forks and check the `parent` field of each
      # fork to see whether it matches @repo.
      @client.auto_paginate = true
      @user_repos = @client.repos
      @user_forks = @user_repos.select { |r| r[:fork] }
      @user_forks.each do |f|
        r = @client.repository f[:full_name]
        if r[:parent][:full_name] == @repo[:full_name]
          @client.auto_paginate = false
          return true
        end
      end
      @client.auto_paginate = false
      false
    end
281108
def snapshot_list(self):
        '''
        
        '''
        NO_SNAPSHOTS_TAKEN = 'No snapshots have been taken yet!'
        output = self._run_vagrant_command(['snapshot', 'list'])
        if NO_SNAPSHOTS_TAKEN in output:
            return []
        else:
            return output.splitlines()
357970
def update_master_state(node, snapshots)
      state = @node_strategy.determine_state(node, snapshots)
      case state
      when :unavailable
        handle_unavailable(node, snapshots)
      when :available
        if node.syncing_with_master?
          handle_syncing(node, snapshots)
        else
          handle_available(node, snapshots)
        end
      else
        raise InvalidNodeStateError.new(node, state)
      end
    rescue *ZK_ERRORS
      # fail hard if this is a ZK connection-related error
      raise
    rescue => ex
      logger.error("Error handling state report for #{[node, state].inspect}: #{ex.inspect}")
    end
1348835
private int countLiveNodes(Block b, Iterator<DatanodeDescriptor> nodeIter) {
    int live = 0;
    Collection<DatanodeDescriptor> nodesCorrupt = null;
    if (corruptReplicas.size() != 0) {
      nodesCorrupt = corruptReplicas.getNodes(b);
    }
    while (nodeIter.hasNext()) {
      DatanodeDescriptor node = nodeIter.next();
      if (((nodesCorrupt != null) && (nodesCorrupt.contains(node))) ||
        node.isDecommissionInProgress() || node.isDecommissioned()) {
        // do nothing
      } else {
        live++;
      }
    }
    return live;
  }
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
329476
def check
      return false unless @btree.check

      i = 0
      each do |k, v|
        i += 1
      end

      unless @entry_counter == i
        PEROBS.log.error "BigHash contains #{i} values but entry counter " +
          "is #{@entry_counter}"
        return false
      end

      true
    end
894700
def has_key?(key)
      if :hash == self.type
        self.children.any? { |pair_node| pair_node.key.to_value == key }
      else
        raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{self.debug_info}"
      end
    end
1375041
def find_snapshots
      unless @lineage
        s = @servers.first
        kind_params = s.transform_parameters(s.parameters)
        @lineage = kind_params['DB_LINEAGE_NAME'].gsub(/text:/, "")
      end
      snapshots = Ec2EbsSnapshot.find_by_cloud_id(@servers.first.cloud_id).select { |n| n.nickname =~ /#{@lineage}.*$/ }
    end
329963
def haveSnapshots(self):
		""""""
		return os.path.islink(self.latestLink) and os.path.isdir(self.latestLink)
745381
def snapshots
      return @snapshots if @snapshots

      @snapshots = []
      @files.each do |f|
        io = File.open(f)

        begin
          @parser.read(io)
          @snapshots << @parser.snapshot
        rescue EOFError => e
          puts "#{e.inspect}\n#{f}"
        end
      end

      return @snapshots
    end