swift/proxy/controllers/obj.py
def _delete_object(self, req, obj_ring, partition, headers):
        """Delete object considering write-affinity.

        When deleting object in write affinity deployment, also take configured
        handoff nodes number into consideration, instead of just sending
        requests to primary nodes. Otherwise (write-affinity is disabled),
        go with the same way as before.

        :param req: the DELETE Request
        :param obj_ring: the object ring
        :param partition: ring partition number
        :param headers: system headers to storage nodes
        :return: Response object
        """
        policy_index = req.headers.get('X-Backend-Storage-Policy-Index')
        policy = POLICIES.get_by_index(policy_index)

        node_count = None
        node_iterator = None

        policy_options = self.app.get_policy_options(policy)
        is_local = policy_options.write_affinity_is_local_fn
        if is_local is not None:
            primaries = obj_ring.get_part_nodes(partition)
            node_count = len(primaries)

            local_handoffs = policy_options.write_affinity_handoff_delete_count
            if local_handoffs is None:
                local_primaries = [node for node in primaries
                                   if is_local(node)]
                local_handoffs = len(primaries) - len(local_primaries)

            node_count += local_handoffs

            node_iterator = self.iter_nodes_local_first(
                obj_ring, partition, policy=policy, local_handoffs_first=True
            )

        status_overrides = {404: 204}
        resp = self.make_requests(req, obj_ring,
                                  partition, 'DELETE', req.swift_entity_path,
                                  headers, overrides=status_overrides,
                                  node_count=node_count,
                                  node_iterator=node_iterator)

        return resp
Delete object considering write-affinity.

        When deleting object in write affinity deployment, also take configured
        handoff nodes number into consideration, instead of just sending
        requests to primary nodes. Otherwise (write-affinity is disabled),
        go with the same way as before.

        :param req: the DELETE Request
        :param obj_ring: the object ring
        :param partition: ring partition number
        :param headers: system headers to storage nodes
        :return: Response object
        
Delete object considering write-affinity.
When deleting object in write affinity deployment, also take configured
handoff nodes number into consideration, instead of just sending
requests to primary nodes. Otherwise (write-affinity is disabled),
go with the same way as before.
Delete object considering write - affinity . When deleting object in write affinity deployment also take configured handoff nodes number into consideration instead of just sending requests to primary nodes . Otherwise ( write - affinity is disabled ) go with the same way as before .
def _delete_object(self, req, obj_ring, partition, headers):
        policy_index = req.headers.get('X-Backend-Storage-Policy-Index')
        policy = POLICIES.get_by_index(policy_index)
        node_count = None
        node_iterator = None
        policy_options = self.app.get_policy_options(policy)
        is_local = policy_options.write_affinity_is_local_fn
        if is_local is not None:
            primaries = obj_ring.get_part_nodes(partition)
            node_count = len(primaries)
            local_handoffs = policy_options.write_affinity_handoff_delete_count
            if local_handoffs is None:
                local_primaries = [node for node in primaries
                                   if is_local(node)]
                local_handoffs = len(primaries) - len(local_primaries)
            node_count += local_handoffs
            node_iterator = self.iter_nodes_local_first(
                obj_ring, partition, policy=policy, local_handoffs_first=True
            )
        status_overrides = {404: 204}
        resp = self.make_requests(req, obj_ring,
                                  partition, 'DELETE', req.swift_entity_path,
                                  headers, overrides=status_overrides,
                                  node_count=node_count,
                                  node_iterator=node_iterator)
        return resp
def _delete_object ( self , req , obj_ring , partition , headers ) : policy_index = req . headers . get ( 'X-Backend-Storage-Policy-Index' ) policy = POLICIES . get_by_index ( policy_index ) node_count = None node_iterator = None policy_options = self . app . get_policy_options ( policy ) is_local = policy_options . write_affinity_is_local_fn if is_local is not None : primaries = obj_ring . get_part_nodes ( partition ) node_count = len ( primaries ) local_handoffs = policy_options . write_affinity_handoff_delete_count if local_handoffs is None : local_primaries = [ node for node in primaries if is_local ( node ) ] local_handoffs = len ( primaries ) - len ( local_primaries ) node_count += local_handoffs node_iterator = self . iter_nodes_local_first ( obj_ring , partition , policy = policy , local_handoffs_first = True ) status_overrides = { 404 : 204 } resp = self . make_requests ( req , obj_ring , partition , 'DELETE' , req . swift_entity_path , headers , overrides = status_overrides , node_count = node_count , node_iterator = node_iterator ) return resp
Delete object considering write-affinity.
Delete object considering write - affinity .
"""Delete object considering write-affinity.

        When deleting object in write affinity deployment, also take configured
        handoff nodes number into consideration, instead of just sending
        requests to primary nodes. Otherwise (write-affinity is disabled),
        go with the same way as before.

        :param req: the DELETE Request
        :param obj_ring: the object ring
        :param partition: ring partition number
        :param headers: system headers to storage nodes
        :return: Response object
        """
None
self
req
the DELETE Request
the DELETE Request
obj_ring
the object ring
the object ring
partition
ring partition number
ring partition number
headers
system headers to storage nodes
system headers to storage nodes