当前位置: 首页>>代码示例>>Python>>正文


Python utils.csv_append函数代码示例

本文整理汇总了Python中swift.common.utils.csv_append函数的典型用法代码示例。如果您正苦于以下问题:Python csv_append函数的具体用法?Python csv_append怎么用?Python csv_append使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了csv_append函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _backend_requests

    def _backend_requests(self, req, n_outgoing,
                          container_partition, containers,
                          delete_at_partition=None, delete_at_nodes=None):
        headers = [dict(req.headers.iteritems())
                   for _junk in range(n_outgoing)]

        for header in headers:
            header['Connection'] = 'close'

        for i, container in enumerate(containers):
            i = i % len(headers)

            headers[i]['X-Container-Partition'] = container_partition
            headers[i]['X-Container-Host'] = csv_append(
                headers[i].get('X-Container-Host'),
                '%(ip)s:%(port)s' % container)
            headers[i]['X-Container-Device'] = csv_append(
                headers[i].get('X-Container-Device'),
                container['device'])

        for i, node in enumerate(delete_at_nodes or []):
            i = i % len(headers)

            headers[i]['X-Delete-At-Partition'] = delete_at_partition
            headers[i]['X-Delete-At-Host'] = csv_append(
                headers[i].get('X-Delete-At-Host'),
                '%(ip)s:%(port)s' % node)
            headers[i]['X-Delete-At-Device'] = csv_append(
                headers[i].get('X-Delete-At-Device'),
                node['device'])

        return headers
开发者ID:saebyuk,项目名称:swift,代码行数:32,代码来源:obj.py

示例2: _sof_container_update

    def _sof_container_update(self, request, resp):
        """
        SOF specific metadata is set in DiskFile.open()._filter_metadata()
        This method internally invokes Swift's container_update() method.
        """
        device, partition, account, container, obj, policy_idx = \
            get_name_and_placement(request, 5, 5, True)

        # The container_update() method requires certain container
        # specific headers. The proxy object controller appends these
        # headers for PUT backend request but not for HEAD/GET requests.
        # Thus, we populate the required information in request
        # and then invoke container_update()
        container_partition, container_nodes = \
            self.get_container_ring().get_nodes(account, container)
        request.headers['X-Container-Partition'] = container_partition
        for node in container_nodes:
            request.headers['X-Container-Host'] = csv_append(
                request.headers.get('X-Container-Host'),
                '%(ip)s:%(port)s' % node)
            request.headers['X-Container-Device'] = csv_append(
                request.headers.get('X-Container-Device'), node['device'])

        self.container_update(
            'PUT', account, container, obj, request,
            HeaderKeyDict({
                'x-size': resp.headers['Content-Length'],
                'x-content-type': resp.headers['Content-Type'],
                'x-timestamp': resp.headers['X-Timestamp'],
                'x-etag': resp.headers['ETag']}),
            device, policy_idx)
开发者ID:hpss-collaboration,项目名称:swiftonhpss,代码行数:31,代码来源:server.py

示例3: _backend_requests

    def _backend_requests(self, req, n_outgoing,
                          container_partition, containers,
                          delete_at_container=None, delete_at_partition=None,
                          delete_at_nodes=None):
        headers = [self.generate_request_headers(req, additional=req.headers)
                   for _junk in range(n_outgoing)]

        for i, container in enumerate(containers):
            i = i % len(headers)

            headers[i]['X-Container-Partition'] = container_partition
            headers[i]['X-Container-Host'] = csv_append(
                headers[i].get('X-Container-Host'),
                '%(ip)s:%(port)s' % container)
            headers[i]['X-Container-Device'] = csv_append(
                headers[i].get('X-Container-Device'),
                container['device'])

        for i, node in enumerate(delete_at_nodes or []):
            i = i % len(headers)

            headers[i]['X-Delete-At-Container'] = delete_at_container
            headers[i]['X-Delete-At-Partition'] = delete_at_partition
            headers[i]['X-Delete-At-Host'] = csv_append(
                headers[i].get('X-Delete-At-Host'),
                '%(ip)s:%(port)s' % node)
            headers[i]['X-Delete-At-Device'] = csv_append(
                headers[i].get('X-Delete-At-Device'),
                node['device'])

        return headers
开发者ID:dpgoetz,项目名称:swift,代码行数:31,代码来源:obj.py

示例4: _backend_requests

    def _backend_requests(
        self,
        req,
        n_outgoing,
        container_partition,
        containers,
        delete_at_container=None,
        delete_at_partition=None,
        delete_at_nodes=None,
    ):
        headers = [self.generate_request_headers(req, additional=req.headers) for _junk in range(n_outgoing)]

        for header in headers:
            header["Connection"] = "close"

        for i, container in enumerate(containers):
            i = i % len(headers)

            headers[i]["X-Container-Partition"] = container_partition
            headers[i]["X-Container-Host"] = csv_append(
                headers[i].get("X-Container-Host"), "%(ip)s:%(port)s" % container
            )
            headers[i]["X-Container-Device"] = csv_append(headers[i].get("X-Container-Device"), container["device"])

        for i, node in enumerate(delete_at_nodes or []):
            i = i % len(headers)

            headers[i]["X-Delete-At-Container"] = delete_at_container
            headers[i]["X-Delete-At-Partition"] = delete_at_partition
            headers[i]["X-Delete-At-Host"] = csv_append(headers[i].get("X-Delete-At-Host"), "%(ip)s:%(port)s" % node)
            headers[i]["X-Delete-At-Device"] = csv_append(headers[i].get("X-Delete-At-Device"), node["device"])

        return headers
