Skip to content

Commit f1c3ceb

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Use separate headers for versioned_writes' stack and history modes"
2 parents bfaa8e0 + 60a2fe0 commit f1c3ceb

File tree

5 files changed

+275
-287
lines changed

5 files changed

+275
-287
lines changed

api-ref/source/parameters.yaml

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,27 @@ X-Fresh-Metadata:
666666
in: header
667667
required: false
668668
type: boolean
669+
X-History-Location:
670+
description: |
671+
The URL-encoded UTF-8 representation of the container that stores
672+
previous versions of objects. If neither this nor ``X-Versions-Location``
673+
is set, versioning is disabled for this container. ``X-History-Location``
674+
and ``X-Versions-Location`` cannot both be set at the same time. For more
675+
information about object versioning, see `Object versioning
676+
<http://docs.openstack.org/ developer/swift/api/object_versioning.html>`_.
677+
in: header
678+
required: false
679+
type: string
680+
X-History-Location_resp:
681+
description: |
682+
If present, this container has versioning enabled and the value
683+
is the UTF-8 encoded name of another container.
684+
For more information about object versioning,
685+
see `Object versioning <http://docs.openstack.org/developer/
686+
swift/api/object_versioning.html>`_.
687+
in: header
688+
required: false
689+
type: string
669690
X-Newest:
670691
description: |
671692
If set to true , Object Storage queries all
@@ -728,9 +749,17 @@ X-Remove-Container-name:
728749
in: header
729750
required: false
730751
type: string
752+
X-Remove-History-Location:
753+
description: |
754+
Set to any value to disable versioning. Note that this disables version
755+
that was set via ``X-Versions-Location`` as well.
756+
in: header
757+
required: false
758+
type: string
731759
X-Remove-Versions-Location:
732760
description: |
733-
Set to any value to disable versioning.
761+
Set to any value to disable versioning. Note that this disables version
762+
that was set via ``X-History-Location`` as well.
734763
in: header
735764
required: false
736765
type: string
@@ -801,10 +830,11 @@ X-Trans-Id-Extra:
801830
X-Versions-Location:
802831
description: |
803832
The URL-encoded UTF-8 representation of the container that stores
804-
previous versions of objects. If not set, versioning is disabled
805-
for this container. For more information about object versioning,
806-
see `Object versioning <http://docs.openstack.org/developer/
807-
swift/api/object_versioning.html>`_.
833+
previous versions of objects. If neither this nor ``X-History-Location``
834+
is set, versioning is disabled for this container. ``X-Versions-Location``
835+
and ``X-History-Location`` cannot both be set at the same time. For more
836+
information about object versioning, see `Object versioning
837+
<http://docs.openstack.org/ developer/swift/api/object_versioning.html>`_.
808838
in: header
809839
required: false
810840
type: string
@@ -818,26 +848,6 @@ X-Versions-Location_resp:
818848
in: header
819849
required: false
820850
type: string
821-
X-Versions-Mode:
822-
description: |
823-
The versioning mode for this container. The value must be either
824-
``stack`` or ``history``. If not set, ``stack`` mode will be used.
825-
This setting has no impact unless ``X-Versions-Location`` is set
826-
for the container. For more information about object versioning,
827-
see `Object versioning <http://docs.openstack.org/developer/
828-
swift/api/object_versioning.html>`_.
829-
in: header
830-
required: false
831-
type: string
832-
X-Versions-Mode_resp:
833-
description: |
834-
If set, this is the versioning mode for this container. The value is either
835-
``stack`` or ``history``. For more information about object versioning,
836-
see `Object versioning <http://docs.openstack.org/developer/
837-
swift/api/object_versioning.html>`_.
838-
in: header
839-
required: false
840-
type: string
841851

842852
# variables in path
843853
account:

api-ref/source/storage-container-services.inc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Response Parameters
8585
- X-Container-Sync-Key: X-Container-Sync-Key_resp
8686
- X-Container-Sync-To: X-Container-Sync-To_resp
8787
- X-Versions-Location: X-Versions-Location_resp
88-
- X-Versions-Mode: X-Versions-Mode_resp
88+
- X-History-Location: X-History-Location_resp
8989
- X-Timestamp: X-Timestamp
9090
- X-Trans-Id: X-Trans-Id
9191
- Content_Type: Content-Type_listing_resp
@@ -199,7 +199,7 @@ Request
199199
- X-Container-Sync-To: X-Container-Sync-To
200200
- X-Container-Sync-Key: X-Container-Sync-Key
201201
- X-Versions-Location: X-Versions-Location
202-
- X-Versions-Mode: X-Versions-Mode
202+
- X-History-Location: X-History-Location
203203
- X-Container-Meta-name: X-Container-Meta-name_req
204204
- X-Container-Meta-Access-Control-Allow-Origin: X-Container-Meta-Access-Control-Allow-Origin
205205
- X-Container-Meta-Access-Control-Max-Age: X-Container-Meta-Access-Control-Max-Age
@@ -335,8 +335,9 @@ Request
335335
- X-Container-Sync-To: X-Container-Sync-To
336336
- X-Container-Sync-Key: X-Container-Sync-Key
337337
- X-Versions-Location: X-Versions-Location
338-
- X-Versions-Mode: X-Versions-Mode
338+
- X-History-Location: X-History-Location
339339
- X-Remove-Versions-Location: X-Remove-Versions-Location
340+
- X-Remove-History-Location: X-Remove-History-Location
340341
- X-Container-Meta-name: X-Container-Meta-name_req
341342
- X-Container-Meta-Access-Control-Allow-Origin: X-Container-Meta-Access-Control-Allow-Origin
342343
- X-Container-Meta-Access-Control-Max-Age: X-Container-Meta-Access-Control-Max-Age
@@ -440,7 +441,7 @@ Response Parameters
440441
- X-Trans-Id: X-Trans-Id
441442
- Content-Type: Content-Type_cud_resp
442443
- X-Versions-Location: X-Versions-Location_resp
443-
- X-Versions-Mode: X-Versions-Mode_resp
444+
- X-History-Location: X-History-Location_resp
444445
- X-Storage-Policy: X-Storage-Policy
445446

