swift/proxy/controllers/obj.py
def _store_object(self, req, data_source, nodes, partition,
                      outgoing_headers):
        """
        Store a replicated object.

        This method is responsible for establishing connection
        with storage nodes and sending object to each one of those
        nodes. After sending the data, the "best" response will be
        returned based on statuses from all connections
        """
        policy_index = req.headers.get('X-Backend-Storage-Policy-Index')
        policy = POLICIES.get_by_index(policy_index)
        if not nodes:
            return HTTPNotFound()

        putters = self._get_put_connections(
            req, nodes, partition, outgoing_headers, policy)
        min_conns = quorum_size(len(nodes))
        try:
            # check that a minimum number of connections were established and
            # meet all the correct conditions set in the request
            self._check_failure_put_connections(putters, req, min_conns)

            # transfer data
            self._transfer_data(req, data_source, putters, nodes)

            # get responses
            statuses, reasons, bodies, etags = \
                self._get_put_responses(req, putters, len(nodes))
        except HTTPException as resp:
            return resp
        finally:
            for putter in putters:
                putter.close()

        if len(etags) > 1:
            self.app.logger.error(
                _('Object servers returned %s mismatched etags'), len(etags))
            return HTTPServerError(request=req)
        etag = etags.pop() if len(etags) else None
        resp = self.best_response(req, statuses, reasons, bodies,
                                  _('Object PUT'), etag=etag)
        resp.last_modified = math.ceil(
            float(Timestamp(req.headers['X-Timestamp'])))
        return resp

        Store a replicated object.

        This method is responsible for establishing connection
        with storage nodes and sending object to each one of those
        nodes. After sending the data, the "best" response will be
        returned based on statuses from all connections
        
Store a replicated object.
This method is responsible for establishing connection
with storage nodes and sending object to each one of those
nodes. After sending the data, the "best" response will be
returned based on statuses from all connections
Store a replicated object . This method is responsible for establishing connection with storage nodes and sending object to each one of those nodes . After sending the data the " best " response will be returned based on statuses from all connections
def _store_object(self, req, data_source, nodes, partition,
                      outgoing_headers):
        policy_index = req.headers.get('X-Backend-Storage-Policy-Index')
        policy = POLICIES.get_by_index(policy_index)
        if not nodes:
            return HTTPNotFound()
        putters = self._get_put_connections(
            req, nodes, partition, outgoing_headers, policy)
        min_conns = quorum_size(len(nodes))
        try:
            self._check_failure_put_connections(putters, req, min_conns)
            self._transfer_data(req, data_source, putters, nodes)
            statuses, reasons, bodies, etags = \
                self._get_put_responses(req, putters, len(nodes))
        except HTTPException as resp:
            return resp
        finally:
            for putter in putters:
                putter.close()
        if len(etags) > 1:
            self.app.logger.error(
                _('Object servers returned %s mismatched etags'), len(etags))
            return HTTPServerError(request=req)
        etag = etags.pop() if len(etags) else None
        resp = self.best_response(req, statuses, reasons, bodies,
                                  _('Object PUT'), etag=etag)
        resp.last_modified = math.ceil(
            float(Timestamp(req.headers['X-Timestamp'])))
        return resp
def _store_object ( self , req , data_source , nodes , partition , outgoing_headers ) : policy_index = req . headers . get ( 'X-Backend-Storage-Policy-Index' ) policy = POLICIES . get_by_index ( policy_index ) if not nodes : return HTTPNotFound ( ) putters = self . _get_put_connections ( req , nodes , partition , outgoing_headers , policy ) min_conns = quorum_size ( len ( nodes ) ) try : self . _check_failure_put_connections ( putters , req , min_conns ) self . _transfer_data ( req , data_source , putters , nodes ) statuses , reasons , bodies , etags = self . _get_put_responses ( req , putters , len ( nodes ) ) except HTTPException as resp : return resp finally : for putter in putters : putter . close ( ) if len ( etags ) > 1 : self . app . logger . error ( _ ( 'Object servers returned %s mismatched etags' ) , len ( etags ) ) return HTTPServerError ( request = req ) etag = etags . pop ( ) if len ( etags ) else None resp = self . best_response ( req , statuses , reasons , bodies , _ ( 'Object PUT' ) , etag = etag ) resp . last_modified = math . ceil ( float ( Timestamp ( req . headers [ 'X-Timestamp' ] ) ) ) return resp
Store a replicated object.
Store a replicated object .
"""
        Store a replicated object.

        This method is responsible for establishing connection
        with storage nodes and sending object to each one of those
        nodes. After sending the data, the "best" response will be
        returned based on statuses from all connections
        """ # check that a minimum number of connections were established and # meet all the correct conditions set in the request # transfer data # get responses
self
req
data_source
nodes
partition
outgoing_headers