Skip to content

Commit

Permalink
refactor(interactive): Remove is_builtin in GraphMeta (#3754)
Browse files Browse the repository at this point in the history
On the initialization of Interactive, we will create a builtin
graph(modern_graph). Previously we expose the `builtin` info in
GraphMeta, and user is disallowed to remove the `is_builtin` field in
GraphMeta.

However, the `builtin` info should not be exposed, and user can remove
the modern graph.
  • Loading branch information
zhanglei1949 authored Apr 26, 2024
1 parent 5801538 commit 79fae88
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 30 deletions.
8 changes: 0 additions & 8 deletions flex/engines/http_server/actor/admin_actor.act.cc
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,6 @@ seastar::future<admin_query_result> admin_actor::run_delete_graph(
return seastar::make_ready_future<admin_query_result>(
gs::Result<seastar::sstring>(get_res.status()));
}
// can not delete a builtin graph
if (get_res.value().is_builtin) {
LOG(ERROR) << "Can not delete a builtin graph: " << query_param.content;
return seastar::make_ready_future<admin_query_result>(
gs::Result<seastar::sstring>(gs::Status(
gs::StatusCode::IllegalOperation,
"Can not delete a builtin graph: " + query_param.content)));
}

auto delete_res = metadata_store_->DeleteGraphMeta(query_param.content);

Expand Down
1 change: 0 additions & 1 deletion flex/engines/http_server/service/hqps_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ gs::GraphId HQPSService::insert_default_graph_meta() {
<< schema_str_res.status().error_message();
}
auto request = gs::CreateGraphMetaRequest::FromJson(schema_str_res.value());
request.is_builtin = true;
request.data_update_time = gs::GetCurrentTimeStamp();

auto res = metadata_store_->CreateGraphMeta(request);
Expand Down
17 changes: 0 additions & 17 deletions flex/storages/metadata/graph_meta_store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ std::string GraphMeta::ToJson() const {
nlohmann::json json;
json["id"] = id;
json["name"] = name;
json["is_builtin"] = is_builtin;
json["description"] = description;
json["creation_time"] = creation_time;
json["data_update_time"] = data_update_time;
Expand Down Expand Up @@ -93,7 +92,6 @@ GraphMeta GraphMeta::FromJson(const nlohmann::json& json) {
}

meta.name = json["name"].get<std::string>();
meta.is_builtin = json["is_builtin"].get<bool>();
meta.description = json["description"].get<std::string>();
meta.creation_time = json["creation_time"].get<int64_t>();
meta.schema = json["schema"].dump();
Expand Down Expand Up @@ -296,13 +294,6 @@ JobMeta JobMeta::FromJson(const nlohmann::json& json) {
return meta;
}

bool CreateGraphMetaRequest::GetIsBuiltin() const {
if (is_builtin.has_value()) {
return is_builtin.value();
}
return false;
}

CreateGraphMetaRequest CreateGraphMetaRequest::FromJson(
const std::string& json_str) {
CreateGraphMetaRequest request;
Expand All @@ -317,9 +308,6 @@ CreateGraphMetaRequest CreateGraphMetaRequest::FromJson(
if (json.contains("name")) {
request.name = json["name"].get<std::string>();
}
if (json.contains("is_builtin")) {
request.is_builtin = json["is_builtin"].get<bool>();
}
if (json.contains("description")) {
request.description = json["description"].get<std::string>();
}
Expand All @@ -338,11 +326,6 @@ CreateGraphMetaRequest CreateGraphMetaRequest::FromJson(
std::string CreateGraphMetaRequest::ToString() const {
nlohmann::json json;
json["name"] = name;
if (is_builtin.has_value()) {
json["is_builtin"] = is_builtin.value();
} else {
json["is_builtin"] = false;
}
json["description"] = description;
json["schema"] = nlohmann::json::parse(schema);
if (data_update_time.has_value()) {
Expand Down
4 changes: 0 additions & 4 deletions flex/storages/metadata/graph_meta_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ struct PluginMeta;
struct GraphMeta {
GraphId id;
std::string name;
bool is_builtin;
std::string description;
uint64_t creation_time;
uint64_t data_update_time;
Expand Down Expand Up @@ -125,14 +124,11 @@ struct JobMeta {
////////////////// CreateMetaRequest ///////////////////////
struct CreateGraphMetaRequest {
std::string name;
std::optional<bool> is_builtin;
std::string description;
std::string schema; // all in one string.
std::optional<uint64_t> data_update_time;
int64_t creation_time;

bool GetIsBuiltin() const;

static CreateGraphMetaRequest FromJson(const std::string& json_str);

std::string ToString() const;
Expand Down

0 comments on commit 79fae88

Please sign in to comment.