Used to update the master node manager state. These states are only handled if
 this node manager instance is serving as the master manager.

 @param [Node] node the node to handle
 @param [Hash<Node, NodeSnapshot>] snapshots the current set of snapshots
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
89607
def snapshots
      raise Fission::Error,"VM #{@name} does not exist" unless self.exists?

      command = "#{vmrun_cmd} listSnapshots #{vmx_path.shellescape} 2>&1"
      output = `#{command}`

      raise "There was an error listing the snapshots of #{@name} :\n #{output}" unless  $?.exitstatus==0

      snaps_unfiltered = output.split("\n").select { |s| !s.include? 'Total snapshots:' }
      snaps=snaps_unfiltered.map { |s| s.strip }
      return snaps
    end
879954
def snapshot_entity(entity)
      if entity.class.respond_to? :entity_store_snapshot_key
        # If there is a snapshot key, store it too
        snapshot_key = entity.class.entity_store_snapshot_key
      else
        # Otherwise, make sure there isn't one set
        snapshot_key = nil
      end

      unless entities[:id => entity.id]
        entities.insert(:id => entity.id, :_type => entity.class.name, :version => entity.version)
      end

      entities
        .where(:id => entity.id)
        .update(:snapshot => PigeonHole.generate(entity.attributes), :snapshot_key => snapshot_key )
    end
710270
def update_snapshots(self, snapshots_data: List[Tuple[str, int]]):
        
        cursor = self.conn.cursor()
        cursor.executemany(
            'UPDATE state_snapshot SET data=? WHERE identifier=?',
            snapshots_data,
        )
        self.maybe_commit()
489794
public void setSnapshots(java.util.Collection<Snapshot> snapshots) {
        if (snapshots == null) {
            this.snapshots = null;
            return;
        }

        this.snapshots = new com.amazonaws.internal.SdkInternalList<Snapshot>(snapshots);
    }
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
691910
private void sendSnapshotTxnId(SnapshotInfo toRestore) {
        long txnId = toRestore != null ? toRestore.txnId : 0;
        String jsonData = toRestore != null ? toRestore.toJSONObject().toString() : "{}";
        LOG.debug("Sending snapshot ID " + txnId + " for restore to other nodes");
        try {
            m_zk.create(VoltZK.restore_snapshot_id, jsonData.getBytes(Constants.UTF8ENCODING),
                        Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
        } catch (Exception e) {
            VoltDB.crashGlobalVoltDB("Failed to create Zookeeper node: " + e.getMessage(),
                                     false, e);
        }
    }
776511
def proppatch(nodes)
      init_pstore unless exists?

      actions = { set: [], remove: [] }

      @store.transaction do
        @store[:properties] = {} unless @store[:properties].is_a? Hash

        add_remove_properties nodes, actions
      end

      get_custom_property nil
      actions
    end
946447
public void updateNode (NodeRecord record)
    {
        record.lastUpdated = new Timestamp(System.currentTimeMillis());
        store(record);
    }
620885
private void changeState() {
        if (m_state == State.RESTORE) {
            fetchSnapshotTxnId();

            exitRestore();
            m_state = State.REPLAY;

            /*
             * Add the interest here so that we can use the barriers in replay
             * agent to synchronize.
             */
            m_snapshotMonitor.addInterest(this);
            m_replayAgent.replay();
        } else if (m_state == State.REPLAY) {
            m_state = State.TRUNCATE;
        } else if (m_state == State.TRUNCATE) {
            m_snapshotMonitor.removeInterest(this);
            if (m_callback != null) {
                m_callback.onReplayCompletion(m_truncationSnapshot, m_truncationSnapshotPerPartition);
            }

            // Call balance partitions after enabling transactions on the node to shorten the recovery time
            if (m_isLeader) {
                m_replayAgent.resumeElasticOperationIfNecessary();
            }
        }
    }
486770
function (nodes, done) {
      self.changes = nodes.reduce(maxChange, self.changes)
      done(null, nodes)
    }
157795
protected void completeSnapshot(Snapshot snapshot) {
    Assert.notNull(snapshot, "snapshot");
    snapshots.put(snapshot.index(), snapshot);

    if (currentSnapshot == null || snapshot.index() > currentSnapshot.index()) {
      currentSnapshot = snapshot;
    }

    // Delete old snapshots if necessary.
    if (!storage.retainStaleSnapshots()) {
      Iterator<Map.Entry<Long, Snapshot>> iterator = snapshots.entrySet().iterator();
      while (iterator.hasNext()) {
        Snapshot oldSnapshot = iterator.next().getValue();
        if (oldSnapshot.index() < currentSnapshot.index()) {
          iterator.remove();
          oldSnapshot.close();
          oldSnapshot.delete();
        }
      }
    }
  }
571651
def add(node)
      if @nodes.key?(node.key)
        raise DuplicateNodeError.new(node.key)
      end

      @nodes[node.key] = node
    end
435103
private void setSelectionState(Object node, State state, boolean propagate)
    {
        Objects.requireNonNull(state, "The state may not be null");
        Objects.requireNonNull(node, "The node may not be null");
        State oldState = selectionStates.put(node, state);
        if (!state.equals(oldState))
        {
            fireStateChanged(node, oldState, state);
            if (propagate)
            {
                updateSelection(node);
            }
        }
        repaint();
    }
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
1089247
private void onLirWarmupMiss(Node node) {
    node.moveToTop(StackType.S);
    node.status = Status.LIR;
    sizeHot++;
  }
126983
def add_nodes(self, nodes):
        '''
        '''
        new_nodes, master_map = self._add_nodes_as_master(nodes)

        for n in new_nodes:
            if n.name not in master_map:
                continue
            master_name = master_map[n.name]
            target = self.get_node(master_name)
            if not target:
                raise NodeNotFound(master_name)
            n.replicate(target.name)
            n.flush_cache()
            target.flush_cache()