Create a unique transfer operation id
        :param blobxfer.models.azure.StorageEntity src_ase: src storage entity
        :param blobxfer.models.azure.StorageEntity dst_ase: dst storage entity
        :rtype: str
        :return: unique transfer id
180045
def create_unique_transfer_operation_id(src_ase, dst_ase):
        # type: (blobxfer.models.azure.StorageEntity,
        #        blobxfer.models.azure.StorageEntity) -> str
        
        return ';'.join(
            (src_ase._client.primary_endpoint, src_ase.path,
             dst_ase._client.primary_endpoint, dst_ase.path)
        )
1050047
public <T extends IEntity> void addEntity(T entity, OperationEnum operation, String bId) {
		
		BatchItemRequest batchItemRequest = new BatchItemRequest();
		batchItemRequest.setBId(bId);
		batchItemRequest.setOperation(operation);
		batchItemRequest.setIntuitObject(getIntuitObject(entity));
		
		batchItemRequests.add(batchItemRequest);
		bIds.add(bId);
	}
488407
def add_storage_account(self, name, key, endpoint):
        # type: (StorageCredentials, str, str, str) -> None
        
        if name in self._storage_accounts:
            raise ValueError(
                '{} already exists in storage accounts'.format(name))
        self._storage_accounts[name] = StorageAccount(
            name, key, endpoint,
            self._general_options.concurrency.transfer_threads,
            self._general_options.timeout,
            self._general_options.proxy,
        )
385456
def _finalize_nonblock_blob(self, sd, metadata, digest):
        # type: (SyncCopy, blobxfer.models.synccopy.Descriptor, dict,
        #        str) -> None
        
        # set md5 page blob property if required
        if (blobxfer.util.is_not_empty(digest) or
                sd.dst_entity.cache_control is not None):
            self._set_blob_properties(sd, digest)
        # set metadata if needed
        if blobxfer.util.is_not_empty(metadata):
            self._set_blob_metadata(sd, metadata)
1114460
def write_ase(atoms, db_file, stdout=sys.stdout, user=None, data=None, **key_value_pairs):
    """"""
    db_ase = ase.db.connect(db_file)
    _normalize_key_value_pairs_inplace(key_value_pairs)
    id = db_ase.write(atoms, data=data, **key_value_pairs)
    stdout.write('  writing atoms to ASE db row id = {}\n'.format(id))
    unique_id = db_ase.get(id)['unique_id']
    return unique_id
1232293
def create_vectored_io_next_entry(ase):
    # type: (blobxfer.models.azure.StorageEntity) -> str
    
    return ';'.join(
        (ase.client.primary_endpoint, ase.container, ase.name)
    )
657429
def create_file(ase, timeout=None):
    # type: (blobxfer.models.azure.StorageEntity, int) -> None
    
    dir, fpath, _ = parse_file_path(ase.name)
    ase.client.create_file(
        share_name=ase.container,
        directory_name=dir,
        file_name=fpath,
        content_length=ase.size,
        content_settings=azure.storage.file.models.ContentSettings(
            content_type=blobxfer.util.get_mime_type(fpath)
        ),
        timeout=timeout)
746313
def create_unique_disk_operation_id(dd, offsets):
        # type: (blobxfer.models.download.Descriptor,
        #        blobxfer.models.download.Offsets) -> str
        
        return ';'.join(
            (str(dd.final_path), dd.entity._client.primary_endpoint,
             dd.entity.path, str(offsets.range_start))
        )
35513
def set_file_metadata(ase, metadata, timeout=None):
    # type: (blobxfer.models.azure.StorageEntity, dict, int) -> None
    
    dir, fpath, _ = parse_file_path(ase.name)
    ase.client.set_file_metadata(
        share_name=ase.container,
        directory_name=dir,
        file_name=fpath,
        metadata=metadata,
        timeout=timeout)
848881
def _generate_destination_for_source(self, local_path):
        # type: (Uploader, blobxfer.models.upload.LocalSourcePath) ->
        #        Tuple[blobxfer.operations.azure.StorageAccount,
        #        blobxfer.models.azure.StorageEntity)
        
        # construct stripped destination path
        spath = local_path.relative_path
        # apply strip components
        if self._spec.options.strip_components > 0:
            _rparts = local_path.relative_path.parts
            _strip = min(
                (len(_rparts) - 1, self._spec.options.strip_components)
            )
            if _strip > 0:
                spath = pathlib.Path(*_rparts[_strip:])
        # create a storage entity for each destination
        for sa, cont, name, dpath in self._get_destination_paths():
            # if not renaming, form name from with spath
            if not self._spec.options.rename and not local_path.use_stdin:
                name = str(name / spath)
            if blobxfer.util.is_none_or_empty(name):
                raise ValueError(
                    ('invalid destination, must specify a container or '
                     'fileshare and remote file name: {}').format(dpath))
            # do not check for existing remote right now if striped
            # vectored io mode
            if (self._spec.options.vectored_io.distribution_mode ==
                    blobxfer.models.upload.
                    VectoredIoDistributionMode.Stripe):
                ase = None
            else:
                if sa.can_read_object:
                    ase = self._check_for_existing_remote(sa, cont, name)
                else:
                    ase = None
            if ase is None:
                # encryption metadata will be populated later, if required
                ase = blobxfer.models.azure.StorageEntity(cont, ed=None)
                ase.populate_from_local(
                    sa, cont, name, self._spec.options.mode,
                    self._spec.options.store_file_properties.cache_control)
                if ase.mode == blobxfer.models.azure.StorageModes.Block:
                    ase.access_tier = self._spec.options.access_tier
            yield sa, ase
