#pragma once #include #include #include #include #include // Move directory to another meta-data server class MovingDirInsertMsgEx : public MirroredMessage> { public: typedef ErrorCodeResponseState ResponseState; virtual bool processIncoming(ResponseContext& ctx) override; std::tuple lock(EntryLockStore& store) override { // we must not lock the directory if it is owned by the current node. if it is, the // current message was also sent by the local node, specifically by a RmDirMsgEx, which // also locks the directory for write if (rctx->isLocallyGenerated()) return {}; FileIDLock dirLock(&store, getToDirInfo()->getEntryID(), true); ParentNameLock nameLock(&store, getToDirInfo()->getEntryID(), getNewName()); return std::make_tuple(std::move(dirLock), std::move(nameLock)); } bool isMirrored() override { return getToDirInfo()->getIsBuddyMirrored(); } private: ResponseContext* rctx; std::unique_ptr executeLocally(ResponseContext& ctx, bool isSecondary) override; void forwardToSecondary(ResponseContext& ctx) override; FhgfsOpsErr processSecondaryResponse(NetMessage& resp) override { return static_cast(resp).getResult(); } const char* mirrorLogContext() const override { return "MovingDirInsertMsgEx/forward"; } };