Search code examples
openstack-swift

Update the X-Delete-After time on an existing OpenStack Swift file?


I'm using OpenStack Swift as a cache, and using X-Delete-After to make sure that old data are deleted.

How can I update or remove the X-Delete-After value for an existing file (without re-uploading it)?


Solution

  • The general answer is to POST the updated metadata (including the new value for x-delete-after) to the object. Remember you need to POST the entire contents of the object metadata, not just the part you want updated.

    If you've got "fast post" enabled (the post_as_copy=False proxy config setting and the default), then the metadata will be updated without copying the file contents on the server-side.

    If you don't have fast post enabled, it works the same way, but on the sever side it will end up doing a COPY. This is internal to the cluster, and the object data is not sent to the client.