211248
def avglosses_data_transfer(token, dstore):
    
    oq = dstore['oqparam']
    N = len(dstore['assetcol'])
    R = dstore['csm_info'].get_num_rlzs()
    L = len(dstore.get_attr('risk_model', 'loss_types'))
    ct = oq.concurrent_tasks
    size_bytes = N * R * L * 8 * ct  # 8 byte floats
    return (
        '%d asset(s) x %d realization(s) x %d loss type(s) losses x '
        '8 bytes x %d tasks = %s' % (N, R, L, ct, humansize(size_bytes)))
844814
def create(self):
        
        if not self.can_create():
            self._tcex.handle_error(905, [self.type])

        response = self.tc_requests.create(self.api_type, self.api_sub_type, self._data, self.owner)

        if self.tc_requests.success(response):
            self._set_unique_id(response.json().get('data').get(self.api_entity))

        return response
747840
def generate_view(ase):
        # type: (blobxfer.models.azure.StorageEntity) ->
        #       Tuple[LocalPathView, int]
        
        slicesize = blobxfer.models.download.Descriptor.compute_allocated_size(
            ase.size, ase.is_encrypted)
        if ase.vectored_io is None:
            view = LocalPathView(
                fd_start=0,
                fd_end=slicesize,
            )
            total_size = slicesize
        else:
            view = LocalPathView(
                fd_start=ase.vectored_io.offset_start,
                fd_end=ase.vectored_io.offset_start + slicesize,
            )
            total_size = ase.vectored_io.total_size
        return view, total_size
1301455
def certs(self, entity_id, descriptor, use="signing"):
        '''
        
        '''
        ent = self[entity_id]

        def extract_certs(srvs):
            res = []
            for srv in srvs:
                if "key_descriptor" in srv:
                    for key in srv["key_descriptor"]:
                        if "use" in key and key["use"] == use:
                            for dat in key["key_info"]["x509_data"]:
                                cert = repack_cert(
                                    dat["x509_certificate"]["text"])
                                if cert not in res:
                                    res.append(cert)
                        elif not "use" in key:
                            for dat in key["key_info"]["x509_data"]:
                                cert = repack_cert(
                                    dat["x509_certificate"]["text"])
                                if cert not in res:
                                    res.append(cert)

            return res

        if descriptor == "any":
            res = []
            for descr in ["spsso", "idpsso", "role", "authn_authority",
                          "attribute_authority", "pdp"]:
                try:
                    srvs = ent["%s_descriptor" % descr]
                except KeyError:
                    continue

                res.extend(extract_certs(srvs))
        else:
            srvs = ent["%s_descriptor" % descriptor]
            res = extract_certs(srvs)

        return res
807694
def take_snapshot(self, entity_id, entity, last_event_version):
        

        # Create the snapshot.
        snapshot = Snapshot(
            originator_id=entity_id,
            originator_version=last_event_version,
            topic=get_topic(entity.__class__),
            state=None if entity is None else deepcopy(entity.__dict__)
        )

        self.snapshot_store.store(snapshot)

        # Return the snapshot.
        return snapshot
867793
def _finalize_upload(self, sd):
        # type: (SyncCopy, blobxfer.models.synccopy.Descriptor) -> None
        
        metadata = sd.src_entity.raw_metadata
        if blobxfer.util.is_not_empty(sd.src_entity.md5):
            digest = sd.src_entity.md5
        else:
            digest = None
        if sd.requires_put_block_list:
            # put block list for non one-shot block blobs
            self._finalize_block_blob(sd, metadata, digest)
        elif sd.remote_is_page_blob or sd.remote_is_append_blob:
            # append and page blob finalization
            self._finalize_nonblock_blob(sd, metadata, digest)
        elif sd.remote_is_file:
            # azure file finalization
            self._finalize_azure_file(sd, metadata, digest)
        # set access tier
        if sd.requires_access_tier_set:
            blobxfer.operations.azure.blob.block.set_blob_access_tier(
                sd.dst_entity)
1089589
protected void transfer(final WritableDataStore<Meta> metas, Meta meta, ModifiableDBIDs src, ModifiableDBIDs dst, DBIDRef id, int dstnum) {
    src.remove(id);
    dst.add(id);
    meta.primary = dstnum;
    metas.put(id, meta); // Make sure the storage is up to date.
  }