Merge "add object post and delete methods to BaseObjectController"
This commit is contained in:
commit
073c8134e8
@ -311,10 +311,7 @@ class BaseObjectController(Controller):
|
|||||||
headers = self._backend_requests(
|
headers = self._backend_requests(
|
||||||
req, len(nodes), container_partition, containers,
|
req, len(nodes), container_partition, containers,
|
||||||
delete_at_container, delete_at_part, delete_at_nodes)
|
delete_at_container, delete_at_part, delete_at_nodes)
|
||||||
|
return self._post_object(req, obj_ring, partition, headers)
|
||||||
resp = self.make_requests(req, obj_ring, partition,
|
|
||||||
'POST', req.swift_entity_path, headers)
|
|
||||||
return resp
|
|
||||||
|
|
||||||
def _backend_requests(self, req, n_outgoing,
|
def _backend_requests(self, req, n_outgoing,
|
||||||
container_partition, containers,
|
container_partition, containers,
|
||||||
@ -741,6 +738,39 @@ class BaseObjectController(Controller):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
def _delete_object(self, req, obj_ring, partition, headers):
|
||||||
|
"""
|
||||||
|
send object DELETE request to storage nodes. Subclasses of
|
||||||
|
the BaseObjectController can provide their own implementation
|
||||||
|
of this method.
|
||||||
|
|
||||||
|
: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
|
||||||
|
"""
|
||||||
|
# When deleting objects treat a 404 status as 204.
|
||||||
|
status_overrides = {404: 204}
|
||||||
|
resp = self.make_requests(req, obj_ring,
|
||||||
|
partition, 'DELETE', req.swift_entity_path,
|
||||||
|
headers, overrides=status_overrides)
|
||||||
|
return resp
|
||||||
|
|
||||||
|
def _post_object(self, req, obj_ring, partition, headers):
|
||||||
|
"""
|
||||||
|
send object POST request to storage nodes.
|
||||||
|
|
||||||
|
:param req: the POST Request
|
||||||
|
:param obj_ring: the object ring
|
||||||
|
:param partition: ring partition number
|
||||||
|
:param headers: system headers to storage nodes
|
||||||
|
:return: Response object
|
||||||
|
"""
|
||||||
|
resp = self.make_requests(req, obj_ring, partition,
|
||||||
|
'POST', req.swift_entity_path, headers)
|
||||||
|
return resp
|
||||||
|
|
||||||
@public
|
@public
|
||||||
@cors_validation
|
@cors_validation
|
||||||
@delay_denial
|
@delay_denial
|
||||||
@ -930,12 +960,7 @@ class BaseObjectController(Controller):
|
|||||||
|
|
||||||
headers = self._backend_requests(
|
headers = self._backend_requests(
|
||||||
req, len(nodes), container_partition, containers)
|
req, len(nodes), container_partition, containers)
|
||||||
# When deleting objects treat a 404 status as 204.
|
return self._delete_object(req, obj_ring, partition, headers)
|
||||||
status_overrides = {404: 204}
|
|
||||||
resp = self.make_requests(req, obj_ring,
|
|
||||||
partition, 'DELETE', req.swift_entity_path,
|
|
||||||
headers, overrides=status_overrides)
|
|
||||||
return resp
|
|
||||||
|
|
||||||
def _reroute(self, policy):
|
def _reroute(self, policy):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user