Applies (but not commits) requests of the PrePrepare
        to the ledger and state
350538
def _apply_pre_prepare(self, pre_prepare: PrePrepare):
        

        reqs = []
        idx = 0
        rejects = []
        invalid_indices = []
        suspicious = False

        # 1. apply each request
        for req_key in pre_prepare.reqIdr:
            req = self.requests[req_key].finalised
            try:
                self.processReqDuringBatch(req,
                                           pre_prepare.ppTime)
            except (InvalidClientMessageException, UnknownIdentifier, SuspiciousPrePrepare) as ex:
                self.logger.warning('{} encountered exception {} while processing {}, '
                                    'will reject'.format(self, ex, req))
                rejects.append((req.key, Reject(req.identifier, req.reqId, ex)))
                invalid_indices.append(idx)
                if isinstance(ex, SuspiciousPrePrepare):
                    suspicious = True
            finally:
                reqs.append(req)
            idx += 1

        # 2. call callback for the applied batch
        if self.isMaster:
            three_pc_batch = ThreePcBatch.from_pre_prepare(pre_prepare,
                                                           state_root=self.stateRootHash(pre_prepare.ledgerId,
                                                                                         to_str=False),
                                                           txn_root=self.txnRootHash(pre_prepare.ledgerId,
                                                                                     to_str=False),
                                                           primaries=[],
                                                           valid_digests=self.get_valid_req_ids_from_all_requests(
                                                               reqs, invalid_indices))
            self.node.onBatchCreated(three_pc_batch)

        return reqs, invalid_indices, rejects, suspicious
1169137
def tryCommit(self, prepare: Prepare):
        
        rv, reason = self.canCommit(prepare)
        if rv:
            self.doCommit(prepare)
        else:
            self.logger.debug("{} cannot send COMMIT since {}".format(self, reason))
1020349
def _request_pre_prepare(self, three_pc_key: Tuple[int, int],
                             stash_data: Optional[Tuple[str, str, str]] = None) -> bool:
        
        recipients = self.primaryName
        return self._request_three_phase_msg(three_pc_key,
                                             self.requested_pre_prepares,
                                             PREPREPARE,
                                             recipients,
                                             stash_data)
51782
function() {
			global.requestSSLInitializing = false;
			global.requestSSLInitialized = true;
			global.requestSSLHooks = null;
			// unpatch ourselves
			request.Request.prototype.init = patchedInit;
			debug('init done');
			return patchedInit.apply(self,args);
		}
231742
def pre_send(self, request_params):
        """"""
        for adapter in itervalues(self.adapters):
            adapter.max_retries = request_params.get('max_retries', 0)

        return request_params
1000915
def on_patch(resc, req, resp, rid):
    

    signals.pre_req.send(resc.model)
    signals.pre_req_update.send(resc.model)

    props = req.deserialize()
    model = find(resc.model, rid)

    from_rest(model, props)
    goldman.sess.store.update(model)

    props = to_rest_model(model, includes=req.includes)
    resp.last_modified = model.updated
    resp.serialize(props)

    signals.post_req.send(resc.model)
    signals.post_req_update.send(resc.model)
1279533
def doCommit(self, p: Prepare):
        
        key_3pc = (p.viewNo, p.ppSeqNo)
        self.logger.debug("{} Sending COMMIT{} at {}".format(self, key_3pc, self.get_current_time()))

        params = [
            self.instId, p.viewNo, p.ppSeqNo
        ]

        pre_prepare = self.getPrePrepare(*key_3pc)

        # BLS multi-sig:
        if p.stateRootHash is not None:
            pre_prepare = self.getPrePrepare(*key_3pc)
            params = self._bls_bft_replica.update_commit(params, pre_prepare)

        commit = Commit(*params)
        if self.isMaster:
            rv = self.execute_hook(ReplicaHooks.CREATE_CM, commit)
            commit = rv if rv is not None else commit

        self.send(commit, TPCStat.CommitSent)
        self.addToCommits(commit, self.name)
1206255
private void commitPrepared(Xid xid) throws XAException {
    try {
      // Check preconditions. The connection mustn't be used for another
      // other XA or local transaction, or the COMMIT PREPARED command
      // would mess it up.
      if (state != STATE_IDLE || conn.getTransaction().hasBufferedMutations()) {
        throw new CloudSpannerXAException(CloudSpannerXAException.TWO_PHASE_IDLE,
            Code.FAILED_PRECONDITION, XAException.XAER_RMERR);
      }

      String s = RecoveredXid.xidToString(xid);

      localAutoCommitMode = conn.getAutoCommit();
      conn.setAutoCommit(true);
      try {
        conn.commitPreparedTransaction(s);
      } finally {
        conn.setAutoCommit(localAutoCommitMode);
      }
    } catch (CloudSpannerSQLException ex) {
      throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_COMMIT_PREPARED, ex,
          XAException.XAER_RMERR);
    } catch (SQLException ex) {
      throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_COMMIT_PREPARED, ex,
          Code.UNKNOWN, XAException.XAER_RMERR);
    }
  }
1119683
def onBatchRejected(self, ledger_id):
        
        if ledger_id == POOL_LEDGER_ID:
            if isinstance(self.poolManager, TxnPoolManager):
                self.get_req_handler(POOL_LEDGER_ID).onBatchRejected()
        elif self.get_req_handler(ledger_id):
            self.get_req_handler(ledger_id).onBatchRejected()
        else:
            logger.debug('{} did not know how to handle for ledger {}'.format(self, ledger_id))

        self.audit_handler.post_batch_rejected(ledger_id)

        self.execute_hook(NodeHooks.POST_BATCH_REJECTED, ledger_id)
