Specify the param "sync-type" as one of "always", "update-by-version",
"update-by-timestamp". It defaults to always.
Signed-off-by: Greg Farnum <greg@inktank.com>
APPLY_UPDATES,
APPLY_NEWER
};
+ static bool string_to_sync_type(const string& sync_string,
+ sync_type_t& type) {
+ if (sync_string.compare("update-by-version") == 0)
+ type = APPLY_UPDATES;
+ else if (sync_string.compare("update-by-timestamp") == 0)
+ type = APPLY_NEWER;
+ else if (sync_string.compare("always") == 0)
+ type = APPLY_ALWAYS;
+ else
+ return false;
+ return true;
+ }
virtual ~RGWMetadataHandler() {}
virtual string get_type() = 0;
RGWMetadataHandler::sync_type_t sync_type = RGWMetadataHandler::APPLY_ALWAYS;
+ bool mode_exists = false;
+ string mode_string = s->info.args.get("sync-type", &mode_exists);
+ if (mode_exists) {
+ bool parsed = RGWMetadataHandler::string_to_sync_type(mode_string,
+ sync_type);
+ if (!parsed) {
+ http_ret = -EINVAL;
+ return;
+ }
+ }
+
http_ret = store->meta_mgr->put(metadata_key, bl, sync_type);
if (http_ret < 0) {
dout(5) << "ERROR: can't put key: " << cpp_strerror(http_ret) << dendl;