swift/proxy/controllers/obj.py
def _get_put_connections(self, req, nodes, partition, outgoing_headers,
                             policy):
        """
        Establish connections to storage nodes for PUT request
        """
        obj_ring = policy.object_ring
        node_iter = GreenthreadSafeIterator(
            self.iter_nodes_local_first(obj_ring, partition, policy=policy))

        # 该对象是一个可以向其中填充工作的迭代器，便于以后从其中读取结果
        pile = GreenPile(len(nodes))

        for nheaders in outgoing_headers:
            # RFC2616:8.2.3 disallows 100-continue without a body,
            # so switch to chunked request
            if nheaders.get('Content-Length') == '0':
                nheaders['Transfer-Encoding'] = 'chunked'
                del nheaders['Content-Length']
            nheaders['Expect'] = '100-continue'
            pile.spawn(self._connect_put_node, node_iter, partition,
                       req, nheaders, self.app.logger.thread_locals)
        # 从给定的 list中选择出满足if条件的元素组成新的 list
        # 从 pile 中选择不为空的 putter 组成 putters
        putters = [putter for putter in pile if putter]

        return putters

        Establish connections to storage nodes for PUT request
        
Establish connections to storage nodes for PUT request
Establish connections to storage nodes for PUT request
def _get_put_connections(self, req, nodes, partition, outgoing_headers,
                             policy):
        obj_ring = policy.object_ring
        node_iter = GreenthreadSafeIterator(
            self.iter_nodes_local_first(obj_ring, partition, policy=policy))
        pile = GreenPile(len(nodes))
        for nheaders in outgoing_headers:
            if nheaders.get('Content-Length') == '0':
                nheaders['Transfer-Encoding'] = 'chunked'
                del nheaders['Content-Length']
            nheaders['Expect'] = '100-continue'
            pile.spawn(self._connect_put_node, node_iter, partition,
                       req, nheaders, self.app.logger.thread_locals)
        putters = [putter for putter in pile if putter]
        return putters
def _get_put_connections ( self , req , nodes , partition , outgoing_headers , policy ) : obj_ring = policy . object_ring node_iter = GreenthreadSafeIterator ( self . iter_nodes_local_first ( obj_ring , partition , policy = policy ) ) pile = GreenPile ( len ( nodes ) ) for nheaders in outgoing_headers : if nheaders . get ( 'Content-Length' ) == '0' : nheaders [ 'Transfer-Encoding' ] = 'chunked' del nheaders [ 'Content-Length' ] nheaders [ 'Expect' ] = '100-continue' pile . spawn ( self . _connect_put_node , node_iter , partition , req , nheaders , self . app . logger . thread_locals ) putters = [ putter for putter in pile if putter ] return putters
Establish connections to storage nodes for PUT request
Establish connections to storage nodes for PUT request
"""
        Establish connections to storage nodes for PUT request
        """ # 该对象是一个可以向其中填充工作的迭代器，便于以后从其中读取结果 # RFC2616:8.2.3 disallows 100-continue without a body, # so switch to chunked request # 从给定的 list中选择出满足if条件的元素组成新的 list # 从 pile 中选择不为空的 putter 组成 putters
self
req
nodes
partition
outgoing_headers
policy