diff --git a/src/graph/CMakeLists.txt b/src/graph/CMakeLists.txt index 6a7cbee0140..ed0bedd40d9 100644 --- a/src/graph/CMakeLists.txt +++ b/src/graph/CMakeLists.txt @@ -18,8 +18,8 @@ add_library( CreateTagExecutor.cpp AlterEdgeExecutor.cpp AlterTagExecutor.cpp - RemoveTagExecutor.cpp - RemoveEdgeExecutor.cpp + DropTagExecutor.cpp + DropEdgeExecutor.cpp DescribeTagExecutor.cpp DescribeEdgeExecutor.cpp InsertVertexExecutor.cpp diff --git a/src/graph/RemoveTagExecutor.cpp b/src/graph/DropEdgeExecutor.cpp similarity index 73% rename from src/graph/RemoveTagExecutor.cpp rename to src/graph/DropEdgeExecutor.cpp index af008706130..50af6707ed4 100644 --- a/src/graph/RemoveTagExecutor.cpp +++ b/src/graph/DropEdgeExecutor.cpp @@ -4,25 +4,25 @@ * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ -#include "graph/RemoveTagExecutor.h" +#include "graph/DropEdgeExecutor.h" namespace nebula { namespace graph { -RemoveTagExecutor::RemoveTagExecutor(Sentence *sentence, - ExecutionContext *ectx) : Executor(ectx) { - sentence_ = static_cast(sentence); +DropEdgeExecutor::DropEdgeExecutor(Sentence *sentence, + ExecutionContext *ectx) : Executor(ectx) { + sentence_ = static_cast(sentence); } -Status RemoveTagExecutor::prepare() { +Status DropEdgeExecutor::prepare() { return checkIfGraphSpaceChosen(); } -void RemoveTagExecutor::execute() { +void DropEdgeExecutor::execute() { auto *mc = ectx()->getMetaClient(); auto *name = sentence_->name(); auto spaceId = ectx()->rctx()->session()->space(); - auto future = mc->removeTagSchema(spaceId, *name); + auto future = mc->dropEdgeSchema(spaceId, *name); auto *runner = ectx()->rctx()->runner(); auto cb = [this] (auto &&resp) { @@ -47,3 +47,4 @@ void RemoveTagExecutor::execute() { } // namespace graph } // namespace nebula + diff --git a/src/graph/RemoveTagExecutor.h b/src/graph/DropEdgeExecutor.h similarity index 61% rename from src/graph/RemoveTagExecutor.h rename to src/graph/DropEdgeExecutor.h index 5aa7b1c94d3..973feef1ada 100644 --- a/src/graph/RemoveTagExecutor.h +++ b/src/graph/DropEdgeExecutor.h @@ -4,8 +4,8 @@ * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ -#ifndef GRAPH_REMOVETAGEXECUTOR_H -#define GRAPH_REMOVETAGEXECUTOR_H +#ifndef GRAPH_DROPEDGEEXECUTOR_H +#define GRAPH_DROPEDGEEXECUTOR_H #include "base/Base.h" #include "graph/Executor.h" @@ -13,12 +13,12 @@ namespace nebula { namespace graph { -class RemoveTagExecutor final : public Executor { +class DropEdgeExecutor final : public Executor { public: - RemoveTagExecutor(Sentence *sentence, ExecutionContext *context); + DropEdgeExecutor(Sentence *sentence, ExecutionContext *context); const char* name() const override { - return "RemoveTagExecutor"; + return "DropEdgeExecutor"; } Status MUST_USE_RESULT prepare() override; @@ -26,11 +26,10 @@ class RemoveTagExecutor final : public Executor { void execute() override; private: - RemoveTagSentence *sentence_{nullptr}; + DropEdgeSentence *sentence_{nullptr}; }; } // namespace graph } // namespace nebula -#endif // GRAPH_REMOVETAGEXECUTOR_H - +#endif // GRAPH_DROPEDGEEXECUTOR_H diff --git a/src/graph/RemoveEdgeExecutor.cpp b/src/graph/DropTagExecutor.cpp similarity index 72% rename from src/graph/RemoveEdgeExecutor.cpp rename to src/graph/DropTagExecutor.cpp index d83dba02d4c..eb480c4d815 100644 --- a/src/graph/RemoveEdgeExecutor.cpp +++ b/src/graph/DropTagExecutor.cpp @@ -4,25 +4,25 @@ * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ -#include "graph/RemoveEdgeExecutor.h" +#include "graph/DropTagExecutor.h" namespace nebula { namespace graph { -RemoveEdgeExecutor::RemoveEdgeExecutor(Sentence *sentence, - ExecutionContext *ectx) : Executor(ectx) { - sentence_ = static_cast(sentence); +DropTagExecutor::DropTagExecutor(Sentence *sentence, + ExecutionContext *ectx) : Executor(ectx) { + sentence_ = static_cast(sentence); } -Status RemoveEdgeExecutor::prepare() { +Status DropTagExecutor::prepare() { return checkIfGraphSpaceChosen(); } -void RemoveEdgeExecutor::execute() { +void DropTagExecutor::execute() { auto *mc = ectx()->getMetaClient(); auto *name = sentence_->name(); auto spaceId = ectx()->rctx()->session()->space(); - auto future = mc->removeEdgeSchema(spaceId, *name); + auto future = mc->dropTagSchema(spaceId, *name); auto *runner = ectx()->rctx()->runner(); auto cb = [this] (auto &&resp) { @@ -47,3 +47,4 @@ void RemoveEdgeExecutor::execute() { } // namespace graph } // namespace nebula + diff --git a/src/graph/RemoveEdgeExecutor.h b/src/graph/DropTagExecutor.h similarity index 60% rename from src/graph/RemoveEdgeExecutor.h rename to src/graph/DropTagExecutor.h index b22579e01a1..0962bb85990 100644 --- a/src/graph/RemoveEdgeExecutor.h +++ b/src/graph/DropTagExecutor.h @@ -4,8 +4,8 @@ * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ -#ifndef GRAPH_REMOVEEDGEEXECUTOR_H -#define GRAPH_REMOVEEDGEEXECUTOR_H +#ifndef GRAPH_DROPTAGEXECUTOR_H +#define GRAPH_DROPTAGEXECUTOR_H #include "base/Base.h" #include "graph/Executor.h" @@ -13,12 +13,12 @@ namespace nebula { namespace graph { -class RemoveEdgeExecutor final : public Executor { +class DropTagExecutor final : public Executor { public: - RemoveEdgeExecutor(Sentence *sentence, ExecutionContext *context); + DropTagExecutor(Sentence *sentence, ExecutionContext *context); const char* name() const override { - return "RemoveEdgeExecutor"; + return "DropTagExecutor"; } Status MUST_USE_RESULT prepare() override; @@ -26,11 +26,10 @@ class RemoveEdgeExecutor final : public Executor { void execute() override; private: - RemoveEdgeSentence *sentence_{nullptr}; + DropTagSentence *sentence_{nullptr}; }; } // namespace graph } // namespace nebula -#endif // GRAPH_REMOVEEDGEEXECUTOR_H - +#endif // GRAPH_DROPTAGEXECUTOR_H diff --git a/src/graph/Executor.cpp b/src/graph/Executor.cpp index 1f1ab998e45..b8aa693674a 100644 --- a/src/graph/Executor.cpp +++ b/src/graph/Executor.cpp @@ -17,8 +17,8 @@ #include "graph/CreateEdgeExecutor.h" #include "graph/AlterTagExecutor.h" #include "graph/AlterEdgeExecutor.h" -#include "graph/RemoveTagExecutor.h" -#include "graph/RemoveEdgeExecutor.h" +#include "graph/DropTagExecutor.h" +#include "graph/DropEdgeExecutor.h" #include "graph/DescribeTagExecutor.h" #include "graph/DescribeEdgeExecutor.h" #include "graph/InsertVertexExecutor.h" @@ -65,11 +65,11 @@ std::unique_ptr Executor::makeExecutor(Sentence *sentence) { case Sentence::Kind::kDescribeEdge: executor = std::make_unique(sentence, ectx()); break; - case Sentence::Kind::kRemoveTag: - executor = std::make_unique(sentence, ectx()); + case Sentence::Kind::kDropTag: + executor = std::make_unique(sentence, ectx()); break; - case Sentence::Kind::kRemoveEdge: - executor = std::make_unique(sentence, ectx()); + case Sentence::Kind::kDropEdge: + executor = std::make_unique(sentence, ectx()); break; case Sentence::Kind::kInsertVertex: executor = std::make_unique(sentence, ectx()); diff --git a/src/graph/RemoveHostsExecutor.cpp b/src/graph/RemoveHostsExecutor.cpp index 30df24519bb..ffc9776f869 100644 --- a/src/graph/RemoveHostsExecutor.cpp +++ b/src/graph/RemoveHostsExecutor.cpp @@ -56,3 +56,4 @@ void RemoveHostsExecutor::execute() { } // namespace graph } // namespace nebula + diff --git a/src/graph/RemoveHostsExecutor.h b/src/graph/RemoveHostsExecutor.h index 40b489a608d..98332aa8db3 100644 --- a/src/graph/RemoveHostsExecutor.h +++ b/src/graph/RemoveHostsExecutor.h @@ -35,3 +35,4 @@ class RemoveHostsExecutor final : public Executor { } // namespace nebula #endif // GRAPH_REMOVEHOSTSEXECUTOR_H_ + diff --git a/src/graph/test/SchemaTest.cpp b/src/graph/test/SchemaTest.cpp index 72ff684fa93..738d1de7ab1 100644 --- a/src/graph/test/SchemaTest.cpp +++ b/src/graph/test/SchemaTest.cpp @@ -275,7 +275,7 @@ TEST_F(SchemaTest, metaCommunication) { } { cpp2::ExecutionResponse resp; - std::string query = "REMOVE TAG person "; + std::string query = "DROP TAG person "; auto code = client->execute(query, resp); sleep(FLAGS_load_data_interval_secs + 1); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); diff --git a/src/interface/meta.thrift b/src/interface/meta.thrift index b6c7632e288..db574f0b16d 100644 --- a/src/interface/meta.thrift +++ b/src/interface/meta.thrift @@ -130,7 +130,7 @@ struct AlterTagReq { 3: list tag_items, } -struct RemoveTagReq { +struct DropTagReq { 1: common.GraphSpaceID space_id, 2: string tag_name, } @@ -183,7 +183,7 @@ struct GetEdgeResp { 3: common.Schema schema, } -struct RemoveEdgeReq { +struct DropEdgeReq { 1: common.GraphSpaceID space_id, 2: string edge_name, } @@ -299,13 +299,13 @@ service MetaService { ExecResp createTag(1: CreateTagReq req); ExecResp alterTag(1: AlterTagReq req); - ExecResp removeTag(1: RemoveTagReq req); + ExecResp dropTag(1: DropTagReq req); GetTagResp getTag(1: GetTagReq req); ListTagsResp listTags(1: ListTagsReq req); ExecResp createEdge(1: CreateEdgeReq req); ExecResp alterEdge(1: AlterEdgeReq req); - ExecResp removeEdge(1: RemoveEdgeReq req); + ExecResp dropEdge(1: DropEdgeReq req); GetEdgeResp getEdge(1: GetEdgeReq req); ListEdgesResp listEdges(1: ListEdgesReq req); diff --git a/src/meta/CMakeLists.txt b/src/meta/CMakeLists.txt index 3d738458773..90f7a6830e5 100644 --- a/src/meta/CMakeLists.txt +++ b/src/meta/CMakeLists.txt @@ -28,8 +28,8 @@ add_library( processors/GetEdgeProcessor.cpp processors/ListTagsProcessor.cpp processors/ListEdgesProcessor.cpp - processors/RemoveTagProcessor.cpp - processors/RemoveEdgeProcessor.cpp + processors/DropTagProcessor.cpp + processors/DropEdgeProcessor.cpp processors/GetProcessor.cpp processors/MultiGetProcessor.cpp processors/MultiPutProcessor.cpp diff --git a/src/meta/MetaServiceHandler.cpp b/src/meta/MetaServiceHandler.cpp index e3a31dee6d3..60f77740e42 100644 --- a/src/meta/MetaServiceHandler.cpp +++ b/src/meta/MetaServiceHandler.cpp @@ -12,23 +12,23 @@ #include "meta/processors/AddHostsProcessor.h" #include "meta/processors/ListHostsProcessor.h" #include "meta/processors/RemoveHostsProcessor.h" +#include "meta/processors/GetPartsAllocProcessor.h" #include "meta/processors/CreateTagProcessor.h" #include "meta/processors/AlterTagProcessor.h" +#include "meta/processors/DropTagProcessor.h" #include "meta/processors/GetTagProcessor.h" #include "meta/processors/ListTagsProcessor.h" -#include "meta/processors/RemoveTagProcessor.h" #include "meta/processors/CreateEdgeProcessor.h" #include "meta/processors/AlterEdgeProcessor.h" +#include "meta/processors/DropEdgeProcessor.h" #include "meta/processors/GetEdgeProcessor.h" #include "meta/processors/ListEdgesProcessor.h" -#include "meta/processors/RemoveEdgeProcessor.h" #include "meta/processors/MultiPutProcessor.h" #include "meta/processors/GetProcessor.h" #include "meta/processors/MultiGetProcessor.h" #include "meta/processors/ScanProcessor.h" #include "meta/processors/RemoveProcessor.h" #include "meta/processors/RemoveRangeProcessor.h" -#include "meta/processors/GetPartsAllocProcessor.h" #include "meta/processors/HBProcessor.h" #define RETURN_FUTURE(processor) \ @@ -130,8 +130,8 @@ MetaServiceHandler::future_alterTag(const cpp2::AlterTagReq& req) { } folly::Future -MetaServiceHandler::future_removeTag(const cpp2::RemoveTagReq& req) { - auto* processor = RemoveTagProcessor::instance(kvstore_); +MetaServiceHandler::future_dropTag(const cpp2::DropTagReq& req) { + auto* processor = DropTagProcessor::instance(kvstore_); RETURN_FUTURE(processor); } @@ -160,8 +160,8 @@ MetaServiceHandler::future_alterEdge(const cpp2::AlterEdgeReq& req) { } folly::Future -MetaServiceHandler::future_removeEdge(const cpp2::RemoveEdgeReq& req) { - auto* processor = RemoveEdgeProcessor::instance(kvstore_); +MetaServiceHandler::future_dropEdge(const cpp2::DropEdgeReq& req) { + auto* processor = DropEdgeProcessor::instance(kvstore_); RETURN_FUTURE(processor); } diff --git a/src/meta/MetaServiceHandler.h b/src/meta/MetaServiceHandler.h index e251344ca2f..a744a1ef451 100644 --- a/src/meta/MetaServiceHandler.h +++ b/src/meta/MetaServiceHandler.h @@ -75,7 +75,7 @@ class MetaServiceHandler final : public cpp2::MetaServiceSvIf { future_alterTag(const cpp2::AlterTagReq& req) override; folly::Future - future_removeTag(const cpp2::RemoveTagReq& req) override; + future_dropTag(const cpp2::DropTagReq& req) override; folly::Future future_getTag(const cpp2::GetTagReq &req) override; @@ -90,7 +90,7 @@ class MetaServiceHandler final : public cpp2::MetaServiceSvIf { future_alterEdge(const cpp2::AlterEdgeReq& req) override; folly::Future - future_removeEdge(const cpp2::RemoveEdgeReq& req) override; + future_dropEdge(const cpp2::DropEdgeReq& req) override; folly::Future future_getEdge(const cpp2::GetEdgeReq& req) override; diff --git a/src/meta/client/MetaClient.cpp b/src/meta/client/MetaClient.cpp index b30edf9d579..bb9563e39b3 100644 --- a/src/meta/client/MetaClient.cpp +++ b/src/meta/client/MetaClient.cpp @@ -701,12 +701,12 @@ MetaClient::listTagSchemas(GraphSpaceID spaceId) { } folly::Future> -MetaClient::removeTagSchema(int32_t spaceId, std::string tagName) { - cpp2::RemoveTagReq req; +MetaClient::dropTagSchema(int32_t spaceId, std::string tagName) { + cpp2::DropTagReq req; req.set_space_id(spaceId); req.set_tag_name(std::move(tagName)); return getResponse(std::move(req), [] (auto client, auto request) { - return client->future_removeTag(request); + return client->future_dropTag(request); }, [] (cpp2::ExecResp&& resp) -> bool { return resp.code == cpp2::ErrorCode::SUCCEEDED; }, true); @@ -778,12 +778,12 @@ MetaClient::getEdgeSchema(GraphSpaceID spaceId, int32_t edgeType, SchemaVer vers } folly::Future> -MetaClient::removeEdgeSchema(GraphSpaceID spaceId, std::string name) { - cpp2::RemoveEdgeReq req; +MetaClient::dropEdgeSchema(GraphSpaceID spaceId, std::string name) { + cpp2::DropEdgeReq req; req.set_space_id(std::move(spaceId)); req.set_edge_name(std::move(name)); return getResponse(std::move(req), [] (auto client, auto request) { - return client->future_removeEdge(request); + return client->future_dropEdge(request); }, [] (cpp2::ExecResp&& resp) -> bool { return resp.code == cpp2::ErrorCode::SUCCEEDED; }, true); diff --git a/src/meta/client/MetaClient.h b/src/meta/client/MetaClient.h index e3f20bd2ea7..edd50d856ec 100644 --- a/src/meta/client/MetaClient.h +++ b/src/meta/client/MetaClient.h @@ -109,7 +109,7 @@ class MetaClient { listTagSchemas(GraphSpaceID spaceId); folly::Future> - removeTagSchema(int32_t spaceId, std::string name); + dropTagSchema(int32_t spaceId, std::string name); folly::Future> getTagSchema(int32_t spaceId, int32_t tagId, int64_t version); @@ -129,7 +129,7 @@ class MetaClient { getEdgeSchema(GraphSpaceID spaceId, int32_t edgeType, SchemaVer version); folly::Future> - removeEdgeSchema(GraphSpaceID spaceId, std::string name); + dropEdgeSchema(GraphSpaceID spaceId, std::string name); // Operations for custom kv folly::Future> diff --git a/src/meta/processors/RemoveEdgeProcessor.cpp b/src/meta/processors/DropEdgeProcessor.cpp similarity index 86% rename from src/meta/processors/RemoveEdgeProcessor.cpp rename to src/meta/processors/DropEdgeProcessor.cpp index 64dd2fc7f34..7d711c33b03 100644 --- a/src/meta/processors/RemoveEdgeProcessor.cpp +++ b/src/meta/processors/DropEdgeProcessor.cpp @@ -4,12 +4,12 @@ * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ -#include "meta/processors/RemoveEdgeProcessor.h" +#include "meta/processors/DropEdgeProcessor.h" namespace nebula { namespace meta { -void RemoveEdgeProcessor::process(const cpp2::RemoveEdgeReq& req) { +void DropEdgeProcessor::process(const cpp2::DropEdgeReq& req) { CHECK_SPACE_ID_AND_RETURN(req.get_space_id()); folly::SharedMutex::WriteHolder wHolder(LockUtils::edgeLock()); auto ret = getEdgeKeys(req.get_space_id(), req.get_edge_name()); @@ -19,11 +19,11 @@ void RemoveEdgeProcessor::process(const cpp2::RemoveEdgeReq& req) { return; } resp_.set_code(cpp2::ErrorCode::SUCCEEDED); - LOG(INFO) << "Remove Edge " << req.get_edge_name(); + LOG(INFO) << "Drop Edge " << req.get_edge_name(); doMultiRemove(std::move(ret.value())); } -StatusOr> RemoveEdgeProcessor::getEdgeKeys(GraphSpaceID id, +StatusOr> DropEdgeProcessor::getEdgeKeys(GraphSpaceID id, const std::string& edgeName) { auto indexKey = MetaServiceUtils::indexEdgeKey(id, edgeName); std::vector keys; @@ -55,3 +55,4 @@ StatusOr> RemoveEdgeProcessor::getEdgeKeys(GraphSpaceID } // namespace meta } // namespace nebula + diff --git a/src/meta/processors/RemoveEdgeProcessor.h b/src/meta/processors/DropEdgeProcessor.h similarity index 55% rename from src/meta/processors/RemoveEdgeProcessor.h rename to src/meta/processors/DropEdgeProcessor.h index 384eb3ba32e..c86935767f0 100644 --- a/src/meta/processors/RemoveEdgeProcessor.h +++ b/src/meta/processors/DropEdgeProcessor.h @@ -4,24 +4,24 @@ * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ -#ifndef META_REMOVEEDGEPROCESSOR_H_ -#define META_REMOVEEDGEPROCESSOR_H_ +#ifndef META_DROPEDGEPROCESSOR_H_ +#define META_DROPEDGEPROCESSOR_H_ #include "meta/processors/BaseProcessor.h" namespace nebula { namespace meta { -class RemoveEdgeProcessor : public BaseProcessor { +class DropEdgeProcessor : public BaseProcessor { public: - static RemoveEdgeProcessor* instance(kvstore::KVStore* kvstore) { - return new RemoveEdgeProcessor(kvstore); + static DropEdgeProcessor* instance(kvstore::KVStore* kvstore) { + return new DropEdgeProcessor(kvstore); } - void process(const cpp2::RemoveEdgeReq& req); + void process(const cpp2::DropEdgeReq& req); private: - explicit RemoveEdgeProcessor(kvstore::KVStore* kvstore) + explicit DropEdgeProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} StatusOr> getEdgeKeys(GraphSpaceID id, const std::string& edgeName); @@ -30,4 +30,5 @@ class RemoveEdgeProcessor : public BaseProcessor { } // namespace meta } // namespace nebula -#endif // META_REMOVEEDGEPROCESSOR_H_ +#endif // META_DROPEDGEPROCESSOR_H_ + diff --git a/src/meta/processors/RemoveTagProcessor.cpp b/src/meta/processors/DropTagProcessor.cpp similarity index 83% rename from src/meta/processors/RemoveTagProcessor.cpp rename to src/meta/processors/DropTagProcessor.cpp index 08bb0bcd177..f723312aad1 100644 --- a/src/meta/processors/RemoveTagProcessor.cpp +++ b/src/meta/processors/DropTagProcessor.cpp @@ -4,27 +4,27 @@ * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ -#include "meta/processors/RemoveTagProcessor.h" +#include "meta/processors/DropTagProcessor.h" namespace nebula { namespace meta { -void RemoveTagProcessor::process(const cpp2::RemoveTagReq& req) { +void DropTagProcessor::process(const cpp2::DropTagReq& req) { CHECK_SPACE_ID_AND_RETURN(req.get_space_id()); folly::SharedMutex::WriteHolder wHolder(LockUtils::tagLock()); auto ret = getTagKeys(req.get_space_id(), req.get_tag_name()); if (!ret.ok()) { - LOG(ERROR) << "Remove Tag Failed : " << req.get_tag_name() << " not found"; + LOG(ERROR) << "Drop Tag Failed : " << req.get_tag_name() << " not found"; resp_.set_code(cpp2::ErrorCode::E_NOT_FOUND); onFinished(); return; } resp_.set_code(cpp2::ErrorCode::SUCCEEDED); - LOG(INFO) << "Remove Tag " << req.get_tag_name(); + LOG(INFO) << "Drop Tag " << req.get_tag_name(); doMultiRemove(std::move(ret.value())); } -StatusOr> RemoveTagProcessor::getTagKeys(GraphSpaceID id, +StatusOr> DropTagProcessor::getTagKeys(GraphSpaceID id, const std::string& tagName) { auto indexKey = MetaServiceUtils::indexTagKey(id, tagName); std::vector keys; @@ -56,3 +56,4 @@ StatusOr> RemoveTagProcessor::getTagKeys(GraphSpaceID i } // namespace meta } // namespace nebula + diff --git a/src/meta/processors/RemoveTagProcessor.h b/src/meta/processors/DropTagProcessor.h similarity index 54% rename from src/meta/processors/RemoveTagProcessor.h rename to src/meta/processors/DropTagProcessor.h index 8262c293dbe..0b6a777c472 100644 --- a/src/meta/processors/RemoveTagProcessor.h +++ b/src/meta/processors/DropTagProcessor.h @@ -4,24 +4,24 @@ * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ -#ifndef NEBULA_GRAPH_REMOVETAGPROCESSOR_H -#define NEBULA_GRAPH_REMOVETAGPROCESSOR_H +#ifndef META_DROPTAGPROCESSOR_H +#define META_DROPTAGPROCESSOR_H #include "meta/processors/BaseProcessor.h" namespace nebula { namespace meta { -class RemoveTagProcessor : public BaseProcessor { +class DropTagProcessor : public BaseProcessor { public: - static RemoveTagProcessor* instance(kvstore::KVStore* kvstore) { - return new RemoveTagProcessor(kvstore); + static DropTagProcessor* instance(kvstore::KVStore* kvstore) { + return new DropTagProcessor(kvstore); } - void process(const cpp2::RemoveTagReq& req); + void process(const cpp2::DropTagReq& req); private: - explicit RemoveTagProcessor(kvstore::KVStore* kvstore) + explicit DropTagProcessor(kvstore::KVStore* kvstore) : BaseProcessor(kvstore) {} StatusOr> getTagKeys(GraphSpaceID id, const std::string& tagName); @@ -29,4 +29,5 @@ class RemoveTagProcessor : public BaseProcessor { } // namespace meta } // namespace nebula -#endif // NEBULA_GRAPH_REMOVETAGPROCESSOR_H + +#endif // META_DROPTAGPROCESSOR_H diff --git a/src/meta/processors/RemoveHostsProcessor.cpp b/src/meta/processors/RemoveHostsProcessor.cpp index 53c1d56df00..0e27080d72a 100644 --- a/src/meta/processors/RemoveHostsProcessor.cpp +++ b/src/meta/processors/RemoveHostsProcessor.cpp @@ -9,7 +9,6 @@ namespace nebula { namespace meta { - void RemoveHostsProcessor::process(const cpp2::RemoveHostsReq& req) { folly::SharedMutex::WriteHolder wHolder(LockUtils::spaceLock()); std::vector hostsKey; @@ -31,3 +30,4 @@ void RemoveHostsProcessor::process(const cpp2::RemoveHostsReq& req) { } // namespace meta } // namespace nebula + diff --git a/src/meta/processors/RemoveHostsProcessor.h b/src/meta/processors/RemoveHostsProcessor.h index 55ff98f36ce..d7b0de4f3fe 100644 --- a/src/meta/processors/RemoveHostsProcessor.h +++ b/src/meta/processors/RemoveHostsProcessor.h @@ -34,3 +34,4 @@ class RemoveHostsProcessor : public BaseProcessor { } // namespace nebula #endif // META_ADDHOSTSPROCESSOR_H_ + diff --git a/src/meta/test/MetaClientTest.cpp b/src/meta/test/MetaClientTest.cpp index d059cb65783..1844683bc63 100644 --- a/src/meta/test/MetaClientTest.cpp +++ b/src/meta/test/MetaClientTest.cpp @@ -320,7 +320,7 @@ TEST(MetaClientTest, TagTest) { ASSERT_TRUE(result.ok()); } { - auto result = client->removeTagSchema(spaceId, "test_tag").get(); + auto result = client->dropTagSchema(spaceId, "test_tag").get(); ASSERT_TRUE(result.ok()); } { diff --git a/src/meta/test/ProcessorTest.cpp b/src/meta/test/ProcessorTest.cpp index 7a27194f5b3..539702635d6 100644 --- a/src/meta/test/ProcessorTest.cpp +++ b/src/meta/test/ProcessorTest.cpp @@ -19,8 +19,8 @@ #include "meta/processors/GetPartsAllocProcessor.h" #include "meta/processors/CreateTagProcessor.h" #include "meta/processors/CreateEdgeProcessor.h" -#include "meta/processors/RemoveTagProcessor.h" -#include "meta/processors/RemoveEdgeProcessor.h" +#include "meta/processors/DropTagProcessor.h" +#include "meta/processors/DropEdgeProcessor.h" #include "meta/processors/GetTagProcessor.h" #include "meta/processors/GetEdgeProcessor.h" #include "meta/processors/ListTagsProcessor.h" @@ -558,25 +558,24 @@ TEST(ProcessorTest, ListOrGetEdgesTest) { } } -TEST(ProcessorTest, RemoveTagTest) { - fs::TempDir rootPath("/tmp/RemoveTagTest.XXXXXX"); +TEST(ProcessorTest, DropTagTest) { + fs::TempDir rootPath("/tmp/DropTagTest.XXXXXX"); std::unique_ptr kv(TestUtils::initKV(rootPath.path())); ASSERT_TRUE(TestUtils::assembleSpace(kv.get(), 1)); TestUtils::mockTag(kv.get(), 1); - // remove tag processor test { - cpp2::RemoveTagReq req; + // remove tag processor test + cpp2::DropTagReq req; req.set_space_id(1); req.set_tag_name("tag_0"); - auto* processor = RemoveTagProcessor::instance(kv.get()); + auto* processor = DropTagProcessor::instance(kv.get()); auto f = processor->getFuture(); processor->process(req); auto resp = std::move(f).get(); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, resp.get_code()); } - - // check tag data has been deleted. { + // check tag data has been deleted. std::string tagVal; kvstore::ResultCode ret; std::unique_ptr iter; @@ -590,17 +589,17 @@ TEST(ProcessorTest, RemoveTagTest) { } } -TEST(ProcessorTest, RemoveEdgeTest) { - fs::TempDir rootPath("/tmp/RemoveEdgeTest.XXXXXX"); +TEST(ProcessorTest, DropEdgeTest) { + fs::TempDir rootPath("/tmp/DropEdgeTest.XXXXXX"); std::unique_ptr kv(TestUtils::initKV(rootPath.path())); ASSERT_TRUE(TestUtils::assembleSpace(kv.get(), 1)); TestUtils::mockEdge(kv.get(), 1); // Space not exist { - cpp2::RemoveEdgeReq req; + cpp2::DropEdgeReq req; req.set_space_id(0); req.set_edge_name("edge_0"); - auto* processor = RemoveEdgeProcessor::instance(kv.get()); + auto* processor = DropEdgeProcessor::instance(kv.get()); auto f = processor->getFuture(); processor->process(req); auto resp = std::move(f).get(); @@ -608,10 +607,10 @@ TEST(ProcessorTest, RemoveEdgeTest) { } // Edge not exist { - cpp2::RemoveEdgeReq req; + cpp2::DropEdgeReq req; req.set_space_id(1); req.set_edge_name("edge_no"); - auto* processor = RemoveEdgeProcessor::instance(kv.get()); + auto* processor = DropEdgeProcessor::instance(kv.get()); auto f = processor->getFuture(); processor->process(req); auto resp = std::move(f).get(); @@ -619,10 +618,10 @@ TEST(ProcessorTest, RemoveEdgeTest) { } // Succeeded { - cpp2::RemoveEdgeReq req; + cpp2::DropEdgeReq req; req.set_space_id(1); req.set_edge_name("edge_0"); - auto* processor = RemoveEdgeProcessor::instance(kv.get()); + auto* processor = DropEdgeProcessor::instance(kv.get()); auto f = processor->getFuture(); processor->process(req); auto resp = std::move(f).get(); @@ -1059,10 +1058,10 @@ TEST(ProcessorTest, SameNameTagsTest) { // Remove Test { - cpp2::RemoveTagReq req; + cpp2::DropTagReq req; req.set_space_id(1); req.set_tag_name("default_tag"); - auto* processor = RemoveTagProcessor::instance(kv.get()); + auto* processor = DropTagProcessor::instance(kv.get()); auto f = processor->getFuture(); processor->process(req); auto resp = std::move(f).get(); diff --git a/src/parser/MaintainSentences.cpp b/src/parser/MaintainSentences.cpp index 8080d8c501d..09c76f4b916 100644 --- a/src/parser/MaintainSentences.cpp +++ b/src/parser/MaintainSentences.cpp @@ -150,13 +150,12 @@ std::string DescribeEdgeSentence::toString() const { return folly::stringPrintf("DESCRIBE EDGE %s", name_.get()->c_str()); } -std::string RemoveTagSentence::toString() const { - return folly::stringPrintf("REMOVE TAG %s", name_.get()->c_str()); +std::string DropTagSentence::toString() const { + return folly::stringPrintf("DROP TAG %s", name_.get()->c_str()); } - -std::string RemoveEdgeSentence::toString() const { - return folly::stringPrintf("REMOVE TAG %s", name_.get()->c_str()); +std::string DropEdgeSentence::toString() const { + return folly::stringPrintf("DROP EDGE %s", name_.get()->c_str()); } std::string YieldSentence::toString() const { diff --git a/src/parser/MaintainSentences.h b/src/parser/MaintainSentences.h index dd7ad9c6ad1..73d61316e99 100644 --- a/src/parser/MaintainSentences.h +++ b/src/parser/MaintainSentences.h @@ -261,11 +261,11 @@ class DescribeEdgeSentence final : public Sentence { std::unique_ptr name_; }; -class RemoveTagSentence final : public Sentence { +class DropTagSentence final : public Sentence { public: - explicit RemoveTagSentence(std::string *name) { + explicit DropTagSentence(std::string *name) { name_.reset(name); - kind_ = Kind::kRemoveTag; + kind_ = Kind::kDropTag; } std::string toString() const override; @@ -279,11 +279,11 @@ class RemoveTagSentence final : public Sentence { }; -class RemoveEdgeSentence final : public Sentence { +class DropEdgeSentence final : public Sentence { public: - explicit RemoveEdgeSentence(std::string *name) { + explicit DropEdgeSentence(std::string *name) { name_.reset(name); - kind_ = Kind::kRemoveEdge; + kind_ = Kind::kDropEdge; } std::string toString() const override; diff --git a/src/parser/Sentence.h b/src/parser/Sentence.h index 6fbbde933dd..b741eb3e025 100644 --- a/src/parser/Sentence.h +++ b/src/parser/Sentence.h @@ -30,8 +30,8 @@ class Sentence { kAlterEdge, kDescribeTag, kDescribeEdge, - kRemoveTag, - kRemoveEdge, + kDropTag, + kDropEdge, kInsertVertex, kInsertEdge, kShow, diff --git a/src/parser/parser.yy b/src/parser/parser.yy index 25a4fb746fe..3c6445a2137 100644 --- a/src/parser/parser.yy +++ b/src/parser/parser.yy @@ -152,7 +152,7 @@ class GraphScanner; %type create_tag_sentence create_edge_sentence %type alter_tag_sentence alter_edge_sentence %type describe_tag_sentence describe_edge_sentence -%type remove_tag_sentence remove_edge_sentence +%type drop_tag_sentence drop_edge_sentence %type traverse_sentence set_sentence piped_sentence assignment_sentence %type maintain_sentence insert_vertex_sentence insert_edge_sentence %type mutate_sentence update_vertex_sentence update_edge_sentence delete_vertex_sentence delete_edge_sentence @@ -604,15 +604,15 @@ describe_edge_sentence } ; -remove_tag_sentence - : KW_REMOVE KW_TAG name_label { - $$ = new RemoveTagSentence($3); +drop_tag_sentence + : KW_DROP KW_TAG name_label { + $$ = new DropTagSentence($3); } ; -remove_edge_sentence - : KW_REMOVE KW_EDGE name_label { - $$ = new RemoveEdgeSentence($3); +drop_edge_sentence + : KW_DROP KW_EDGE name_label { + $$ = new DropEdgeSentence($3); } ; @@ -1099,8 +1099,8 @@ maintain_sentence | alter_edge_sentence { $$ = $1; } | describe_tag_sentence { $$ = $1; } | describe_edge_sentence { $$ = $1; } - | remove_tag_sentence { $$ = $1; } - | remove_edge_sentence { $$ = $1; } + | drop_tag_sentence { $$ = $1; } + | drop_edge_sentence { $$ = $1; } | show_sentence { $$ = $1; } | add_hosts_sentence { $$ = $1; } | remove_hosts_sentence { $$ = $1; } diff --git a/src/parser/test/ParserTest.cpp b/src/parser/test/ParserTest.cpp index 1acb61954c5..1275a757589 100644 --- a/src/parser/test/ParserTest.cpp +++ b/src/parser/test/ParserTest.cpp @@ -401,7 +401,7 @@ TEST(Parser, AdminOperation) { } { GQLParser parser; - std::string query = "remove hosts 127.0.0.1:1000, 127.0.0.1:9000"; + std::string query = "REMOVE HOSTS 127.0.0.1:1000, 127.0.0.1:9000"; auto result = parser.parse(query); ASSERT_TRUE(result.ok()) << result.status(); }