Skip to content

Commit

Permalink
fix: minicluster options scope
Browse files Browse the repository at this point in the history
  • Loading branch information
oh2024 committed Apr 10, 2024
1 parent 1b00199 commit 6af6756
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/sdk/mini_cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ class MiniCluster {
[this](const std::string& host, const std::string& username, const std::string& password) {
return user_access_manager_->IsAuthenticated(host, username, password);
});
options_.auth = ns_authenticator_;
brpc::ServerOptions options;
options.auth = ns_authenticator_;
if (ns_.AddService(nameserver, brpc::SERVER_OWNS_SERVICE) != 0) {
LOG(WARNING) << "fail to add ns";
return false;
}
if (ns_.Start(ns_endpoint.c_str(), &options_) != 0) {
if (ns_.Start(ns_endpoint.c_str(), &options) != 0) {
LOG(WARNING) << "fail to start ns";
return false;
}
Expand Down Expand Up @@ -203,13 +204,14 @@ class MiniCluster {
if (!ok) {
return false;
}
ts_opt_.auth = &tablet_authenticator_;
brpc::ServerOptions ts_opt;
ts_opt.auth = &tablet_authenticator_;

if (tb_server->AddService(tablet, brpc::SERVER_OWNS_SERVICE) != 0) {
LOG(WARNING) << "fail to add tablet";
return false;
}
if (tb_server->Start(tb_endpoint.c_str(), &ts_opt_) != 0) {
if (tb_server->Start(tb_endpoint.c_str(), &ts_opt) != 0) {
LOG(WARNING) << "fail to start tablet";
return false;
}
Expand Down Expand Up @@ -244,8 +246,6 @@ class MiniCluster {
openmldb::authn::BRPCAuthenticator* ns_authenticator_;
openmldb::auth::UserAccessManager* user_access_manager_;
std::shared_ptr<::openmldb::nameserver::TableInfo> user_table_info_;
brpc::ServerOptions options_;
brpc::ServerOptions ts_opt_;
};

class StandaloneEnv {
Expand Down Expand Up @@ -298,12 +298,13 @@ class StandaloneEnv {
[this](const std::string& host, const std::string& username, const std::string& password) {
return user_access_manager_->IsAuthenticated(host, username, password);
});
options_.auth = ns_authenticator_;
brpc::ServerOptions options;
options.auth = ns_authenticator_;
if (ns_.AddService(nameserver, brpc::SERVER_OWNS_SERVICE) != 0) {
LOG(WARNING) << "fail to add ns";
return false;
}
if (ns_.Start(ns_endpoint.c_str(), &options_) != 0) {
if (ns_.Start(ns_endpoint.c_str(), &options) != 0) {
LOG(WARNING) << "fail to start ns";
return false;
}
Expand Down Expand Up @@ -349,12 +350,13 @@ class StandaloneEnv {
if (!ok) {
return false;
}
ts_opt_.auth = &tablet_authenticator_;
brpc::ServerOptions ts_opt;
ts_opt.auth = &tablet_authenticator_;
if (tb_server->AddService(tablet, brpc::SERVER_OWNS_SERVICE) != 0) {
LOG(WARNING) << "fail to add tablet";
return false;
}
if (tb_server->Start(tb_endpoint.c_str(), &ts_opt_) != 0) {
if (tb_server->Start(tb_endpoint.c_str(), &ts_opt) != 0) {
LOG(WARNING) << "fail to start tablet";
return false;
}
Expand All @@ -379,8 +381,6 @@ class StandaloneEnv {
openmldb::authn::BRPCAuthenticator* ns_authenticator_;
openmldb::auth::UserAccessManager* user_access_manager_;
std::shared_ptr<::openmldb::nameserver::TableInfo> user_table_info_;

Check warning on line 383 in src/sdk/mini_cluster.h

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] reported by reviewdog 🐶 Add #include <memory> for shared_ptr<> [build/include_what_you_use] [4] Raw Output: src/sdk/mini_cluster.h:383: Add #include <memory> for shared_ptr<> [build/include_what_you_use] [4]
brpc::ServerOptions options_;
brpc::ServerOptions ts_opt_;
};

} // namespace sdk
Expand Down

0 comments on commit 6af6756

Please sign in to comment.