reformat source code
according to code styles, 'AccessModifierOffset' should be -2.
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
namespace oceanbase {
|
||||
namespace obrpc {
|
||||
class MockObCommonRpcProxy : public ObCommonRpcProxy {
|
||||
public:
|
||||
public:
|
||||
MockObCommonRpcProxy() : ObCommonRpcProxy(this)
|
||||
{}
|
||||
MOCK_METHOD3(
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
namespace oceanbase {
|
||||
namespace obrpc {
|
||||
class MockObSrvRpcProxy : public ObSrvRpcProxy {
|
||||
public:
|
||||
public:
|
||||
MockObSrvRpcProxy() : ObSrvRpcProxy(this)
|
||||
{}
|
||||
|
||||
|
||||
14
deps/oblib/unittest/rpc/rpc_bench.cpp
vendored
14
deps/oblib/unittest/rpc/rpc_bench.cpp
vendored
@ -40,7 +40,7 @@ int io_count = 1;
|
||||
int worker_count = 1;
|
||||
|
||||
class TestProxy : public ObRpcProxy {
|
||||
public:
|
||||
public:
|
||||
DEFINE_TO(TestProxy);
|
||||
|
||||
RPC_S(@PR5 test, OB_TEST_PCODE);
|
||||
@ -53,7 +53,7 @@ int64_t total_count = 0;
|
||||
int64_t total_send_count = 0;
|
||||
|
||||
class MyProcessor : public TestProxy::Processor<OB_TEST_PCODE> {
|
||||
public:
|
||||
public:
|
||||
int process()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -69,7 +69,7 @@ class MyProcessor : public TestProxy::Processor<OB_TEST_PCODE> {
|
||||
};
|
||||
|
||||
class QHandler : public ObiReqQHandler {
|
||||
public:
|
||||
public:
|
||||
bool handlePacketQueue(ObRequest* req, void* args)
|
||||
{
|
||||
UNUSED(args);
|
||||
@ -91,7 +91,7 @@ class QHandler : public ObiReqQHandler {
|
||||
};
|
||||
|
||||
class ObTestDeliver : public rpc::frame::ObReqQDeliver {
|
||||
public:
|
||||
public:
|
||||
ObTestDeliver() : ObReqQDeliver(qhandler_)
|
||||
{}
|
||||
|
||||
@ -130,13 +130,13 @@ class ObTestDeliver : public rpc::frame::ObReqQDeliver {
|
||||
|
||||
void stop(){};
|
||||
|
||||
private:
|
||||
private:
|
||||
ObReqQueueThread queue_;
|
||||
QHandler qhandler_;
|
||||
};
|
||||
|
||||
class Client : public CoKThread {
|
||||
public:
|
||||
public:
|
||||
Client(const TestProxy& proxy, int th_cnt, ObAddr dst, uint32_t sleep_time)
|
||||
: CoKThread(th_cnt), proxy_(proxy), dst_(dst), sleep_time_(sleep_time)
|
||||
{}
|
||||
@ -150,7 +150,7 @@ class Client : public CoKThread {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
const TestProxy& proxy_;
|
||||
const ObAddr dst_;
|
||||
const uint32_t sleep_time_;
|
||||
|
||||
10
deps/oblib/unittest/rpc/test_co_rpc_server.cpp
vendored
10
deps/oblib/unittest/rpc/test_co_rpc_server.cpp
vendored
@ -36,7 +36,7 @@ using namespace std;
|
||||
#define ERROR_MSG "Common error"
|
||||
|
||||
class TestProxy : public ObRpcProxy {
|
||||
public:
|
||||
public:
|
||||
DEFINE_TO(TestProxy);
|
||||
|
||||
RPC_S(@PR5 test, OB_TEST_PCODE);
|
||||
@ -44,7 +44,7 @@ class TestProxy : public ObRpcProxy {
|
||||
};
|
||||
|
||||
class MyProcessor : public TestProxy::Processor<OB_TEST_PCODE> {
|
||||
protected:
|
||||
protected:
|
||||
int process()
|
||||
{
|
||||
static int64_t rpc_count_ = 0;
|
||||
@ -67,7 +67,7 @@ class MyProcessor : public TestProxy::Processor<OB_TEST_PCODE> {
|
||||
};
|
||||
|
||||
class ObTestDeliver : public rpc::frame::ObReqDeliver {
|
||||
public:
|
||||
public:
|
||||
int init()
|
||||
{
|
||||
return 0;
|
||||
@ -97,7 +97,7 @@ class ObTestDeliver : public rpc::frame::ObReqDeliver {
|
||||
};
|
||||
|
||||
class TestRpcServer : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
TestRpcServer() : handler_(server_), transport_(NULL)
|
||||
{}
|
||||
|
||||
@ -118,7 +118,7 @@ class TestRpcServer : public ::testing::Test {
|
||||
net_.stop();
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
rpc::frame::ObNetEasy net_;
|
||||
obrpc::ObRpcHandler handler_;
|
||||
ObTestDeliver server_;
|
||||
|
||||
@ -18,12 +18,12 @@ using namespace oceanbase::rpc;
|
||||
using namespace oceanbase::obmysql;
|
||||
|
||||
class ObFakeMySQLPacket : public ObMySQLPacket {
|
||||
public:
|
||||
public:
|
||||
ObFakeMySQLPacket() : content_len_(0)
|
||||
{}
|
||||
int64_t content_len_;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual int serialize(char* start, const int64_t len, int64_t& pos) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -42,7 +42,7 @@ class ObFakeMySQLPacket : public ObMySQLPacket {
|
||||
};
|
||||
|
||||
class TestMySQLPacket : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
TestMySQLPacket()
|
||||
{}
|
||||
|
||||
|
||||
4
deps/oblib/unittest/rpc/test_mysql_util.cpp
vendored
4
deps/oblib/unittest/rpc/test_mysql_util.cpp
vendored
@ -22,7 +22,7 @@ using namespace oceanbase::common;
|
||||
using namespace oceanbase::obmysql;
|
||||
|
||||
class TestObMySQLUtil : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
TestObMySQLUtil()
|
||||
{}
|
||||
|
||||
@ -32,7 +32,7 @@ class TestObMySQLUtil : public ::testing::Test {
|
||||
virtual void TearDown()
|
||||
{}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
};
|
||||
|
||||
#define PREPEND_ZEROS(char_size, offset, src_str, result_str) \
|
||||
|
||||
4
deps/oblib/unittest/rpc/test_net_client.cpp
vendored
4
deps/oblib/unittest/rpc/test_net_client.cpp
vendored
@ -17,7 +17,7 @@ using namespace oceanbase::obrpc;
|
||||
using namespace oceanbase::common;
|
||||
|
||||
class TestNetClient : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
virtual void SetUp()
|
||||
{
|
||||
client_.init();
|
||||
@ -28,7 +28,7 @@ class TestNetClient : public ::testing::Test {
|
||||
client_.destroy();
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ObNetClient client_;
|
||||
};
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ using namespace oceanbase::rpc;
|
||||
using namespace oceanbase::obrpc;
|
||||
|
||||
class TestObrpcPacket : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
virtual void SetUp()
|
||||
{}
|
||||
|
||||
|
||||
2
deps/oblib/unittest/rpc/test_obrpc_stat.cpp
vendored
2
deps/oblib/unittest/rpc/test_obrpc_stat.cpp
vendored
@ -18,7 +18,7 @@ using namespace oceanbase::rpc;
|
||||
using namespace oceanbase::obrpc;
|
||||
|
||||
class TestObrpcStat : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
virtual void SetUp()
|
||||
{}
|
||||
|
||||
|
||||
12
deps/oblib/unittest/rpc/test_rpc_proxy.cpp
vendored
12
deps/oblib/unittest/rpc/test_rpc_proxy.cpp
vendored
@ -20,7 +20,7 @@ using namespace oceanbase::rpc::frame;
|
||||
|
||||
template <int64_t SZ>
|
||||
struct ArgT {
|
||||
public:
|
||||
public:
|
||||
int64_t sz_ = SZ;
|
||||
int serialize(char* buf, const int64_t buf_len, int64_t& pos) const
|
||||
{
|
||||
@ -47,7 +47,7 @@ static Arg_succ arg_succ;
|
||||
static Arg arg;
|
||||
|
||||
class TestProxy : public ObRpcProxy {
|
||||
public:
|
||||
public:
|
||||
DEFINE_TO(TestProxy);
|
||||
|
||||
RPC_AP(@PR5 test, OB_TEST_PCODE, (uint64_t));
|
||||
@ -60,7 +60,7 @@ class TestProxy : public ObRpcProxy {
|
||||
};
|
||||
|
||||
class TestCB : public TestProxy::AsyncCB<OB_TEST_PCODE> {
|
||||
public:
|
||||
public:
|
||||
TestCB() : processed_(false)
|
||||
{}
|
||||
|
||||
@ -85,7 +85,7 @@ class TestCB : public TestProxy::AsyncCB<OB_TEST_PCODE> {
|
||||
};
|
||||
|
||||
class TestRpcProxy : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
virtual void SetUp()
|
||||
{
|
||||
r_.user_data = &cb_;
|
||||
@ -96,7 +96,7 @@ class TestRpcProxy : public ::testing::Test {
|
||||
virtual void TearDown()
|
||||
{}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void serialize_rcode(const ObRpcResultCode& rc)
|
||||
{
|
||||
int64_t pos = 0;
|
||||
@ -104,7 +104,7 @@ class TestRpcProxy : public ::testing::Test {
|
||||
pkt_.set_content(buf_, pos);
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
TestCB cb_;
|
||||
ObRpcPacket pkt_;
|
||||
easy_request_t r_;
|
||||
|
||||
14
deps/oblib/unittest/rpc/test_rpc_server.cpp
vendored
14
deps/oblib/unittest/rpc/test_rpc_server.cpp
vendored
@ -40,7 +40,7 @@ static constexpr int64_t cluster_id = 1000;
|
||||
static bool change_src_cluster_id = false;
|
||||
|
||||
class TestProxy : public ObRpcProxy {
|
||||
public:
|
||||
public:
|
||||
DEFINE_TO(TestProxy);
|
||||
|
||||
RPC_S(@PR5 test, OB_TEST_PCODE);
|
||||
@ -50,7 +50,7 @@ class TestProxy : public ObRpcProxy {
|
||||
};
|
||||
|
||||
class MyProcessor : public TestProxy::Processor<OB_TEST_PCODE> {
|
||||
protected:
|
||||
protected:
|
||||
int process()
|
||||
{
|
||||
static int64_t rpc_count_ = 0;
|
||||
@ -73,7 +73,7 @@ class MyProcessor : public TestProxy::Processor<OB_TEST_PCODE> {
|
||||
};
|
||||
|
||||
class MyProcessor2 : public TestProxy::Processor<OB_TEST2_PCODE> {
|
||||
protected:
|
||||
protected:
|
||||
int process()
|
||||
{
|
||||
const ObRpcPacket& pkt = dynamic_cast<const ObRpcPacket&>(req_->get_packet());
|
||||
@ -83,7 +83,7 @@ class MyProcessor2 : public TestProxy::Processor<OB_TEST2_PCODE> {
|
||||
};
|
||||
|
||||
class MyProcessor3 : public TestProxy::Processor<OB_TEST3_PCODE> {
|
||||
protected:
|
||||
protected:
|
||||
int process()
|
||||
{
|
||||
const ObRpcPacket& pkt = dynamic_cast<const ObRpcPacket&>(req_->get_packet());
|
||||
@ -99,7 +99,7 @@ class MyProcessor3 : public TestProxy::Processor<OB_TEST3_PCODE> {
|
||||
};
|
||||
|
||||
class ObTestDeliver : public rpc::frame::ObReqDeliver {
|
||||
public:
|
||||
public:
|
||||
int init()
|
||||
{
|
||||
return 0;
|
||||
@ -163,7 +163,7 @@ class ObTestDeliver : public rpc::frame::ObReqDeliver {
|
||||
};
|
||||
|
||||
class TestRpcServer : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
TestRpcServer() : handler_(server_), transport_(NULL)
|
||||
{}
|
||||
|
||||
@ -185,7 +185,7 @@ class TestRpcServer : public ::testing::Test {
|
||||
net_.stop();
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
rpc::frame::ObNetEasy net_;
|
||||
obrpc::ObRpcHandler handler_;
|
||||
ObTestDeliver server_;
|
||||
|
||||
18
deps/oblib/unittest/rpc/test_stream_rpc.cpp
vendored
18
deps/oblib/unittest/rpc/test_stream_rpc.cpp
vendored
@ -37,14 +37,14 @@ using namespace std;
|
||||
#define MAX_NUM 1000
|
||||
|
||||
class TestProxy : public ObRpcProxy {
|
||||
public:
|
||||
public:
|
||||
DEFINE_TO(TestProxy);
|
||||
|
||||
RPC_SS(@PR5 test, OB_TEST_PCODE, (int64_t), int64_t);
|
||||
};
|
||||
|
||||
class MyProcessor : public TestProxy::Processor<OB_TEST_PCODE> {
|
||||
protected:
|
||||
protected:
|
||||
int process()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -66,7 +66,7 @@ class MyProcessor : public TestProxy::Processor<OB_TEST_PCODE> {
|
||||
};
|
||||
|
||||
class QHandler : public ObiReqQHandler {
|
||||
public:
|
||||
public:
|
||||
QHandler()
|
||||
{
|
||||
mp_.init();
|
||||
@ -97,14 +97,14 @@ class QHandler : public ObiReqQHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
MyProcessor mp_;
|
||||
ObRpcSessionHandler shandler_;
|
||||
ObRpcReqContext ctx_;
|
||||
};
|
||||
|
||||
class ObTestDeliver : public rpc::frame::ObReqDeliver {
|
||||
public:
|
||||
public:
|
||||
int init()
|
||||
{
|
||||
queue_.set_qhandler(&handler_);
|
||||
@ -125,13 +125,13 @@ class ObTestDeliver : public rpc::frame::ObReqDeliver {
|
||||
queue_.get_thread().wait();
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ObReqQueueThread queue_;
|
||||
QHandler handler_;
|
||||
};
|
||||
|
||||
class TestRpcServer : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
TestRpcServer() : port_(3100), handler_(server_), transport_(NULL)
|
||||
{}
|
||||
|
||||
@ -167,7 +167,7 @@ class TestRpcServer : public ::testing::Test {
|
||||
return transport_->send(req, res);
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
int port_;
|
||||
rpc::frame::ObNetEasy net_;
|
||||
obrpc::ObRpcHandler handler_;
|
||||
@ -177,7 +177,7 @@ class TestRpcServer : public ::testing::Test {
|
||||
};
|
||||
|
||||
class MySSHandle : public TestProxy::SSHandle<OB_TEST_PCODE> {
|
||||
public:
|
||||
public:
|
||||
void inc_sessid()
|
||||
{
|
||||
sessid_++;
|
||||
|
||||
4
deps/oblib/unittest/rpc/test_testing.cpp
vendored
4
deps/oblib/unittest/rpc/test_testing.cpp
vendored
@ -17,14 +17,14 @@ using namespace oceanbase::common;
|
||||
using namespace oceanbase::obrpc;
|
||||
|
||||
class TestProxy : public ObRpcProxy {
|
||||
public:
|
||||
public:
|
||||
DEFINE_TO(TestProxy);
|
||||
|
||||
RPC_S(PR5 test, OB_TEST_PCODE, (int));
|
||||
};
|
||||
|
||||
class Processor : public TestProxy::Processor<OB_TEST_PCODE> {
|
||||
public:
|
||||
public:
|
||||
int process()
|
||||
{
|
||||
return arg_;
|
||||
|
||||
16
deps/oblib/unittest/rpc/testing.h
vendored
16
deps/oblib/unittest/rpc/testing.h
vendored
@ -34,7 +34,7 @@ class Service {
|
||||
// Deliver is the class that transfers the result of unpacking RpcHandler to the corresponding queue. Here will be
|
||||
// countered The deliver method of Service facilitates the integration of logic into the Service class.
|
||||
class Deliver : public ObReqQDeliver {
|
||||
public:
|
||||
public:
|
||||
Deliver(ObiReqQHandler& qhandler, Service& service) : ObReqQDeliver(qhandler), service_(service)
|
||||
{}
|
||||
int init() override
|
||||
@ -45,24 +45,24 @@ class Service {
|
||||
{}
|
||||
int deliver(rpc::ObRequest& req) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
Service& service_;
|
||||
};
|
||||
// Translator is responsible for translating an ObRequest request into the corresponding Processor. Here will
|
||||
// Reverse the translate method of Service, so that the logic is concentrated in the Service.
|
||||
class Translator : public ObReqTranslator {
|
||||
public:
|
||||
public:
|
||||
Translator(Service& service) : service_(service)
|
||||
{}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ObReqProcessor* get_processor(ObRequest& req) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
Service& service_;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
Service(int listen_port = 33244)
|
||||
: easy_(),
|
||||
translator_(*this),
|
||||
@ -95,11 +95,11 @@ class Service {
|
||||
template <class Proc>
|
||||
int reg_processor(Proc* p);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ObReqProcessor* translate(ObRequest& req);
|
||||
int deliver(ObRequest& req);
|
||||
|
||||
private:
|
||||
private:
|
||||
ObNetEasy easy_;
|
||||
Translator translator_;
|
||||
ObReqQHandler qhandler_;
|
||||
|
||||
Reference in New Issue
Block a user