Send a synchronization response to the caller replica containing the replication operations to be executed
970048
private void sendResponse(Collection<Operation> operations, ServiceNamespace ns) {
        NodeEngine nodeEngine = getNodeEngine();

        PartitionReplicaSyncResponse syncResponse = createResponse(operations, ns);
        Address target = getCallerAddress();
        ILogger logger = getLogger();
        if (logger.isFinestEnabled()) {
            logger.finest("Sending sync response to -> " + target + " for partitionId="
                    + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + ns);
        }

        // PartitionReplicaSyncResponse is TargetAware and sent directly without invocation system.
        syncResponse.setTarget(target);

        OperationService operationService = nodeEngine.getOperationService();
        operationService.send(syncResponse, target);
    }
923097
protected void handleAppendResponseOk(MemberState member, AppendRequest request, AppendResponse response) {
    // Reset the member failure count and update the member's availability status if necessary.
    succeedAttempt(member);

    // If replication succeeded then trigger commit futures.
    if (response.succeeded()) {
      updateMatchIndex(member, response);

      // If there are more entries to send then attempt to send another commit.
      if (request.logIndex() != response.logIndex() && hasMoreEntries(member)) {
        appendEntries(member);
      }
    }
    // If we've received a greater term, update the term and transition back to follower.
    else if (response.term() > context.getTerm()) {
      context.setTerm(response.term()).setLeader(0);
      context.transition(CopycatServer.State.FOLLOWER);
    }
    // If the response failed, the follower should have provided the correct last index in their log. This helps
    // us converge on the matchIndex faster than by simply decrementing nextIndex one index at a time.
    else {
      resetMatchIndex(member, response);
      resetNextIndex(member);

      // If there are more entries to send then attempt to send another commit.
      if (response.logIndex() != request.logIndex() && hasMoreEntries(member)) {
        appendEntries(member);
      }
    }
  }
806597
protected void handleAppendResponseOk(RaftMemberContext member, AppendRequest request, AppendResponse response) {
    // Reset the member failure count and update the member's availability status if necessary.
    succeedAttempt(member);

    // If replication succeeded then trigger commit futures.
    if (response.succeeded()) {
      updateMatchIndex(member, response);

      // If there are more entries to send then attempt to send another commit.
      if (request.prevLogIndex() != response.lastLogIndex() && hasMoreEntries(member)) {
        appendEntries(member);
      }
    }
    // If we've received a greater term, update the term and transition back to follower.
    else if (response.term() > raft.getTerm()) {
      raft.setTerm(response.term());
      raft.setLeader(null);
      raft.transition(RaftServer.Role.FOLLOWER);
    }
    // If the response failed, the follower should have provided the correct last index in their log. This helps
    // us converge on the matchIndex faster than by simply decrementing nextIndex one index at a time.
    else {
      resetMatchIndex(member, response);
      resetNextIndex(member, response);

      // If there are more entries to send then attempt to send another commit.
      if (response.lastLogIndex() != request.prevLogIndex() && hasMoreEntries(member)) {
        appendEntries(member);
      }
    }
  }
1017892
def sync_events(sync_m, *args)
      if args[0].is_a?(PredictionIO::AsyncResponse)
        response = args[0].get
      else
        response = send(sync_m, *args).get
      end
      return JSON.parse(response.body) if response.is_a?(Net::HTTPOK)
      begin
        msg = response.body
      rescue
        raise response
      end
      if response.is_a?(Net::HTTPBadRequest)
        fail BadRequestError, msg
      elsif response.is_a?(Net::HTTPNotFound)
        fail NotFoundError, msg
      elsif response.is_a?(Net::HTTPServerError)
        fail ServerError, msg
      else
        fail msg
      end
    end
669194
def cluster_replicate(self, node_id):
        """"""
        fut = self.execute(b'CLUSTER', b'REPLICATE', node_id)
        return wait_ok(fut)
1045824
def do_numberrep(self, line):
        """"""
        n_replicas = self._split_args(line, 1, 0)[0]
        self._command_processor.get_session().get_replication_policy().set_number_of_replicas(
            n_replicas
        )
        self._print_info_if_verbose("Set number of replicas to {}".format(n_replicas))
507970
void sendAsync(final RunningTask reefTask, final MasterToWorkerRequest masterToWorkerRequest) {
    executorService.execute(new Runnable() {
      @Override
      public void run() {
        //  Possible race condition with VortexWorkerManager#terminate is addressed by the global lock in VortexMaster
        send(reefTask, masterToWorkerRequest);
      }
    });
  }
185244
def send(self, request, pk=None):
        
        schedule = self.get_object()
        queue_subscription_send.delay(str(schedule.id))

        return Response({}, status=status.HTTP_202_ACCEPTED)
703061
function sync() {
    syncDom.setAttribute('data-sync-state', 'syncing');
    var opts = {continuous: true, complete: syncError};
    db.replicate.to(remoteCouch, opts);
    db.replicate.from(remoteCouch, opts);
  }
633893
void awaitResponses() {
        try {
            boolean finishedNicely = responseFinished.await(WAIT_TIMEOUT_MILISECONDS, TimeUnit.MILLISECONDS);
            if (!finishedNicely) {
                throw new WarpSynchronizationException(WarpContextStore.get());
            }
        } catch (InterruptedException e) {
        }
    }
1363229
def _run(self):
        # type: (SyncCopy) -> None
        
        # mark start
        self._start_time = blobxfer.util.datetime_now()
        logger.info('blobxfer start time: {0}'.format(self._start_time))
        # initialize resume db if specified
        if self._general_options.resume_file is not None:
            self._resume = blobxfer.operations.resume.SyncCopyResumeManager(
                self._general_options.resume_file)
        # initialize download threads
        self._initialize_transfer_threads()
        # iterate through source paths to download
        processed_files = 0
        for src_ase, dst_ase in self._bind_sources_to_destination():
            processed_files += 1
            if self._general_options.dry_run:
                logger.info('[DRY RUN] synccopy: {} -> {}'.format(
                    src_ase.path, dst_ase.path))
            else:
                # add transfer to set
                with self._transfer_lock:
                    self._transfer_set.add(
                        blobxfer.operations.synccopy.SyncCopy.
                        create_unique_transfer_operation_id(src_ase, dst_ase))
                    self._synccopy_total += 1
                    self._synccopy_bytes_total += src_ase.size
                    if blobxfer.util.is_not_empty(dst_ase.replica_targets):
                        self._synccopy_bytes_total += (
                            len(dst_ase.replica_targets) * src_ase.size
                        )
                self._add_to_transfer_queue(src_ase, dst_ase)
        # set remote files processed
        with self._transfer_lock:
            self._all_remote_files_processed = True
            synccopy_size_mib = (
                self._synccopy_bytes_total / blobxfer.util.MEGABYTE
            )
            logger.debug(
                ('{0} remote files to sync, waiting for copy '
                 'completion of approx. {1:.4f} MiB').format(
                     processed_files, synccopy_size_mib))
        del processed_files
        # wait for downloads to complete
        self._wait_for_transfer_threads(terminate=False)
        end_time = blobxfer.util.datetime_now()
        # update progress bar
        self._update_progress_bar()
        # check for exceptions
        if len(self._exceptions) > 0:
            logger.error('exceptions encountered while downloading')
            # raise the first one
            raise self._exceptions[0]
        # check for mismatches
        if (self._synccopy_sofar != self._synccopy_total or
                self._synccopy_bytes_sofar != self._synccopy_bytes_total):
            raise RuntimeError(
                'copy mismatch: [count={}/{} bytes={}/{}]'.format(
                    self._synccopy_sofar, self._synccopy_total,
                    self._synccopy_bytes_sofar, self._synccopy_bytes_total))
        # delete all remaining local files not accounted for if
        # delete extraneous enabled
        self._delete_extraneous_files()
        # delete resume file if we've gotten this far
        if self._resume is not None:
            self._resume.delete()
        # output throughput
        if self._synccopy_start_time is not None:
            dltime = (end_time - self._synccopy_start_time).total_seconds()
            synccopy_size_mib = (
                (self._synccopy_bytes_total << 1) / blobxfer.util.MEGABYTE
            )
            dlmibspeed = synccopy_size_mib / dltime
            logger.info(
                ('elapsed copy time and throughput of {0:.4f} '
                 'GiB: {1:.3f} sec, {2:.4f} Mbps ({3:.3f} MiB/sec)').format(
                     synccopy_size_mib / 1024, dltime, dlmibspeed * 8,
                     dlmibspeed))
        end_time = blobxfer.util.datetime_now()
        logger.info('blobxfer end time: {0} (elapsed: {1:.3f} sec)'.format(
            end_time, (end_time - self._start_time).total_seconds()))