446447

doc/source/api/object_versioning.rst

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,37 @@ To allow object versioning within a cluster, the cloud provider should add the
2020
``allow_versioned_writes`` option to ``true`` in the
2121
``[filter:versioned_writes]`` section of the proxy-server configuration file.
2222

23-
The ``X-Versions-Location`` header defines the
24-
container that holds the non-current versions of your objects. You
25-
must UTF-8-encode and then URL-encode the container name before you
26-
include it in the ``X-Versions-Location`` header. This header enables
27-
object versioning for all objects in the container. With a comparable
28-
``archive`` container in place, changes to objects in the ``current``
29-
container automatically create non-current versions in the ``archive``
30-
container.
31-
32-
The ``X-Versions-Mode`` header defines the behavior of ``DELETE`` requests to
33-
objects in the versioned container. In the default ``stack`` mode, deleting an
34-
object will restore the most-recent version from the ``archive`` container,
35-
overwriting the curent version. Alternatively you may specify ``history``
36-
mode, where deleting an object will copy the current version to the
37-
``archive`` then remove it from the ``current`` container.
38-
39-
Example Using ``stack`` Mode
40-
----------------------------
23+
To enable object versioning for a container, you must specify an "archive
24+
container" that will retain non-current versions via either the
25+
``X-Versions-Location`` or ``X-History-Location`` header. These two headers
26+
enable two distinct modes of operation. Either mode may be used within a
27+
cluster, but only one mode may be active for any given container. You must
28+
UTF-8-encode and then URL-encode the container name before you include it in
29+
the header.
30+
31+
For both modes, **PUT** requests will archive any pre-existing objects before
32+
writing new data, and **GET** requests will serve the current version. **COPY**
33+
requests behave like a **GET** followed by a **PUT**; that is, if the copy
34+
*source* is in a versioned container then the current version will be copied,
35+
and if the copy *destination* is in a versioned container then any pre-existing
36+
object will be archived before writing new data.
37+
38+
If object versioning was enabled using ``X-History-Location``, then object
39+
**DELETE** requests will copy the current version to the archive container then
40+
remove it from the versioned container.
41+
42+
If object versioning was enabled using ``X-Versions-Location``, then object
43+
**DELETE** requests will restore the most-recent version from the archive
44+
container, overwriting the curent version.
45+
46+
Example Using ``X-Versions-Location``
47+
-------------------------------------
4148

4249
#. Create the ``current`` container:
4350

4451
.. code::
4552
46-
# curl -i $publicURL/current -X PUT -H "Content-Length: 0" -H "X-Auth-Token: $token" -H "X-Versions-Location: archive" -H "X-Versions-Mode: stack"
53+
# curl -i $publicURL/current -X PUT -H "Content-Length: 0" -H "X-Auth-Token: $token" -H "X-Versions-Location: archive"
4754
4855
.. code::
4956
@@ -169,14 +176,14 @@ Example Using ``stack`` Mode
169176
on it. If want to completely remove an object and you have five
170177
versions of it, you must **DELETE** it five times.
171178

172-
Example Using ``history`` Mode
173-
------------------------------
179+
Example Using ``X-History-Location``
180+
------------------------------------
174181

175182
#. Create the ``current`` container:
176183

177184
.. code::
178185
179-
# curl -i $publicURL/current -X PUT -H "Content-Length: 0" -H "X-Auth-Token: $token" -H "X-Versions-Location: archive" -H "X-Versions-Mode: history"
186+
# curl -i $publicURL/current -X PUT -H "Content-Length: 0" -H "X-Auth-Token: $token" -H "X-History-Location: archive"
180187
181188
.. code::
182189
@@ -266,7 +273,7 @@ Example Using ``history`` Mode
266273
#. Issue a **DELETE** request to a versioned object to copy the
267274
current version of the object to the archive container then delete it from
268275
the current container. Subsequent **GET** requests to the object in the
269-
current container will return 404 Not Found.
276+
current container will return ``404 Not Found``.
270277

271278
.. code::
272279

0 commit comments

Comments
 (0)