Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cloud/src/common/bvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ BvarLatencyRecorderWithTag g_bvar_ms_drop_partition("ms", "drop_partition");
BvarLatencyRecorderWithTag g_bvar_ms_get_tablet_stats("ms", "get_tablet_stats");
BvarLatencyRecorderWithTag g_bvar_ms_get_obj_store_info("ms", "get_obj_store_info");
BvarLatencyRecorderWithTag g_bvar_ms_alter_obj_store_info("ms", "alter_obj_store_info");
BvarLatencyRecorderWithTag g_bvar_ms_alter_storage_vault("ms", "alter_storage_vault");
BvarLatencyRecorderWithTag g_bvar_ms_create_instance("ms", "create_instance");
BvarLatencyRecorderWithTag g_bvar_ms_alter_instance("ms", "alter_instance");
BvarLatencyRecorderWithTag g_bvar_ms_alter_cluster("ms", "alter_cluster");
Expand Down
1 change: 1 addition & 0 deletions cloud/src/common/bvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ extern BvarLatencyRecorderWithTag g_bvar_ms_drop_partition;
extern BvarLatencyRecorderWithTag g_bvar_ms_get_tablet_stats;
extern BvarLatencyRecorderWithTag g_bvar_ms_get_obj_store_info;
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_obj_store_info;
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_storage_vault;
extern BvarLatencyRecorderWithTag g_bvar_ms_create_instance;
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_instance;
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_cluster;
Expand Down
12 changes: 12 additions & 0 deletions cloud/src/meta-service/meta_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ class MetaServiceImpl : public cloud::MetaService {
AlterObjStoreInfoResponse* response,
::google::protobuf::Closure* done) override;

void alter_storage_vault(google::protobuf::RpcController* controller,
const AlterObjStoreInfoRequest* request,
AlterObjStoreInfoResponse* response,
::google::protobuf::Closure* done) override;

void update_ak_sk(google::protobuf::RpcController* controller, const UpdateAkSkRequest* request,
UpdateAkSkResponse* response, ::google::protobuf::Closure* done) override;

Expand Down Expand Up @@ -485,6 +490,13 @@ class MetaServiceProxy final : public MetaService {
call_impl(&cloud::MetaService::alter_obj_store_info, controller, request, response, done);
}

void alter_storage_vault(google::protobuf::RpcController* controller,
const AlterObjStoreInfoRequest* request,
AlterObjStoreInfoResponse* response,
::google::protobuf::Closure* done) override {
call_impl(&cloud::MetaService::alter_storage_vault, controller, request, response, done);
}

void update_ak_sk(google::protobuf::RpcController* controller, const UpdateAkSkRequest* request,
UpdateAkSkResponse* response, ::google::protobuf::Closure* done) override {
call_impl(&cloud::MetaService::update_ak_sk, controller, request, response, done);
Expand Down
34 changes: 27 additions & 7 deletions cloud/src/meta-service/meta_service_http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,26 @@ static HttpResponse process_get_obj_store_info(MetaServiceImpl* service, brpc::C
static HttpResponse process_alter_obj_store_info(MetaServiceImpl* service, brpc::Controller* ctrl) {
static std::unordered_map<std::string_view, AlterObjStoreInfoRequest::Operation> operations {
{"add_obj_info", AlterObjStoreInfoRequest::ADD_OBJ_INFO},
{"legacy_update_ak_sk", AlterObjStoreInfoRequest::LEGACY_UPDATE_AK_SK},
{"legacy_update_ak_sk", AlterObjStoreInfoRequest::LEGACY_UPDATE_AK_SK}};

auto& path = ctrl->http_request().unresolved_path();
auto it = operations.find(remove_version_prefix(path));
if (it == operations.end()) {
std::string msg = "not supportted alter obj store info operation: " + path;
return http_json_reply(MetaServiceCode::INVALID_ARGUMENT, msg);
}

AlterObjStoreInfoRequest req;
PARSE_MESSAGE_OR_RETURN(ctrl, req);
req.set_op(it->second);

AlterObjStoreInfoResponse resp;
service->alter_obj_store_info(ctrl, &req, &resp, nullptr);
return http_json_reply(resp.status());
}

static HttpResponse process_alter_storage_vault(MetaServiceImpl* service, brpc::Controller* ctrl) {
static std::unordered_map<std::string_view, AlterObjStoreInfoRequest::Operation> operations {
{"drop_s3_vault", AlterObjStoreInfoRequest::DROP_S3_VAULT},
{"add_s3_vault", AlterObjStoreInfoRequest::ADD_S3_VAULT},
{"drop_hdfs_vault", AlterObjStoreInfoRequest::DROP_HDFS_INFO},
Expand All @@ -217,7 +236,7 @@ static HttpResponse process_alter_obj_store_info(MetaServiceImpl* service, brpc:
auto& path = ctrl->http_request().unresolved_path();
auto it = operations.find(remove_version_prefix(path));
if (it == operations.end()) {
std::string msg = "not supportted alter obj store info operation: " + path;
std::string msg = "not supportted alter storage vault operation: " + path;
return http_json_reply(MetaServiceCode::INVALID_ARGUMENT, msg);
}

Expand All @@ -226,7 +245,7 @@ static HttpResponse process_alter_obj_store_info(MetaServiceImpl* service, brpc:
req.set_op(it->second);

AlterObjStoreInfoResponse resp;
service->alter_obj_store_info(ctrl, &req, &resp, nullptr);
service->alter_storage_vault(ctrl, &req, &resp, nullptr);
return http_json_reply(resp.status());
}

Expand Down Expand Up @@ -447,10 +466,11 @@ void MetaServiceImpl::http(::google::protobuf::RpcController* controller,
{"v1/legacy_update_ak_sk", process_alter_obj_store_info},
{"v1/update_ak_sk", process_update_ak_sk},
{"show_storage_vaults", process_get_obj_store_info},
{"add_hdfs_vault", process_alter_obj_store_info},
{"add_s3_vault", process_alter_obj_store_info},
{"drop_s3_vault", process_alter_obj_store_info},
{"drop_hdfs_vault", process_alter_obj_store_info},
{"add_hdfs_vault", process_alter_storage_vault},
{"add_s3_vault", process_alter_storage_vault},
{"alter_s3_vault", process_alter_storage_vault},
{"drop_s3_vault", process_alter_storage_vault},
{"drop_hdfs_vault", process_alter_storage_vault},
// for tools
{"decode_key", process_decode_key},
{"encode_key", process_encode_key},
Expand Down
Loading