]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: append X-Static-Large-Object attribute during PUT on SLO.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Thu, 19 Nov 2015 13:12:36 +0000 (14:12 +0100)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Tue, 8 Dec 2015 16:58:09 +0000 (17:58 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_common.h
src/rgw/rgw_op.cc

index 998b2ba2fdbc1343a46c2fef30056adb8a22af1f..c40f0b40ac33521bf90f00564be5eeaf18d02126 100644 (file)
@@ -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"
index 906b1663807a204766678b9f8befcf3bc8b28df6..c885f67e03a8eff9f0aa7259b9859961daa92af6 100644 (file)
@@ -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: