parameters: (cls, diff_to_apply, thread_state=None)
docstring: Worker function for performing the actual copy and remove operations.
docstring_summary: Worker function for performing the actual copy and remove operations.
docstring_tokens: Worker function for performing the actual copy and remove operations .
function: def _RsyncFunc(cls, diff_to_apply, thread_state=None):
    """Worker function for performing the actual copy and remove operations."""
    gsutil_api = GetCloudApiInstance(cls, thread_state=thread_state)
    dst_url_str = diff_to_apply.dst_url_str
    dst_url = StorageUrlFromString(dst_url_str)
    if diff_to_apply.diff_action == _DiffAction.REMOVE:
      if cls.dryrun:
        cls.logger.info('Would remove %s', dst_url)
      else:
        cls.logger.info('Removing %s', dst_url)
        if dst_url.IsFileUrl():
          os.unlink(dst_url.object_name)
        else:
          try:
            gsutil_api.DeleteObject(
                dst_url.bucket_name, dst_url.object_name,
                generation=dst_url.generation, provider=dst_url.scheme)
          except NotFoundException:
            # If the object happened to be deleted by an external process, this
            # is fine because it moves us closer to the desired state.
            pass
    elif diff_to_apply.diff_action == _DiffAction.COPY:
      src_url_str = diff_to_apply.src_url_str
      src_url = StorageUrlFromString(src_url_str)
      if cls.dryrun:
        cls.logger.info('Would copy %s to %s', src_url, dst_url)
      else:
        try:
          copy_helper.PerformCopy(cls.logger, src_url, dst_url, gsutil_api, cls,
                                  _RsyncExceptionHandler,
                                  headers=cls.headers)
        except SkipUnsupportedObjectError, e:
          cls.logger.info('Skipping item %s with unsupported object type %s',
                          src_url, e.unsupported_type)
  
    else:
      raise CommandException('Got unexpected DiffAction (%d)'
                             % diff_to_apply.diff_action)
function_tokens: def _RsyncFunc ( cls , diff_to_apply , thread_state = None ) : gsutil_api = GetCloudApiInstance ( cls , thread_state = thread_state ) dst_url_str = diff_to_apply . dst_url_str dst_url = StorageUrlFromString ( dst_url_str ) if diff_to_apply . diff_action == _DiffAction . REMOVE : if cls . dryrun : cls . logger . info ( 'Would remove %s' , dst_url ) else : cls . logger . info ( 'Removing %s' , dst_url ) if dst_url . IsFileUrl ( ) : os . unlink ( dst_url . object_name ) else : try : gsutil_api . DeleteObject ( dst_url . bucket_name , dst_url . object_name , generation = dst_url . generation , provider = dst_url . scheme ) except NotFoundException : # If the object happened to be deleted by an external process, this # is fine because it moves us closer to the desired state. pass elif diff_to_apply . diff_action == _DiffAction . COPY : src_url_str = diff_to_apply . src_url_str src_url = StorageUrlFromString ( src_url_str ) if cls . dryrun : cls . logger . info ( 'Would copy %s to %s' , src_url , dst_url ) else : try : copy_helper . PerformCopy ( cls . logger , src_url , dst_url , gsutil_api , cls , _RsyncExceptionHandler , headers = cls . headers ) except SkipUnsupportedObjectError , e : cls . logger . info ( 'Skipping item %s with unsupported object type %s' , src_url , e . unsupported_type ) else : raise CommandException ( 'Got unexpected DiffAction (%d)' % diff_to_apply . diff_action )