为删除操作调度对象

为删除操作调度对象

如需查看对象存储是否支持该特性,请参考:doc:managing-openstack-object-storage-with-swift-cli. 或者向你的服务提供商确认。

为删除调度对象适用于管理不希望做持久存储的对象,比如日志文件,数据集定期备份,或在特定时间过期的文档和镜像。

为删除操作调度对象时,在``PUT``或``POST`` 请求中包含以下请求头:

X-Delete-At
UNIX系统epoch时间戳,整数形式。例如,1348691905``表示``Wed, 26 Sept 2012 20:38:25 GMT. 它表示对象的过期时间,对象过期则不再提供服务,完全从对象存储中删除。
X-Delete-After
该整数值用于指定一个数值(单位:s),表示从请求开始到希望删除的时间。请求头被转换为``X-Delete-At``, 其值被设定为``X-Delete-After`` 的值与当前时间的和。

注解

Use EpochConverter to convert dates to and from epoch timestamps and for batch conversions.

使用POST方法将表示过期的请求头赋值给已存在的对象。

在这个例子中,``X-Delete-At``设置为UNIX epoch时间戳``Mon, 11 Jun 2012 15:38:25 GMT``的整数值。

$ curl -i publicURL/marktwain/goodbye -X PUT -H "X-Auth-Token: token" \
  -H "X-Delete-At: 1390581073" -H "Content-Length: 14" -H \
  "Content-Type: application/octet-stream"

在这个例子中, X-Delete-After 设置为864000秒。超过此时间后对象过期。

PUT /<api version>/<account>/<container>/<object> HTTP/1.1
Host: storage.example.com
X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb
Content-Type: image/jpeg
X-Delete-After: 864000
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.