From 6d4733c58b31175116e6e6cfaea8f249e8e10c54 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 16 Mar 2017 14:13:16 -0700 Subject: [PATCH] rgw: add init callback to sync modules Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_data_sync.cc | 6 ++++++ src/rgw/rgw_sync_module.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index b23e306c124b4..e305519b432ad 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -1432,6 +1432,8 @@ class RGWDataSyncCR : public RGWCoroutine { bool *reset_backoff; RGWDataSyncDebugLogger logger; + + RGWDataSyncModule *data_sync_module{nullptr}; public: RGWDataSyncCR(RGWDataSyncEnv *_sync_env, uint32_t _num_shards, bool *_reset_backoff) : RGWCoroutine(_sync_env->cct), sync_env(_sync_env), @@ -1439,6 +1441,7 @@ public: marker_tracker(NULL), shard_crs_lock("RGWDataSyncCR::shard_crs_lock"), reset_backoff(_reset_backoff), logger(sync_env, "Data", "all") { + } ~RGWDataSyncCR() override { @@ -1474,6 +1477,9 @@ public: } if ((rgw_data_sync_info::SyncState)sync_status.sync_info.state == rgw_data_sync_info::StateBuildingFullSyncMaps) { + /* call sync module init here */ + data_sync_module = sync_env->sync_module->get_data_handler(); + call(data_sync_module->init_sync(sync_env)); /* state: building full sync maps */ ldout(sync_env->cct, 20) << __func__ << "(): building full sync maps" << dendl; yield call(new RGWListBucketIndexesCR(sync_env, &sync_status)); diff --git a/src/rgw/rgw_sync_module.h b/src/rgw/rgw_sync_module.h index f6f070b1c36f5..07b30a0201bf6 100644 --- a/src/rgw/rgw_sync_module.h +++ b/src/rgw/rgw_sync_module.h @@ -16,6 +16,10 @@ public: RGWDataSyncModule() {} virtual ~RGWDataSyncModule() {} + virtual RGWCoroutine *init_sync(RGWDataSyncEnv *sync_env) { + return nullptr; + } + virtual RGWCoroutine *sync_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, uint64_t versioned_epoch, rgw_zone_set *zones_trace) = 0; virtual RGWCoroutine *remove_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, real_time& mtime, bool versioned, uint64_t versioned_epoch, rgw_zone_set *zones_trace) = 0; -- 2.39.5