Skip to content

Commit 535b395

Browse files
authored
refactor: change namesapce: fedb -> openmldb (#101)
* Change name: fedb -> openmldb * clang format * NOLINT
1 parent 0e15032 commit 535b395

File tree

193 files changed

+10377
-13601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+10377
-13601
lines changed

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ endif()
103103
add_executable(parse_log tools/parse_log.cc $<TARGET_OBJECTS:fedb_proto>)
104104
target_link_libraries(parse_log log fedb_proto base protobuf glog gflags unwind ssl crypto z snappy dl pthread)
105105

106-
add_executable(fedb cmd/fedb.cc base/status.cc proto/client.pb.cc base/linenoise.cc)
107-
target_link_libraries(fedb ${BIN_LIBS})
106+
add_executable(openmldb cmd/openmldb.cc base/status.cc proto/client.pb.cc base/linenoise.cc)
107+
target_link_libraries(openmldb ${BIN_LIBS})
108108

109109
add_subdirectory(sdk)

src/apiserver/api_server_impl.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
#include "apiserver/interface_provider.h"
2424
#include "brpc/server.h"
2525

26-
namespace fedb {
26+
namespace openmldb {
2727
namespace http {
2828

2929
APIServerImpl::~APIServerImpl() = default;
3030

3131
bool APIServerImpl::Init(const sdk::ClusterOptions& options) {
3232
// If cluster sdk is needed, use ptr, don't own it. SQLClusterRouter owns it.
33-
auto cluster_sdk = new ::fedb::sdk::ClusterSDK(options);
33+
auto cluster_sdk = new ::openmldb::sdk::ClusterSDK(options);
3434
bool ok = cluster_sdk->Init();
3535
if (!ok) {
3636
LOG(ERROR) << "Fail to connect to db";
@@ -39,10 +39,10 @@ bool APIServerImpl::Init(const sdk::ClusterOptions& options) {
3939
return Init(cluster_sdk);
4040
}
4141

42-
bool APIServerImpl::Init(::fedb::sdk::ClusterSDK* cluster) {
42+
bool APIServerImpl::Init(::openmldb::sdk::ClusterSDK* cluster) {
4343
// If cluster sdk is needed, use ptr, don't own it. SQLClusterRouter owns it.
4444
cluster_sdk_ = cluster;
45-
auto router = std::make_shared<::fedb::sdk::SQLClusterRouter>(cluster_sdk_);
45+
auto router = std::make_shared<::openmldb::sdk::SQLClusterRouter>(cluster_sdk_);
4646
if (!router->Init()) {
4747
LOG(ERROR) << "Fail to connect to db";
4848
return false;
@@ -75,7 +75,7 @@ void APIServerImpl::Process(google::protobuf::RpcController* cntl_base, const Ht
7575

7676
bool APIServerImpl::Json2SQLRequestRow(const butil::rapidjson::Value& non_common_cols_v,
7777
const butil::rapidjson::Value& common_cols_v,
78-
std::shared_ptr<fedb::sdk::SQLRequestRow> row) {
78+
std::shared_ptr<openmldb::sdk::SQLRequestRow> row) {
7979
auto sch = row->GetSchema();
8080

8181
// scan all strings to init the total string length
@@ -172,7 +172,7 @@ bool APIServerImpl::AppendJsonValue(const butil::rapidjson::Value& v, hybridse::
172172
return false;
173173
}
174174
std::vector<std::string> parts;
175-
::fedb::base::SplitString(v.GetString(), "-", parts);
175+
::openmldb::base::SplitString(v.GetString(), "-", parts);
176176
if (parts.size() != 3) {
177177
return false;
178178
}
@@ -315,7 +315,7 @@ void APIServerImpl::RegisterExecSP() {
315315
const auto& schema_impl = dynamic_cast<const ::hybridse::sdk::SchemaImpl&>(sp_info->GetInputSchema());
316316
// Hard copy, and RequestRow needs shared schema
317317
auto input_schema = std::make_shared<::hybridse::sdk::SchemaImpl>(schema_impl.GetSchema());
318-
auto common_column_indices = std::make_shared<fedb::sdk::ColumnIndicesSet>(input_schema);
318+
auto common_column_indices = std::make_shared<openmldb::sdk::ColumnIndicesSet>(input_schema);
319319
decltype(common_cols_v.Size()) expected_common_size = 0;
320320
for (int i = 0; i < input_schema->GetColumnCnt(); ++i) {
321321
if (input_schema->IsConstant(i)) {
@@ -435,7 +435,7 @@ void APIServerImpl::RegisterGetTable() {
435435
writer.Member("msg") & std::string("ok");
436436
writer.Member("tables");
437437
writer.StartArray();
438-
for (std::shared_ptr<::fedb::nameserver::TableInfo> table : tables) {
438+
for (std::shared_ptr<::openmldb::nameserver::TableInfo> table : tables) {
439439
writer << table;
440440
}
441441
writer.EndArray();
@@ -648,15 +648,15 @@ JsonWriter& operator&(JsonWriter& ar, GetSPResp& s) { // NOLINT
648648
}
649649

650650
JsonWriter& operator&(JsonWriter& ar, // NOLINT
651-
const ::google::protobuf::RepeatedPtrField<::fedb::common::ColumnDesc>& column_desc) {
651+
const ::google::protobuf::RepeatedPtrField<::openmldb::common::ColumnDesc>& column_desc) {
652652
ar.StartArray();
653653
for (auto column : column_desc) {
654654
ar.StartObject();
655655
if (column.has_name()) {
656656
ar.Member("name") & column.name();
657657
}
658658
if (column.has_data_type()) {
659-
ar.Member("data_type") & ::fedb::type::DataType_Name(column.data_type());
659+
ar.Member("data_type") & ::openmldb::type::DataType_Name(column.data_type());
660660
}
661661
if (column.has_not_null()) {
662662
ar.Member("not_null") & column.not_null();
@@ -670,7 +670,7 @@ JsonWriter& operator&(JsonWriter& ar, // NOLINT
670670
}
671671

672672
JsonWriter& operator&(JsonWriter& ar, // NOLINT
673-
const ::google::protobuf::RepeatedPtrField<::fedb::common::ColumnKey>& column_key) {
673+
const ::google::protobuf::RepeatedPtrField<::openmldb::common::ColumnKey>& column_key) {
674674
ar.StartArray();
675675
for (auto key : column_key) {
676676
ar.StartObject();
@@ -695,7 +695,7 @@ JsonWriter& operator&(JsonWriter& ar, // NOLINT
695695
auto& ttl = key.ttl();
696696
ar.StartObject();
697697
if (ttl.has_ttl_type()) {
698-
ar.Member("ttl_type") & ::fedb::type::TTLType_Name(ttl.ttl_type());
698+
ar.Member("ttl_type") & ::openmldb::type::TTLType_Name(ttl.ttl_type());
699699
}
700700
if (ttl.has_abs_ttl()) {
701701
ar.Member("abs_ttl") & ttl.abs_ttl();
@@ -711,7 +711,7 @@ JsonWriter& operator&(JsonWriter& ar, // NOLINT
711711
}
712712

713713
JsonWriter& operator&(JsonWriter& ar, // NOLINT
714-
const ::google::protobuf::RepeatedPtrField<::fedb::common::VersionPair>& schema_versions) {
714+
const ::google::protobuf::RepeatedPtrField<::openmldb::common::VersionPair>& schema_versions) {
715715
ar.StartArray();
716716
for (auto version : schema_versions) {
717717
ar.StartObject();
@@ -726,7 +726,7 @@ JsonWriter& operator&(JsonWriter& ar, // NOLINT
726726
return ar.EndArray();
727727
}
728728

729-
JsonWriter& operator&(JsonWriter& ar, std::shared_ptr<::fedb::nameserver::TableInfo> info) { // NOLINT
729+
JsonWriter& operator&(JsonWriter& ar, std::shared_ptr<::openmldb::nameserver::TableInfo> info) { // NOLINT
730730
ar.StartObject();
731731
if (info->has_name()) {
732732
ar.Member("name") & info->name();
@@ -745,7 +745,7 @@ JsonWriter& operator&(JsonWriter& ar, std::shared_ptr<::fedb::nameserver::TableI
745745
ar.Member("replica_num") & info->replica_num();
746746
}
747747
if (info->has_compress_type()) {
748-
ar.Member("compress_type") & ::fedb::type::CompressType_Name(info->compress_type());
748+
ar.Member("compress_type") & ::openmldb::type::CompressType_Name(info->compress_type());
749749
}
750750
if (info->has_key_entry_max_height()) {
751751
ar.Member("key_entry_max_height") & info->key_entry_max_height();
@@ -776,4 +776,4 @@ JsonWriter& operator&(JsonWriter& ar, std::shared_ptr<::fedb::nameserver::TableI
776776
}
777777

778778
} // namespace http
779-
} // namespace fedb
779+
} // namespace openmldb

src/apiserver/api_server_impl.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
#include "proto/http.pb.h"
2929
#include "sdk/sql_cluster_router.h"
3030

31-
namespace fedb {
31+
namespace openmldb {
3232
namespace http {
3333

3434
using butil::rapidjson::Document;
3535
using butil::rapidjson::StringBuffer;
3636
using butil::rapidjson::Writer;
3737

38-
// APIServer is a service for brpc::Server. The entire implement is `StartAPIServer()` in src/cmd/fedb.cc
38+
// APIServer is a service for brpc::Server. The entire implement is `StartAPIServer()` in src/cmd/openmldb.cc
3939
// Every request is handled by `Process()`, we will choose the right method of the request by `InterfaceProvider`.
4040
// InterfaceProvider's url parser supports to parse urls like "/a/:arg1/b/:arg2/:arg3", but doesn't support wildcards.
4141
// Methods should be registered in `InterfaceProvider` in the init phase.
@@ -45,7 +45,7 @@ class APIServerImpl : public APIServer {
4545
APIServerImpl() = default;
4646
~APIServerImpl() override;
4747
bool Init(const sdk::ClusterOptions& options);
48-
bool Init(::fedb::sdk::ClusterSDK* cluster);
48+
bool Init(::openmldb::sdk::ClusterSDK* cluster);
4949
void Process(google::protobuf::RpcController* cntl_base, const HttpRequest*, HttpResponse*,
5050
google::protobuf::Closure* done) override;
5151

@@ -58,7 +58,7 @@ class APIServerImpl : public APIServer {
5858

5959
static bool Json2SQLRequestRow(const butil::rapidjson::Value& non_common_cols_v,
6060
const butil::rapidjson::Value& common_cols_v,
61-
std::shared_ptr<fedb::sdk::SQLRequestRow> row);
61+
std::shared_ptr<openmldb::sdk::SQLRequestRow> row);
6262
template <typename T>
6363
static bool AppendJsonValue(const butil::rapidjson::Value& v, hybridse::sdk::DataType type, bool is_not_null,
6464
T row);
@@ -67,7 +67,7 @@ class APIServerImpl : public APIServer {
6767
std::shared_ptr<sdk::SQLRouter> sql_router_;
6868
InterfaceProvider provider_;
6969
// cluster_sdk_ is not owned by this class.
70-
::fedb::sdk::ClusterSDK* cluster_sdk_;
70+
::openmldb::sdk::ClusterSDK* cluster_sdk_;
7171
};
7272

7373
struct PutResp {
@@ -114,14 +114,14 @@ JsonWriter& operator&(JsonWriter& ar, std::shared_ptr<hybridse::sdk::ProcedureIn
114114
JsonWriter& operator&(JsonWriter& ar, GetSPResp& s); // NOLINT
115115

116116
JsonWriter& operator&(JsonWriter& ar, // NOLINT
117-
const ::google::protobuf::RepeatedPtrField<::fedb::common::ColumnDesc>& column_desc);
117+
const ::google::protobuf::RepeatedPtrField<::openmldb::common::ColumnDesc>& column_desc);
118118

119119
JsonWriter& operator&(JsonWriter& ar, // NOLINT
120-
const ::google::protobuf::RepeatedPtrField<::fedb::common::ColumnKey>& column_key);
120+
const ::google::protobuf::RepeatedPtrField<::openmldb::common::ColumnKey>& column_key);
121121

122-
JsonWriter& operator&(JsonWriter& ar, std::shared_ptr<::fedb::nameserver::TableInfo> info); // NOLINT
122+
JsonWriter& operator&(JsonWriter& ar, std::shared_ptr<::openmldb::nameserver::TableInfo> info); // NOLINT
123123

124124
} // namespace http
125-
} // namespace fedb
125+
} // namespace openmldb
126126

127127
#endif // SRC_APISERVER_API_SERVER_IMPL_H_

src/apiserver/api_server_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "json2pb/rapidjson.h"
2525
#include "sdk/mini_cluster.h"
2626

27-
namespace fedb {
27+
namespace openmldb {
2828
namespace http {
2929

3030
class APIServerTestEnv : public testing::Environment {
@@ -45,7 +45,7 @@ class APIServerTestEnv : public testing::Environment {
4545
cluster_options.zk_cluster = mc->GetZkCluster();
4646
cluster_options.zk_path = mc->GetZkPath();
4747
// Owned by queue_svc
48-
cluster_sdk = new ::fedb::sdk::ClusterSDK(cluster_options);
48+
cluster_sdk = new ::openmldb::sdk::ClusterSDK(cluster_options);
4949
ASSERT_TRUE(cluster_sdk->Init()) << "Fail to connect to db";
5050
queue_svc.reset(new APIServerImpl);
5151
ASSERT_TRUE(queue_svc->Init(cluster_sdk));
@@ -95,7 +95,7 @@ class APIServerTestEnv : public testing::Environment {
9595
}
9696

9797
std::string db;
98-
::fedb::sdk::ClusterSDK* cluster_sdk;
98+
::openmldb::sdk::ClusterSDK* cluster_sdk;
9999
std::shared_ptr<sdk::MiniCluster> mc;
100100
std::shared_ptr<APIServerImpl> queue_svc;
101101
brpc::Server server;
@@ -639,10 +639,10 @@ TEST_F(APIServerTest, getTables) {
639639
}
640640

641641
} // namespace http
642-
} // namespace fedb
642+
} // namespace openmldb
643643

644644
int main(int argc, char* argv[]) {
645-
testing::AddGlobalTestEnvironment(fedb::http::APIServerTestEnv::Instance());
645+
testing::AddGlobalTestEnvironment(openmldb::http::APIServerTestEnv::Instance());
646646
::testing::InitGoogleTest(&argc, argv);
647647
::google::ParseCommandLineFlags(&argc, &argv, true);
648648
return RUN_ALL_TESTS();

src/apiserver/interface_provider.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "boost/algorithm/string/split.hpp"
2828
#include "glog/logging.h"
2929

30-
namespace fedb {
30+
namespace openmldb {
3131
namespace http {
3232

3333
std::vector<std::unique_ptr<PathPart>> Url::parsePath(bool disableIds) const {
@@ -194,4 +194,4 @@ bool InterfaceProvider::handle(const std::string& path, const brpc::HttpMethod&
194194
return true;
195195
}
196196
} // namespace http
197-
} // namespace fedb
197+
} // namespace openmldb

src/apiserver/interface_provider.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "butil/iobuf.h" // IOBuf
3535
#include "proto/http.pb.h"
3636

37-
namespace fedb {
37+
namespace openmldb {
3838
namespace http {
3939

4040
class PathPart;
@@ -183,4 +183,4 @@ Archiver& operator&(Archiver& ar, GeneralError& s) { // NOLINT
183183
}
184184

185185
} // namespace http
186-
} // namespace fedb
186+
} // namespace openmldb

src/apiserver/json_helper.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include "json2pb/rapidjson.h" // rapidjson's DOM-style API
2222

23-
namespace fedb {
23+
namespace openmldb {
2424
namespace http {
2525

2626
using butil::rapidjson::Document;
@@ -323,4 +323,4 @@ JsonWriter& JsonWriter::SetNull() {
323323
return *this;
324324
}
325325
} // namespace http
326-
} // namespace fedb
326+
} // namespace openmldb

src/apiserver/json_helper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <cstddef>
2121
#include <string>
2222

23-
namespace fedb {
23+
namespace openmldb {
2424
namespace http {
2525

2626
/**
@@ -138,6 +138,6 @@ JsonWriter& operator<<(JsonWriter& ar, T& s) {
138138
}
139139

140140
} // namespace http
141-
} // namespace fedb
141+
} // namespace openmldb
142142

143143
#endif // SRC_APISERVER_JSON_HELPER_H_

src/base/count_down_latch.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17-
1817
#ifndef SRC_BASE_COUNT_DOWN_LATCH_H_
1918
#define SRC_BASE_COUNT_DOWN_LATCH_H_
20-
#include <condition_variable> // NOLINT
21-
#include <mutex> // NOLINT
19+
#include <condition_variable> // NOLINT
20+
#include <mutex> // NOLINT
2221

23-
namespace fedb {
22+
namespace openmldb {
2423
namespace base {
2524

2625
class CountDownLatch {
@@ -64,5 +63,5 @@ class CountDownLatch {
6463
};
6564

6665
} // namespace base
67-
} // namespace fedb
66+
} // namespace openmldb
6867
#endif // SRC_BASE_COUNT_DOWN_LATCH_H_

src/base/count_down_latch_test.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
1817
#include "base/count_down_latch.h"
18+
1919
#include "boost/bind.hpp"
20-
#include "gtest/gtest.h"
2120
#include "common/thread_pool.h"
22-
21+
#include "gtest/gtest.h"
2322

2423
using ::baidu::common::ThreadPool;
2524

26-
namespace fedb {
25+
namespace openmldb {
2726
namespace base {
2827

2928
class CountDownLatchTest : public ::testing::Test {
@@ -63,7 +62,7 @@ TEST_F(CountDownLatchTest, MultiIsDone) {
6362
}
6463

6564
} // namespace base
66-
} // namespace fedb
65+
} // namespace openmldb
6766

6867
int main(int argc, char** argv) {
6968
::testing::InitGoogleTest(&argc, argv);

0 commit comments

Comments
 (0)