From 665c95331f9d0a8b16a28ea3efafc7ba20da414c Mon Sep 17 00:00:00 2001 From: anc Date: Thu, 17 Jul 2014 11:17:57 +0100 Subject: [PATCH] Update doc for list_endpoints v2 API Adds some v2 doc to list_endpoints module. Also adds LE to list of swift sources in logs.rst Change-Id: I6ccbcf677b12f5aa7db0f9d81e43ce5ca990cc57 --- doc/source/logs.rst | 1 + swift/common/middleware/list_endpoints.py | 25 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/doc/source/logs.rst b/doc/source/logs.rst index 79b8a3efb0..570be6a297 100644 --- a/doc/source/logs.rst +++ b/doc/source/logs.rst @@ -98,6 +98,7 @@ CQ :ref:`container-quotas` CS :ref:`container-sync` TA :ref:`common_tempauth` DLO :ref:`dynamic-large-objects` +LE :ref:`list_endpoints` ======================= ============================= diff --git a/swift/common/middleware/list_endpoints.py b/swift/common/middleware/list_endpoints.py index fe2e0f1256..37594b3b3f 100644 --- a/swift/common/middleware/list_endpoints.py +++ b/swift/common/middleware/list_endpoints.py @@ -20,11 +20,14 @@ This middleware makes it possible to integrate swift with software that relies on data locality information to avoid network overhead, such as Hadoop. -Answers requests of the form:: +Using the original API, answers requests of the form:: /endpoints/{account}/{container}/{object} /endpoints/{account}/{container} /endpoints/{account} + /endpoints/v1/{account}/{container}/{object} + /endpoints/v1/{account}/{container} + /endpoints/v1/{account} with a JSON-encoded list of endpoints of the form:: @@ -38,6 +41,26 @@ correspondingly, e.g.:: http://10.1.1.1:6000/sda1/2/a/c2 http://10.1.1.1:6000/sda1/2/a +Using the v2 API, answers requests of the form:: + + /endpoints/v2/{account}/{container}/{object} + /endpoints/v2/{account}/{container} + /endpoints/v2/{account} + +with a JSON-encoded dictionary containing a key 'endpoints' that maps to a list +of endpoints having the same form as described above, and a key 'headers' that +maps to a dictionary of headers that should be sent with a request made to +the endpoints, e.g.:: + + { "endpoints": {"http://10.1.1.1:6010/sda1/2/a/c3/o1", + "http://10.1.1.1:6030/sda3/2/a/c3/o1", + "http://10.1.1.1:6040/sda4/2/a/c3/o1"}, + "headers": {"X-Backend-Storage-Policy-Index": "1"}} + +In this example, the 'headers' dictionary indicates that requests to the +endpoint URLs should include the header 'X-Backend-Storage-Policy-Index: 1' +because the object's container is using storage policy index 1. + The '/endpoints/' path is customizable ('list_endpoints_path' configuration parameter).