开发者ID:krishna-kashyap,项目名称:swift,代码行数:33,代码来源:obj.py

示例5: _backend_requests

    def _backend_requests(self, req, n_outgoing, account_partition, accounts):
        headers = [self.generate_request_headers(req, transfer=True) for _junk in range(n_outgoing)]

        for i, account in enumerate(accounts):
            i = i % len(headers)

            headers[i]["X-Account-Partition"] = account_partition
            headers[i]["X-Account-Host"] = csv_append(headers[i].get("X-Account-Host"), "%(ip)s:%(port)s" % account)
            headers[i]["X-Account-Device"] = csv_append(headers[i].get("X-Account-Device"), account["device"])

        return headers
开发者ID:zaitcev,项目名称:swift-lfs,代码行数:11,代码来源:container.py

示例6: _backend_requests

    def _backend_requests(self, req, n_outgoing, account_partition, accounts, policy_index=None):
        additional = {"X-Timestamp": Timestamp(time.time()).internal}
        if policy_index is None:
            additional["X-Backend-Storage-Policy-Default"] = int(POLICIES.default)
        else:
            additional["X-Backend-Storage-Policy-Index"] = str(policy_index)
        headers = [
            self.generate_request_headers(req, transfer=True, additional=additional) for _junk in range(n_outgoing)
        ]

        for i, account in enumerate(accounts):
            i = i % len(headers)

            headers[i]["X-Account-Partition"] = account_partition
            headers[i]["X-Account-Host"] = csv_append(headers[i].get("X-Account-Host"), "%(ip)s:%(port)s" % account)
            headers[i]["X-Account-Device"] = csv_append(headers[i].get("X-Account-Device"), account["device"])

        return headers
开发者ID:iloveyou416068,项目名称:swift-1,代码行数:18,代码来源:container.py

示例7: _backend_requests

    def _backend_requests(self, req, n_outgoing,
                          account_partition, accounts):
        additional = {'X-Timestamp': normalize_timestamp(time.time())}
        headers = [self.generate_request_headers(req, transfer=True,
                                                 additional=additional)
                   for _junk in range(n_outgoing)]

        for i, account in enumerate(accounts):
            i = i % len(headers)

            headers[i]['X-Account-Partition'] = account_partition
            headers[i]['X-Account-Host'] = csv_append(
                headers[i].get('X-Account-Host'),
                '%(ip)s:%(port)s' % account)
            headers[i]['X-Account-Device'] = csv_append(
                headers[i].get('X-Account-Device'),
                account['device'])

        return headers
开发者ID:HoO-Group,项目名称:swift,代码行数:19,代码来源:container.py

示例8: _backend_requests

    def _backend_requests(self, req, n_outgoing,
                          account_partition, accounts):
        headers = [{'Connection': 'close',
                    'X-Timestamp': normalize_timestamp(time.time()),
                    'x-trans-id': self.trans_id}
                   for _junk in range(n_outgoing)]

        for header in headers:
            self.transfer_headers(req.headers, header)

        for i, account in enumerate(accounts):
            i = i % len(headers)

            headers[i]['X-Account-Partition'] = account_partition
            headers[i]['X-Account-Host'] = csv_append(
                headers[i].get('X-Account-Host'),
                '%(ip)s:%(port)s' % account)
            headers[i]['X-Account-Device'] = csv_append(
                headers[i].get('X-Account-Device'),
                account['device'])

        return headers
开发者ID:Neil-Jubinville,项目名称:swift,代码行数:22,代码来源:container.py

示例9: _backend_requests

    def _backend_requests(self, req, n_outgoing, account_partition, accounts,
                          policy_index=None):
        additional = {'X-Timestamp': Timestamp.now().internal}
        if policy_index is None:
            additional['X-Backend-Storage-Policy-Default'] = \
                int(POLICIES.default)
        else:
            additional['X-Backend-Storage-Policy-Index'] = str(policy_index)
        headers = [self.generate_request_headers(req, transfer=True,
                                                 additional=additional)
                   for _junk in range(n_outgoing)]

        for i, account in enumerate(accounts):
            i = i % len(headers)

            headers[i]['X-Account-Partition'] = account_partition
            headers[i]['X-Account-Host'] = csv_append(
                headers[i].get('X-Account-Host'),
                '%(ip)s:%(port)s' % account)
            headers[i]['X-Account-Device'] = csv_append(
                headers[i].get('X-Account-Device'),
                account['device'])

        return headers
开发者ID:openstack,项目名称:swift,代码行数:24,代码来源:container.py

示例10: update_etag_is_at_header

def update_etag_is_at_header(req, name):
    """
    Helper function to update an X-Backend-Etag-Is-At header whose value is a
    list of alternative header names at which the actual object etag may be
    found. This informs the object server where to look for the actual object
    etag when processing conditional requests.

    Since the proxy server and/or middleware may set alternative etag header
    names, the value of X-Backend-Etag-Is-At is a comma separated list which
    the object server inspects in order until it finds an etag value.

    :param req: a swob Request
    :param name: name of a sysmeta where alternative etag may be found
    """
    if "," in name:
        # HTTP header names should not have commas but we'll check anyway
        raise ValueError("Header name must not contain commas")
    existing = req.headers.get("X-Backend-Etag-Is-At")
    req.headers["X-Backend-Etag-Is-At"] = csv_append(existing, name)
开发者ID:prashanthpai,项目名称:swift,代码行数:19,代码来源:request_helpers.py


注:本文中的swift.common.utils.csv_append函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。