929223
function applyTransaction(history, state, tr, options) {
  let historyTr = tr.getMeta(historyKey), rebased
  if (historyTr) return historyTr.historyState

  if (tr.getMeta(closeHistoryKey)) history = new HistoryState(history.done, history.undone, null, 0)

  let appended = tr.getMeta("appendedTransaction")

  if (tr.steps.length == 0) {
    return history
  } else if (appended && appended.getMeta(historyKey)) {
    if (appended.getMeta(historyKey).redo)
      return new HistoryState(history.done.addTransform(tr, null, options, mustPreserveItems(state)),
                              history.undone, rangesFor(tr.mapping.maps[tr.steps.length - 1]), history.prevTime)
    else
      return new HistoryState(history.done, history.undone.addTransform(tr, null, options, mustPreserveItems(state)),
                              null, history.prevTime)
  } else if (tr.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
    // Group transforms that occur in quick succession into one event.
    let newGroup = history.prevTime < (tr.time || 0) - options.newGroupDelay ||
        !appended && !isAdjacentTo(tr, history.prevRanges)
    let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps[tr.steps.length - 1])
    return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : null,
                                                      options, mustPreserveItems(state)),
                            Branch.empty, prevRanges, tr.time)
  } else if (rebased = tr.getMeta("rebased")) {
    // Used by the collab module to tell the history that some of its
    // content has been rebased.
    return new HistoryState(history.done.rebased(tr, rebased),
                            history.undone.rebased(tr, rebased),
                            mapRanges(history.prevRanges, tr.mapping), history.prevTime)
  } else {
    return new HistoryState(history.done.addMaps(tr.mapping.maps),
                            history.undone.addMaps(tr.mapping.maps),
                            mapRanges(history.prevRanges, tr.mapping), history.prevTime)
  }
}
1156034
def dequeue_pre_prepares(self):
        
        ppsReady = []
        # Check if any requests have become finalised belonging to any stashed
        # PRE-PREPAREs.
        for i, (pp, sender, reqIds) in enumerate(
                self.prePreparesPendingFinReqs):
            finalised = set()
            for r in reqIds:
                if self.requests.is_finalised(r):
                    finalised.add(r)
            diff = reqIds.difference(finalised)
            # All requests become finalised
            if not diff:
                ppsReady.append(i)
            self.prePreparesPendingFinReqs[i] = (pp, sender, diff)

        for i in sorted(ppsReady, reverse=True):
            pp, sender, _ = self.prePreparesPendingFinReqs.pop(i)
            self.prePreparesPendingPrevPP[pp.viewNo, pp.ppSeqNo] = (pp, sender)

        r = 0
        while self.prePreparesPendingPrevPP and self.__is_next_pre_prepare(
                *self.prePreparesPendingPrevPP.iloc[0]):
            _, (pp, sender) = self.prePreparesPendingPrevPP.popitem(last=False)
            if not self.can_pp_seq_no_be_in_view(pp.viewNo, pp.ppSeqNo):
                self.discard(pp, "Pre-Prepare from a previous view",
                             self.logger.debug)
                continue
            self.logger.info("{} popping stashed PREPREPARE{} from sender {}".format(self, pp, sender))
            self.process_three_phase_msg(pp, sender)
            r += 1
        return r
664446
def prepare
      raise AlreadyPreparedError.new(@path) if prepared?
      in_work_tree :tmp do
        FileUtils.touch '.silo'
        @git.add '.silo'
        @git.commit_index 'Enabled Silo for this repository'
      end
    end
100463
def update_freshness(self, ledger_id, ts):
        '''
        
        '''
        if ledger_id in self._ledger_freshness:
            self._ledger_freshness[ledger_id].last_updated = ts
749536
function update (state) {
    assert.ifError(inRenderingTransaction, 'infinite loop detected')

    // request a redraw for next frame
    if (currentState === null && !redrawScheduled) {
      redrawScheduled = true

      raf(function redraw () {
        redrawScheduled = false
        if (!currentState) return

        inRenderingTransaction = true
        var newTree = view(currentState)
        const patches = vdom.diff(tree, newTree)
        inRenderingTransaction = false

        target = vdom.patch(target, patches)
        tree = newTree
        currentState = null
      })
    }

    // update data for redraw
    currentState = state
  }
1123627
def prepare_for_commit(*msgs)
      tp = Hash.new { |h, k| h[k] = Hash.new(0) }

      msgs.each do |msg|
        if msg.offset >= tp[msg.topic][msg.partition]
          tp[msg.topic][msg.partition] = msg.offset
        end
      end

      tp
    end
280640
def process_request(self, req, resp):
        

        goldman.sess.req = req

        if goldman.config.STORE:
            goldman.sess.store = goldman.config.STORE()
981949
function() {
    var bear = this;
    // don't bind until we're ready
    var srv = bear.ready.then( function() {
      var dfd = _.Deferred();
      // only make once
      if ( !bear.githInstance ) {
        bear.githInstance = bear.gith({
          repo: bear.settings.repo,
        }).on( 'all', bear._processPayload.bind( bear ) );
      }
      dfd.resolve( bear.githInstance );
      return dfd.promise();
    });

    return srv;
  }