}
void handle_update(const std::string &mirror_uuid,
- const ImageIds &added_image_ids,
- const ImageIds &removed_image_ids) override {
+ ImageIds &&added_image_ids,
+ ImageIds &&removed_image_ids) override {
Mutex::Locker locker(test->m_lock);
for (auto &image_id : removed_image_ids) {
image_ids.erase(image_id);
MockListener(TestMockPoolWatcher *test) : test(test) {
}
- MOCK_METHOD3(handle_update, void(const std::string &, const ImageIds &,
- const ImageIds &));
+ MOCK_METHOD3(mock_handle_update, void(const std::string &, const ImageIds &,
+ const ImageIds &));
+ void handle_update(const std::string &mirror_uuid,
+ ImageIds &&added_image_ids,
+ ImageIds &&removed_image_ids) override {
+ mock_handle_update(mirror_uuid, added_image_ids, removed_image_ids);
+ }
};
TestMockPoolWatcher() : m_lock("TestMockPoolWatcher::m_lock") {
const std::string &mirror_uuid,
const ImageIds &added_image_ids,
const ImageIds &removed_image_ids) {
- EXPECT_CALL(mock_listener, handle_update(mirror_uuid, added_image_ids,
- removed_image_ids))
+ EXPECT_CALL(mock_listener, mock_handle_update(mirror_uuid, added_image_ids,
+ removed_image_ids))
.WillOnce(WithoutArgs(Invoke([this]() {
Mutex::Locker locker(m_lock);
++m_update_count;
}
void PoolReplayer::handle_update(const std::string &mirror_uuid,
- const ImageIds &added_image_ids,
- const ImageIds &removed_image_ids) {
+ ImageIds &&added_image_ids,
+ ImageIds &&removed_image_ids) {
assert(!mirror_uuid.empty());
if (m_stopping.read()) {
return;
}
void handle_update(const std::string &mirror_uuid,
- const ImageIds &added_image_ids,
- const ImageIds &removed_image_ids) override {
- pool_replayer->handle_update(mirror_uuid, added_image_ids,
- removed_image_ids);
+ ImageIds &&added_image_ids,
+ ImageIds &&removed_image_ids) override {
+ pool_replayer->handle_update(mirror_uuid, std::move(added_image_ids),
+ std::move(removed_image_ids));
}
};
struct C_RefreshLocalImages;
void handle_update(const std::string &mirror_uuid,
- const ImageIds &added_image_ids,
- const ImageIds &removed_image_ids);
+ ImageIds &&added_image_ids,
+ ImageIds &&removed_image_ids);
int init_rados(const std::string &cluster_name,
const std::string &client_name,
}
if (!removed_image_ids.empty()) {
- m_listener.handle_update(mirror_uuid, {}, removed_image_ids);
+ m_listener.handle_update(mirror_uuid, {}, std::move(removed_image_ids));
removed_image_ids.clear();
}
mirror_uuid = m_mirror_uuid;
}
- m_listener.handle_update(mirror_uuid, added_image_ids, removed_image_ids);
+ m_listener.handle_update(mirror_uuid, std::move(added_image_ids),
+ std::move(removed_image_ids));
{
Mutex::Locker locker(m_lock);
}
virtual void handle_update(const std::string &mirror_uuid,
- const ImageIds &added_image_ids,
- const ImageIds &removed_image_ids) = 0;
+ ImageIds &&added_image_ids,
+ ImageIds &&removed_image_ids) = 0;
};
PoolWatcher(Threads<ImageCtxT> *threads, librados::IoCtx &remote_io_ctx,