1172011
function ({ throttle = 5000, live }) {
      var stream = PullPushAbort()

      var lastResolvedValues = {}

      var timer = null
      var queued = false
      var sync = false

      var update = () => {
        // clear queue
        clearTimeout(timer)
        queued = false

        // get latest replication state (merge together values)
        var resolvedValues = resolveValues(values, ssb.id)

        // push changes since last update
        stream.push(objectDiff(lastResolvedValues, resolvedValues))

        // update internal de-dupe list
        lastResolvedValues = resolvedValues
      }

      pull(
        view.stream({ live }),
        stream.aborter,
        pull.drain((msg) => {
          if (stream.ended) return

          if (!sync) {
            // we'll store the incoming values (they will be updated as the view updates so
            // do not need to be manually patched)
            sync = true
            update()

            // if not live, we can close stream
            if (!live) stream.end()
          } else if (msg) {
            if (!queued) {
              queued = true
              timer = setTimeout(update, throttle)
            }
          }
        }, (err) => {
          if (err) return stream.end(err)
        })
      )

      return stream
    }
884664
protected void execute() {
        Log.v(Log.TAG_SYNC, "%s: RemoteRequest execute() called, url: %s", this, url);
        executeRequest(factory.getOkHttpClient(), request());
        Log.v(Log.TAG_SYNC, "%s: RemoteRequest execute() finished, url: %s", this, url);
    }
350650
private <T extends IGPSObject> T syncCommand(final String command, final Class<T> responseClass) throws IOException {
		synchronized (this.asyncMutex) {
			if (out != null) {
				this.out.write(command + "\n");
				this.out.flush();
			}
			if (responseClass == WatchObject.class) {
				lastWatch = command;
			}
			while (true) {
				// wait for awaited message
				// FIXME possible infinite loop if expected result arrives but new result overrides expected result before getting to this point.
				final IGPSObject result = this.waitForResult();
				if ((result == null) || result.getClass().equals(responseClass)) {
					return responseClass.cast(result);
				}
			}
		}
	}
757967
def execute(self, ignore_cache=False):
        
        if ignore_cache or not hasattr(self, '_response'):
            es = connections.get_connection(self._using)

            self._response = self._response_class(
                self,
                es.search(
                    index=self._index,
                    body=self.to_dict(),
                    **self._params
                )
            )
        return self._response
959352
def sendmail_sync(
        self,
        sender: str,
        recipients: RecipientsType,
        message: Union[str, bytes],
        mail_options: Iterable[str] = None,
        rcpt_options: Iterable[str] = None,
        timeout: DefaultNumType = _default,
    ) -> SendmailResponseType:
        
        return self._run_sync(
            self.sendmail,
            sender,
            recipients,
            message,
            mail_options=mail_options,
            rcpt_options=rcpt_options,
            timeout=timeout,
        )
1066253
private <T, S extends ISyncableData> void doSync(T caller, String... syncNames)
	{
		@SuppressWarnings("unchecked")
		ISyncHandler<T, S> handler = (ISyncHandler<T, S>) getHandler(caller);
		if (handler == null)
			return;

		S data = handler.getSyncData(caller);
		int indexes = getFieldIndexes(handler, syncNames);
		Map<String, Object> values = getFieldValues(caller, handler, syncNames);

		SyncerMessage.Packet<T, S> packet = new Packet<>(getHandlerId(caller.getClass()), data, indexes, values);

		handler.send(caller, packet);
	}