From: Radoslaw Zarzynski Date: Thu, 19 Nov 2015 13:12:36 +0000 (+0100) Subject: rgw: append X-Static-Large-Object attribute during PUT on SLO. X-Git-Tag: v10.0.2~36^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1cf149d6b529738829420a3fa702de171ff97464;p=ceph.git rgw: append X-Static-Large-Object attribute during PUT on SLO. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 998b2ba2fdb..c40f0b40ac3 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -72,6 +72,9 @@ using ceph::crypto::MD5; #define RGW_ATTR_MANIFEST RGW_ATTR_PREFIX "manifest" #define RGW_ATTR_USER_MANIFEST RGW_ATTR_PREFIX "user_manifest" #define RGW_ATTR_SLO_MANIFEST RGW_ATTR_PREFIX "slo_manifest" +/* Information whether an object is SLO or not must be exposed to + * user through custom HTTP header named X-Static-Large-Object. */ +#define RGW_ATTR_SLO_UINDICATOR RGW_ATTR_META_PREFIX "static-large-object" #define RGW_ATTR_TEMPURL_KEY1 RGW_ATTR_META_PREFIX "temp-url-key" #define RGW_ATTR_TEMPURL_KEY2 RGW_ATTR_META_PREFIX "temp-url-key-2" diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 906b1663807..c885f67e03a 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2272,6 +2272,15 @@ void RGWPutObj::execute() rgw_get_request_metadata(s->cct, s->info, attrs); encode_delete_at_attr(delete_at, attrs); + /* Add a custom metadata to expose the information whether an object + * is an SLO or not. Appending the attribute must be performed AFTER + * processing any input from user in order to prohibit overwriting. */ + if (slo_info) { + bufferlist slo_userindicator_bl; + ::encode("True", slo_userindicator_bl); + attrs[RGW_ATTR_SLO_UINDICATOR] = slo_userindicator_bl; + } + ret = processor->complete(etag, &mtime, 0, attrs, delete_at, if_match, if_nomatch); done: