File: object-expiration.rst

package info (click to toggle)
swift 2.35.1-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 22,760 kB
  • sloc: python: 281,901; javascript: 1,059; sh: 619; pascal: 295; makefile: 81; xml: 32
file content (48 lines) | stat: -rw-r--r-- 1,481 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
=================
Object expiration
=================

You can schedule Object Storage (swift) objects to expire by setting the
``X-Delete-At`` or ``X-Delete-After`` header. Once the object is deleted,
swift will no longer serve the object and it will be deleted from the cluster
shortly thereafter.

*  Set an object to expire at an absolute time (in Unix time). You
   can get the current Unix time by running ``date +'%s'``.

   .. code-block:: console

      $ swift post CONTAINER OBJECT_FILENAME -H "X-Delete-At:UNIX_TIME"

   Verify the ``X-Delete-At`` header has posted to the object:

   .. code-block:: console

      $ swift stat CONTAINER OBJECT_FILENAME

*  Set an object to expire after a relative amount of time (in seconds):

   .. code-block:: console

      $ swift post CONTAINER OBJECT_FILENAME -H "X-Delete-After:SECONDS"

   The ``X-Delete-After`` header will be converted to ``X-Delete-At``.
   Verify the ``X-Delete-At`` header has posted to the object:

   .. code-block:: console

      $ swift stat CONTAINER OBJECT_FILENAME

   If you no longer want to expire the object, you can remove the
   ``X-Delete-At`` header:

   .. code-block:: console

      $ swift post CONTAINER OBJECT_FILENAME -H "X-Remove-Delete-At:"

.. note::

   In order for object expiration to work properly, the
   ``swift-object-expirer`` daemon will need access to all backend
   servers in the cluster. The daemon does not need access to the
   proxy-server or public network.