Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
0a7432f0
Commit
0a7432f0
authored
Jun 21, 2019
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use descriptor of default_instance in base
parent
dd3fb73f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
27 additions
and
102 deletions
+27
-102
esp_message.cpp
src/brpc/esp_message.cpp
+4
-11
esp_message.h
src/brpc/esp_message.h
+1
-4
memcache.cpp
src/brpc/memcache.cpp
+6
-20
memcache.h
src/brpc/memcache.h
+0
-5
nshead_message.cpp
src/brpc/nshead_message.cpp
+3
-10
nshead_message.h
src/brpc/nshead_message.h
+1
-4
redis.cpp
src/brpc/redis.cpp
+6
-20
redis.h
src/brpc/redis.h
+0
-4
serialized_request.cpp
src/brpc/serialized_request.cpp
+3
-10
serialized_request.h
src/brpc/serialized_request.h
+0
-2
thrift_message.cpp
src/brpc/thrift_message.cpp
+3
-10
thrift_message.h
src/brpc/thrift_message.h
+0
-2
No files found.
src/brpc/esp_message.cpp
View file @
0a7432f0
...
...
@@ -14,13 +14,11 @@
#include "esp_message.h"
#include <google/protobuf/reflection_ops.h>
// ReflectionOps::Merge
#include <google/protobuf/reflection_ops.h> // ReflectionOps::Merge
#include <google/protobuf/wire_format.h> // WireFormatLite::GetTagWireType
namespace
brpc
{
EspMessageBase
EspMessage
::
_base
;
EspMessage
::
EspMessage
()
:
::
google
::
protobuf
::
Message
()
{
SharedCtor
();
...
...
@@ -44,12 +42,7 @@ void EspMessage::SharedDtor() {
}
const
::
google
::
protobuf
::
Descriptor
*
EspMessage
::
descriptor
()
{
return
_base
.
GetDescriptor
();
}
const
EspMessage
&
EspMessage
::
default_instance
()
{
static
EspMessage
req
;
return
req
;
return
EspMessageBase
::
descriptor
();
}
EspMessage
*
EspMessage
::
New
()
const
{
...
...
@@ -138,8 +131,8 @@ void EspMessage::Swap(EspMessage* other) {
::
google
::
protobuf
::
Metadata
EspMessage
::
GetMetadata
()
const
{
::
google
::
protobuf
::
Metadata
metadata
;
metadata
.
descriptor
=
_base
.
GetD
escriptor
();
metadata
.
reflection
=
_base
.
GetReflection
()
;
metadata
.
descriptor
=
EspMessage
::
d
escriptor
();
metadata
.
reflection
=
NULL
;
return
metadata
;
}
...
...
src/brpc/esp_message.h
View file @
0a7432f0
...
...
@@ -73,11 +73,8 @@ protected:
private
:
void
SharedCtor
();
void
SharedDtor
();
static
EspMessageBase
_base
;
};
}
// namespace brpc
#endif // PROTOBUF_esp_5fmessage_2eproto__INCLUDED
#endif // BRPC_ESP_MESSAGE_H
src/brpc/memcache.cpp
View file @
0a7432f0
...
...
@@ -26,8 +26,6 @@
namespace
brpc
{
MemcacheRequestBase
MemcacheRequest
::
_base
;
MemcacheRequest
::
MemcacheRequest
()
:
::
google
::
protobuf
::
Message
()
{
SharedCtor
();
...
...
@@ -56,12 +54,7 @@ void MemcacheRequest::SetCachedSize(int size) const {
}
const
::
google
::
protobuf
::
Descriptor
*
MemcacheRequest
::
descriptor
()
{
return
_base
.
GetDescriptor
();
}
const
MemcacheRequest
&
MemcacheRequest
::
default_instance
()
{
static
MemcacheRequest
req
;
return
req
;
return
MemcacheRequestBase
::
descriptor
();
}
MemcacheRequest
*
MemcacheRequest
::
New
()
const
{
...
...
@@ -174,13 +167,11 @@ void MemcacheRequest::Swap(MemcacheRequest* other) {
::
google
::
protobuf
::
Metadata
MemcacheRequest
::
GetMetadata
()
const
{
::
google
::
protobuf
::
Metadata
metadata
;
metadata
.
descriptor
=
_base
.
GetD
escriptor
();
metadata
.
reflection
=
_base
.
GetReflection
()
;
metadata
.
descriptor
=
MemcacheRequest
::
d
escriptor
();
metadata
.
reflection
=
NULL
;
return
metadata
;
}
MemcacheResponseBase
MemcacheResponse
::
_base
;
MemcacheResponse
::
MemcacheResponse
()
:
::
google
::
protobuf
::
Message
()
{
SharedCtor
();
...
...
@@ -207,12 +198,7 @@ void MemcacheResponse::SetCachedSize(int size) const {
_cached_size_
=
size
;
}
const
::
google
::
protobuf
::
Descriptor
*
MemcacheResponse
::
descriptor
()
{
return
_base
.
GetDescriptor
();
}
const
MemcacheResponse
&
MemcacheResponse
::
default_instance
()
{
static
MemcacheResponse
res
;
return
res
;
return
MemcacheResponseBase
::
descriptor
();
}
MemcacheResponse
*
MemcacheResponse
::
New
()
const
{
...
...
@@ -303,8 +289,8 @@ void MemcacheResponse::Swap(MemcacheResponse* other) {
::
google
::
protobuf
::
Metadata
MemcacheResponse
::
GetMetadata
()
const
{
::
google
::
protobuf
::
Metadata
metadata
;
metadata
.
descriptor
=
_base
.
GetD
escriptor
();
metadata
.
reflection
=
_base
.
GetReflection
()
;
metadata
.
descriptor
=
MemcacheResponse
::
d
escriptor
();
metadata
.
reflection
=
NULL
;
return
metadata
;
}
...
...
src/brpc/memcache.h
View file @
0a7432f0
...
...
@@ -104,7 +104,6 @@ public:
int
GetCachedSize
()
const
{
return
_cached_size_
;
}
static
const
::
google
::
protobuf
::
Descriptor
*
descriptor
();
static
const
MemcacheRequest
&
default_instance
();
protected
:
::
google
::
protobuf
::
Metadata
GetMetadata
()
const
override
;
...
...
@@ -125,7 +124,6 @@ private:
int
_pipelined_count
;
butil
::
IOBuf
_buf
;
mutable
int
_cached_size_
;
static
MemcacheRequestBase
_base
;
};
// Response from Memcache.
...
...
@@ -216,7 +214,6 @@ public:
int
GetCachedSize
()
const
{
return
_cached_size_
;
}
static
const
::
google
::
protobuf
::
Descriptor
*
descriptor
();
static
const
MemcacheResponse
&
default_instance
();
protected
:
::
google
::
protobuf
::
Metadata
GetMetadata
()
const
;
...
...
@@ -232,8 +229,6 @@ private:
std
::
string
_err
;
butil
::
IOBuf
_buf
;
mutable
int
_cached_size_
;
static
MemcacheResponseBase
_base
;
};
}
// namespace brpc
...
...
src/brpc/nshead_message.cpp
View file @
0a7432f0
...
...
@@ -22,8 +22,6 @@
namespace
brpc
{
NsheadMessageBase
NsheadMessage
::
_base
;
NsheadMessage
::
NsheadMessage
()
:
::
google
::
protobuf
::
Message
()
{
SharedCtor
();
...
...
@@ -47,12 +45,7 @@ void NsheadMessage::SharedDtor() {
}
const
::
google
::
protobuf
::
Descriptor
*
NsheadMessage
::
descriptor
()
{
return
_base
.
GetDescriptor
();
}
const
NsheadMessage
&
NsheadMessage
::
default_instance
()
{
static
NsheadMessage
message
;
return
message
;
return
NsheadMessageBase
::
descriptor
();
}
NsheadMessage
*
NsheadMessage
::
New
()
const
{
...
...
@@ -136,8 +129,8 @@ void NsheadMessage::Swap(NsheadMessage* other) {
::
google
::
protobuf
::
Metadata
NsheadMessage
::
GetMetadata
()
const
{
::
google
::
protobuf
::
Metadata
metadata
;
metadata
.
descriptor
=
_base
.
GetD
escriptor
();
metadata
.
reflection
=
_base
.
GetReflection
()
;
metadata
.
descriptor
=
NsheadMessage
::
d
escriptor
();
metadata
.
reflection
=
NULL
;
return
metadata
;
}
...
...
src/brpc/nshead_message.h
View file @
0a7432f0
...
...
@@ -42,7 +42,6 @@ public:
}
static
const
::
google
::
protobuf
::
Descriptor
*
descriptor
();
static
const
NsheadMessage
&
default_instance
();
void
Swap
(
NsheadMessage
*
other
);
...
...
@@ -65,13 +64,11 @@ public:
int
GetCachedSize
()
const
{
return
ByteSize
();
}
protected
:
::
google
::
protobuf
::
Metadata
GetMetadata
()
const
;
::
google
::
protobuf
::
Metadata
GetMetadata
()
const
override
;
private
:
void
SharedCtor
();
void
SharedDtor
();
static
NsheadMessageBase
_base
;
};
}
// namespace brpc
...
...
src/brpc/redis.cpp
View file @
0a7432f0
...
...
@@ -24,8 +24,6 @@ namespace brpc {
DEFINE_bool
(
redis_verbose_crlf2space
,
false
,
"[DEBUG] Show
\\
r
\\
n as a space"
);
RedisRequestBase
RedisRequest
::
_base
;
RedisRequest
::
RedisRequest
()
:
::
google
::
protobuf
::
Message
()
{
SharedCtor
();
...
...
@@ -202,18 +200,13 @@ bool RedisRequest::SerializeTo(butil::IOBuf* buf) const {
}
const
::
google
::
protobuf
::
Descriptor
*
RedisRequest
::
descriptor
()
{
return
_base
.
GetDescriptor
();
}
const
RedisRequest
&
RedisRequest
::
default_instance
()
{
static
RedisRequest
req
;
return
req
;
return
RedisRequestBase
::
descriptor
();
}
::
google
::
protobuf
::
Metadata
RedisRequest
::
GetMetadata
()
const
{
::
google
::
protobuf
::
Metadata
metadata
;
metadata
.
descriptor
=
_base
.
GetD
escriptor
();
metadata
.
reflection
=
_base
.
GetReflection
()
;
metadata
.
descriptor
=
RedisRequest
::
d
escriptor
();
metadata
.
reflection
=
NULL
;
return
metadata
;
}
...
...
@@ -242,8 +235,6 @@ std::ostream& operator<<(std::ostream& os, const RedisRequest& r) {
return
os
;
}
RedisResponseBase
RedisResponse
::
_base
;
RedisResponse
::
RedisResponse
()
:
::
google
::
protobuf
::
Message
()
{
SharedCtor
();
...
...
@@ -374,18 +365,13 @@ void RedisResponse::Swap(RedisResponse* other) {
}
const
::
google
::
protobuf
::
Descriptor
*
RedisResponse
::
descriptor
()
{
return
_base
.
GetDescriptor
();
}
const
RedisResponse
&
RedisResponse
::
default_instance
()
{
static
RedisResponse
res
;
return
res
;
return
RedisResponseBase
::
descriptor
();
}
::
google
::
protobuf
::
Metadata
RedisResponse
::
GetMetadata
()
const
{
::
google
::
protobuf
::
Metadata
metadata
;
metadata
.
descriptor
=
_base
.
GetD
escriptor
();
metadata
.
reflection
=
_base
.
GetReflection
()
;
metadata
.
descriptor
=
RedisResponseBase
::
d
escriptor
();
metadata
.
reflection
=
NULL
;
return
metadata
;
}
...
...
src/brpc/redis.h
View file @
0a7432f0
...
...
@@ -117,7 +117,6 @@ public:
int
GetCachedSize
()
const
{
return
_cached_size_
;
}
static
const
::
google
::
protobuf
::
Descriptor
*
descriptor
();
static
const
RedisRequest
&
default_instance
();
void
Print
(
std
::
ostream
&
)
const
;
...
...
@@ -134,7 +133,6 @@ private:
bool
_has_error
;
// previous AddCommand had error
butil
::
IOBuf
_buf
;
// the serialized request.
mutable
int
_cached_size_
;
// ByteSize
static
RedisRequestBase
_base
;
};
// Response from Redis.
...
...
@@ -189,7 +187,6 @@ public:
int
GetCachedSize
()
const
{
return
_cached_size_
;
}
static
const
::
google
::
protobuf
::
Descriptor
*
descriptor
();
static
const
RedisResponse
&
default_instance
();
protected
:
::
google
::
protobuf
::
Metadata
GetMetadata
()
const
override
;
...
...
@@ -204,7 +201,6 @@ private:
butil
::
Arena
_arena
;
int
_nreply
;
mutable
int
_cached_size_
;
static
RedisResponseBase
_base
;
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
RedisRequest
&
);
...
...
src/brpc/serialized_request.cpp
View file @
0a7432f0
...
...
@@ -19,8 +19,6 @@
namespace
brpc
{
SerializedRequestBase
SerializedRequest
::
_base
;
SerializedRequest
::
SerializedRequest
()
:
::
google
::
protobuf
::
Message
()
{
SharedCtor
();
...
...
@@ -46,12 +44,7 @@ void SerializedRequest::SetCachedSize(int /*size*/) const {
CHECK
(
false
)
<<
"You're not supposed to call "
<<
__FUNCTION__
;
}
const
::
google
::
protobuf
::
Descriptor
*
SerializedRequest
::
descriptor
()
{
return
_base
.
GetDescriptor
();
}
const
SerializedRequest
&
SerializedRequest
::
default_instance
()
{
static
SerializedRequest
req
;
return
req
;
return
SerializedRequestBase
::
descriptor
();
}
SerializedRequest
*
SerializedRequest
::
New
()
const
{
...
...
@@ -119,8 +112,8 @@ void SerializedRequest::Swap(SerializedRequest* other) {
::
google
::
protobuf
::
Metadata
SerializedRequest
::
GetMetadata
()
const
{
::
google
::
protobuf
::
Metadata
metadata
;
metadata
.
descriptor
=
_base
.
GetD
escriptor
();
metadata
.
reflection
=
_base
.
GetReflection
()
;
metadata
.
descriptor
=
SerializedRequest
::
d
escriptor
();
metadata
.
reflection
=
NULL
;
return
metadata
;
}
...
...
src/brpc/serialized_request.h
View file @
0a7432f0
...
...
@@ -36,7 +36,6 @@ public:
}
static
const
::
google
::
protobuf
::
Descriptor
*
descriptor
();
static
const
SerializedRequest
&
default_instance
();
void
Swap
(
SerializedRequest
*
other
);
...
...
@@ -70,7 +69,6 @@ private:
private
:
butil
::
IOBuf
_serialized
;
static
SerializedRequestBase
_base
;
};
}
// namespace brpc
...
...
src/brpc/thrift_message.cpp
View file @
0a7432f0
...
...
@@ -29,8 +29,6 @@
namespace
brpc
{
ThriftFramedMessageBase
ThriftFramedMessage
::
_base
;
ThriftFramedMessage
::
ThriftFramedMessage
()
:
::
google
::
protobuf
::
Message
()
{
SharedCtor
();
...
...
@@ -53,12 +51,7 @@ void ThriftFramedMessage::SharedDtor() {
}
const
::
google
::
protobuf
::
Descriptor
*
ThriftFramedMessage
::
descriptor
()
{
return
_base
.
GetDescriptor
();
}
const
ThriftFramedMessage
&
ThriftFramedMessage
::
default_instance
()
{
static
ThriftFramedMessage
message
;
return
message
;
return
ThriftFramedMessageBase
::
descriptor
();
}
ThriftFramedMessage
*
ThriftFramedMessage
::
New
()
const
{
...
...
@@ -140,8 +133,8 @@ void ThriftFramedMessage::Swap(ThriftFramedMessage* other) {
::
google
::
protobuf
::
Metadata
ThriftFramedMessage
::
GetMetadata
()
const
{
::
google
::
protobuf
::
Metadata
metadata
;
metadata
.
descriptor
=
_base
.
GetD
escriptor
();
metadata
.
reflection
=
_base
.
GetReflection
()
;
metadata
.
descriptor
=
ThriftFramedMessage
::
d
escriptor
();
metadata
.
reflection
=
NULL
;
return
metadata
;
}
...
...
src/brpc/thrift_message.h
View file @
0a7432f0
...
...
@@ -76,7 +76,6 @@ public:
ThriftFramedMessage
&
operator
=
(
const
ThriftFramedMessage
&
from
)
=
delete
;
static
const
::
google
::
protobuf
::
Descriptor
*
descriptor
();
static
const
ThriftFramedMessage
&
default_instance
();
void
Swap
(
ThriftFramedMessage
*
other
);
...
...
@@ -104,7 +103,6 @@ protected:
private
:
void
SharedCtor
();
void
SharedDtor
();
static
ThriftFramedMessageBase
_base
;
};
class
ThriftStub
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment