test: switch the cls_replica_log tests to use a test fixture

Instead of the silly macros.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: grab the old mtime when doing a user metadata put

We're about to use this to enable (ick) a timestamp-based update
decision tree, to help in resolving disastrous double-active conflicts.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: add preliminary support for sync update policies on metadata sync

We want to be able to conditionally apply new updates:
1) if we already have a newer version than the sync is applying for some
reason (replay of logs?), we don't want to go back in time.
2) If both zones were active at the same time, then we'd like to be
able to do a merge based on timestamps.

In order to support this, we add a sync_type flag to the implementations of
RGWMetadataHandler::put, and then check the version or the mtime of the
incoming put to what we have on disk, and refuse the update if needed.
We return the 204 NoContent success code when refusing sync; for the
moment the conversion is automatic but we're going to pull it out in
the next couple commits.

This commit does not complete the feature: we don't provide an interface
for specifying a different sync protocol.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: pass the sync mode into the RGWMetadataManager::put() calls.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: add sync state parsing code and REST interface

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>
rgw: return the update status on sync requests

Add new STATUS_APPLIED, then specify the RGWX_UPDATE_STATUS header
based on that return code when doing metadata puts.
Add a send_response() function to RGWOp_Metadata_Put in order to
support sending back our new headers. Move the translation from
STATUS_NO_APPLY from set_req_state_err() to this function, so we
can turn different sync results into failures if necessary elsewhere.

Signed-off-by: Greg Farnum <greg@inktank.com>
rgw: expose the version of synced items to the poster

To support this, we add an optional out argument to
RGWMetadatManager::put() and fill in the read_version. When the
function returns, that contains whatever the current on-disk version
of the object is (either what already existed or what we just wrote).

Signed-off-by: Greg Farnum <greg@inktank.com>
Merge branch 'wip-rgw-versionchecks' into next

Conflicts:
	src/rgw/rgw_rest_metadata.h

Reviewed-by: Yehuda Sadeh <yehuda@inktank.com