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
fe556250
Commit
fe556250
authored
Jun 12, 2019
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a lot of override
parent
e2c9d6a7
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
93 additions
and
98 deletions
+93
-98
acceptor.h
src/brpc/acceptor.h
+1
-1
callback.h
src/brpc/callback.h
+1
-1
cluster_recover_policy.h
src/brpc/cluster_recover_policy.h
+3
-3
controller.h
src/brpc/controller.h
+7
-7
describable.h
src/brpc/describable.h
+1
-1
method_status.h
src/brpc/details/method_status.h
+1
-1
consul_naming_service.h
src/brpc/policy/consul_naming_service.h
+4
-4
domain_naming_service.h
src/brpc/policy/domain_naming_service.h
+4
-4
file_naming_service.h
src/brpc/policy/file_naming_service.h
+4
-4
list_naming_service.h
src/brpc/policy/list_naming_service.h
+5
-5
remote_file_naming_service.h
src/brpc/policy/remote_file_naming_service.h
+4
-4
rpc_dump.h
src/brpc/rpc_dump.h
+3
-3
mutex.cpp
src/bthread/mutex.cpp
+3
-3
task_group.h
src/bthread/task_group.h
+1
-1
iobuf.h
src/butil/iobuf.h
+5
-5
logging.cc
src/butil/logging.cc
+1
-1
logging.h
src/butil/logging.h
+3
-3
snappy-sinksource.h
src/butil/third_party/snappy/snappy-sinksource.h
+9
-9
zero_copy_stream_as_streambuf.h
src/butil/zero_copy_stream_as_streambuf.h
+3
-3
sampler.h
src/bvar/detail/sampler.h
+1
-1
gflag.h
src/bvar/gflag.h
+2
-3
latency_recorder.h
src/bvar/latency_recorder.h
+2
-2
passive_status.h
src/bvar/passive_status.h
+4
-4
recorder.h
src/bvar/recorder.h
+1
-1
reducer.h
src/bvar/reducer.h
+5
-6
status.h
src/bvar/status.h
+6
-8
variable.cpp
src/bvar/variable.cpp
+4
-4
window.h
src/bvar/window.h
+4
-5
generator.cpp
src/mcpack2pb/generator.cpp
+1
-1
No files found.
src/brpc/acceptor.h
View file @
fe556250
...
...
@@ -88,7 +88,7 @@ private:
int
Initialize
();
// Remove the accepted socket `sock' from inside
v
irtual
void
BeforeRecycle
(
Socket
*
sock
)
;
v
oid
BeforeRecycle
(
Socket
*
sock
)
override
;
bthread_keytable_pool_t
*
_keytable_pool
;
// owned by Server
Status
_status
;
...
...
src/brpc/callback.h
View file @
fe556250
...
...
@@ -86,7 +86,7 @@ class FunctionClosure0 : public ::google::protobuf::Closure {
:
function_
(
function
),
self_deleting_
(
self_deleting
)
{}
~
FunctionClosure0
()
{}
void
Run
()
{
void
Run
()
override
{
bool
needs_delete
=
self_deleting_
;
// read in case callback deletes
function_
();
if
(
needs_delete
)
delete
this
;
...
...
src/brpc/cluster_recover_policy.h
View file @
fe556250
...
...
@@ -59,9 +59,9 @@ class DefaultClusterRecoverPolicy : public ClusterRecoverPolicy {
public
:
DefaultClusterRecoverPolicy
(
int64_t
min_working_instances
,
int64_t
hold_seconds
);
void
StartRecover
();
bool
DoReject
(
const
std
::
vector
<
ServerId
>&
server_list
);
bool
StopRecoverIfNecessary
();
void
StartRecover
()
override
;
bool
DoReject
(
const
std
::
vector
<
ServerId
>&
server_list
)
override
;
bool
StopRecoverIfNecessary
()
override
;
private
:
uint64_t
GetUsableServerCount
(
int64_t
now_ms
,
const
std
::
vector
<
ServerId
>&
server_list
);
...
...
src/brpc/controller.h
View file @
fe556250
...
...
@@ -336,7 +336,7 @@ public:
// call the final "done" callback.
// Note: Reaching deadline of the RPC would not affect this function, which means
// even if deadline has been reached, this function may still return false.
bool
IsCanceled
()
const
;
bool
IsCanceled
()
const
override
;
// Asks that the given callback be called when the RPC is canceled or the
// connection has broken. The callback will always be called exactly once.
...
...
@@ -345,7 +345,7 @@ public:
// when NotifyOnCancel() is called, the callback will be called immediately.
//
// NotifyOnCancel() must be called no more than once per request.
void
NotifyOnCancel
(
google
::
protobuf
::
Closure
*
callback
);
void
NotifyOnCancel
(
google
::
protobuf
::
Closure
*
callback
)
override
;
// Returns the authenticated result. NULL if there is no authentication
const
AuthContext
*
auth_context
()
const
{
return
_auth_context
;
}
...
...
@@ -437,7 +437,7 @@ public:
// Resets the Controller to its initial state so that it may be reused in
// a new call. Must NOT be called while an RPC is in progress.
void
Reset
()
{
void
Reset
()
override
{
ResetNonPods
();
ResetPods
();
}
...
...
@@ -448,18 +448,18 @@ public:
// as well if the protocol is HTTP. If you want to overwrite the
// status_code, call http_response().set_status_code() after SetFailed()
// (rather than before SetFailed)
void
SetFailed
(
const
std
::
string
&
reason
);
void
SetFailed
(
const
std
::
string
&
reason
)
override
;
void
SetFailed
(
int
error_code
,
const
char
*
reason_fmt
,
...)
__attribute__
((
__format__
(
__printf__
,
3
,
4
)));
// After a call has finished, returns true if the RPC call failed.
// The response to Channel is undefined when Failed() is true.
// Calling Failed() before a call has finished is undefined.
bool
Failed
()
const
;
bool
Failed
()
const
override
;
// If Failed() is true, return description of the errors.
// NOTE: ErrorText() != berror(ErrorCode()).
std
::
string
ErrorText
()
const
;
std
::
string
ErrorText
()
const
override
;
// Last error code. Equals 0 iff Failed() is false.
// If there's retry, latter code overwrites former one.
...
...
@@ -557,7 +557,7 @@ private:
void
ResetPods
();
void
ResetNonPods
();
void
StartCancel
();
void
StartCancel
()
override
;
// Using fixed start_realtime_us (microseconds since the Epoch) gives
// more accurate deadline.
...
...
src/brpc/describable.h
View file @
fe556250
...
...
@@ -93,7 +93,7 @@ public:
,
_indent
(
indent
,
' '
)
{}
protected
:
virtual
int
overflow
(
int
ch
)
{
int
overflow
(
int
ch
)
override
{
if
(
_is_at_start_of_line
&&
ch
!=
'\n'
)
{
_dest
->
sputn
(
_indent
.
data
(),
_indent
.
size
());
}
...
...
src/brpc/details/method_status.h
View file @
fe556250
...
...
@@ -51,7 +51,7 @@ public:
int
Expose
(
const
butil
::
StringPiece
&
prefix
);
// Describe internal vars, used by /status
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
;
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
override
;
// Current max_concurrency of the method.
int
MaxConcurrency
()
const
{
return
_cl
?
_cl
->
MaxConcurrency
()
:
0
;
}
...
...
src/brpc/policy/consul_naming_service.h
View file @
fe556250
...
...
@@ -28,19 +28,19 @@ namespace policy {
class
ConsulNamingService
:
public
NamingService
{
private
:
int
RunNamingService
(
const
char
*
service_name
,
NamingServiceActions
*
actions
);
NamingServiceActions
*
actions
)
override
;
int
GetServers
(
const
char
*
service_name
,
std
::
vector
<
ServerNode
>*
servers
);
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
;
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
override
;
NamingService
*
New
()
const
;
NamingService
*
New
()
const
override
;
int
DegradeToOtherServiceIfNeeded
(
const
char
*
service_name
,
std
::
vector
<
ServerNode
>*
servers
);
void
Destroy
();
void
Destroy
()
override
;
private
:
Channel
_channel
;
...
...
src/brpc/policy/domain_naming_service.h
View file @
fe556250
...
...
@@ -30,13 +30,13 @@ public:
private
:
int
GetServers
(
const
char
*
service_name
,
std
::
vector
<
ServerNode
>*
servers
);
std
::
vector
<
ServerNode
>*
servers
)
override
;
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
;
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
override
;
NamingService
*
New
()
const
;
NamingService
*
New
()
const
override
;
void
Destroy
();
void
Destroy
()
override
;
private
:
std
::
unique_ptr
<
char
[]
>
_aux_buf
;
...
...
src/brpc/policy/file_naming_service.h
View file @
fe556250
...
...
@@ -27,16 +27,16 @@ class FileNamingService : public NamingService {
friend
class
ConsulNamingService
;
private
:
int
RunNamingService
(
const
char
*
service_name
,
NamingServiceActions
*
actions
);
NamingServiceActions
*
actions
)
override
;
int
GetServers
(
const
char
*
service_name
,
std
::
vector
<
ServerNode
>*
servers
);
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
;
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
override
;
NamingService
*
New
()
const
;
NamingService
*
New
()
const
override
;
void
Destroy
();
void
Destroy
()
override
;
};
}
// namespace policy
...
...
src/brpc/policy/list_naming_service.h
View file @
fe556250
...
...
@@ -26,19 +26,19 @@ namespace policy {
class
ListNamingService
:
public
NamingService
{
private
:
int
RunNamingService
(
const
char
*
service_name
,
NamingServiceActions
*
actions
);
NamingServiceActions
*
actions
)
override
;
// We don't need a dedicated bthread to run this static NS.
bool
RunNamingServiceReturnsQuickly
()
{
return
true
;
}
bool
RunNamingServiceReturnsQuickly
()
override
{
return
true
;
}
int
GetServers
(
const
char
*
service_name
,
std
::
vector
<
ServerNode
>*
servers
);
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
options
)
const
;
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
options
)
const
override
;
NamingService
*
New
()
const
;
NamingService
*
New
()
const
override
;
void
Destroy
();
void
Destroy
()
override
;
};
}
// namespace policy
...
...
src/brpc/policy/remote_file_naming_service.h
View file @
fe556250
...
...
@@ -29,13 +29,13 @@ namespace policy {
class
RemoteFileNamingService
:
public
PeriodicNamingService
{
private
:
int
GetServers
(
const
char
*
service_name
,
std
::
vector
<
ServerNode
>*
servers
);
std
::
vector
<
ServerNode
>*
servers
)
override
;
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
;
void
Describe
(
std
::
ostream
&
os
,
const
DescribeOptions
&
)
const
override
;
NamingService
*
New
()
const
;
NamingService
*
New
()
const
override
;
void
Destroy
();
void
Destroy
()
override
;
private
:
std
::
unique_ptr
<
Channel
>
_channel
;
...
...
src/brpc/rpc_dump.h
View file @
fe556250
...
...
@@ -51,9 +51,9 @@ struct SampledRequest : public bvar::Collected
butil
::
IOBuf
request
;
// Implement methods of Sampled.
void
dump_and_destroy
(
size_t
round
);
void
destroy
();
bvar
::
CollectorSpeedLimit
*
speed_limit
()
{
void
dump_and_destroy
(
size_t
round
)
override
;
void
destroy
()
override
;
bvar
::
CollectorSpeedLimit
*
speed_limit
()
override
{
extern
bvar
::
CollectorSpeedLimit
g_rpc_dump_sl
;
return
&
g_rpc_dump_sl
;
}
...
...
src/bthread/mutex.cpp
View file @
fe556250
...
...
@@ -65,9 +65,9 @@ struct SampledContention : public bvar::Collected {
void
*
stack
[
26
];
// backtrace.
// Implement bvar::Collected
void
dump_and_destroy
(
size_t
round
);
void
destroy
();
bvar
::
CollectorSpeedLimit
*
speed_limit
()
{
return
&
g_cp_sl
;
}
void
dump_and_destroy
(
size_t
round
)
override
;
void
destroy
()
override
;
bvar
::
CollectorSpeedLimit
*
speed_limit
()
override
{
return
&
g_cp_sl
;
}
// For combining samples with hashmap.
size_t
hash_code
()
const
{
...
...
src/bthread/task_group.h
View file @
fe556250
...
...
@@ -34,7 +34,7 @@ class ExitException : public std::exception {
public
:
explicit
ExitException
(
void
*
value
)
:
_value
(
value
)
{}
~
ExitException
()
throw
()
{}
const
char
*
what
()
const
throw
()
{
const
char
*
what
()
const
throw
()
override
{
return
"ExitException"
;
}
void
*
value
()
const
{
...
...
src/butil/iobuf.h
View file @
fe556250
...
...
@@ -588,14 +588,14 @@ public:
virtual
~
IOBufAsSnappySource
()
{}
// Return the number of bytes left to read from the source
virtual
size_t
Available
()
const
;
size_t
Available
()
const
override
;
// Peek at the next flat region of the source.
virtual
const
char
*
Peek
(
size_t
*
len
)
;
const
char
*
Peek
(
size_t
*
len
)
override
;
// Skip the next n bytes. Invalidates any buffer returned by
// a previous call to Peek().
v
irtual
void
Skip
(
size_t
n
)
;
v
oid
Skip
(
size_t
n
)
override
;
private
:
const
butil
::
IOBuf
*
_buf
;
...
...
@@ -609,10 +609,10 @@ public:
virtual
~
IOBufAsSnappySink
()
{}
// Append "bytes[0,n-1]" to this.
v
irtual
void
Append
(
const
char
*
bytes
,
size_t
n
)
;
v
oid
Append
(
const
char
*
bytes
,
size_t
n
)
override
;
// Returns a writable buffer of the specified length for appending.
virtual
char
*
GetAppendBuffer
(
size_t
length
,
char
*
scratch
)
;
char
*
GetAppendBuffer
(
size_t
length
,
char
*
scratch
)
override
;
private
:
char
*
_cur_buf
;
...
...
src/butil/logging.cc
View file @
fe556250
...
...
@@ -764,7 +764,7 @@ public:
}
bool
OnLogMessage
(
int
severity
,
const
char
*
file
,
int
line
,
const
butil
::
StringPiece
&
content
)
{
const
butil
::
StringPiece
&
content
)
override
{
// There's a copy here to concatenate prefix and content. Since
// DefaultLogSink is hardly used right now, the copy is irrelevant.
// A LogSink focused on performance should also be able to handle
...
...
src/butil/logging.h
View file @
fe556250
...
...
@@ -321,7 +321,7 @@ BUTIL_EXPORT LogSink* SetLogSink(LogSink* sink);
class
StringSink
:
public
LogSink
,
public
std
::
string
{
public
:
bool
OnLogMessage
(
int
severity
,
const
char
*
file
,
int
line
,
const
butil
::
StringPiece
&
log_content
);
const
butil
::
StringPiece
&
log_content
)
override
;
private
:
butil
::
Lock
_lock
;
};
...
...
@@ -857,8 +857,8 @@ public:
explicit
CharArrayStreamBuf
()
:
_data
(
NULL
),
_size
(
0
)
{}
~
CharArrayStreamBuf
();
virtual
int
overflow
(
int
ch
)
;
virtual
int
sync
()
;
int
overflow
(
int
ch
)
override
;
int
sync
()
override
;
void
reset
();
private
:
...
...
src/butil/third_party/snappy/snappy-sinksource.h
View file @
fe556250
...
...
@@ -148,9 +148,9 @@ class ByteArraySource : public Source {
public
:
ByteArraySource
(
const
char
*
p
,
size_t
n
)
:
ptr_
(
p
),
left_
(
n
)
{
}
virtual
~
ByteArraySource
();
virtual
size_t
Available
()
const
;
virtual
const
char
*
Peek
(
size_t
*
len
)
;
v
irtual
void
Skip
(
size_t
n
)
;
size_t
Available
()
const
override
;
const
char
*
Peek
(
size_t
*
len
)
override
;
v
oid
Skip
(
size_t
n
)
override
;
private
:
const
char
*
ptr_
;
size_t
left_
;
...
...
@@ -161,14 +161,14 @@ class UncheckedByteArraySink : public Sink {
public
:
explicit
UncheckedByteArraySink
(
char
*
dest
)
:
dest_
(
dest
)
{
}
virtual
~
UncheckedByteArraySink
();
v
irtual
void
Append
(
const
char
*
data
,
size_t
n
)
;
virtual
char
*
GetAppendBuffer
(
size_t
len
,
char
*
scratch
)
;
virtual
char
*
GetAppendBufferVariable
(
v
oid
Append
(
const
char
*
data
,
size_t
n
)
override
;
char
*
GetAppendBuffer
(
size_t
len
,
char
*
scratch
)
override
;
char
*
GetAppendBufferVariable
(
size_t
min_size
,
size_t
desired_size_hint
,
char
*
scratch
,
size_t
scratch_size
,
size_t
*
allocated_size
);
v
irtual
v
oid
AppendAndTakeOwnership
(
size_t
scratch_size
,
size_t
*
allocated_size
)
override
;
void
AppendAndTakeOwnership
(
char
*
bytes
,
size_t
n
,
void
(
*
deleter
)(
void
*
,
const
char
*
,
size_t
),
void
*
deleter_arg
);
void
*
deleter_arg
)
override
;
// Return the current output pointer so that a caller can see how
// many bytes were produced.
...
...
src/butil/zero_copy_stream_as_streambuf.h
View file @
fe556250
...
...
@@ -37,11 +37,11 @@ public:
void
shrink
();
protected
:
virtual
int
overflow
(
int
ch
)
;
virtual
int
sync
()
;
int
overflow
(
int
ch
)
override
;
int
sync
()
override
;
std
::
streampos
seekoff
(
std
::
streamoff
off
,
std
::
ios_base
::
seekdir
way
,
std
::
ios_base
::
openmode
which
);
std
::
ios_base
::
openmode
which
)
override
;
private
:
google
::
protobuf
::
io
::
ZeroCopyOutputStream
*
_zero_copy_stream
;
...
...
src/bvar/detail/sampler.h
View file @
fe556250
...
...
@@ -97,7 +97,7 @@ public:
}
~
ReducerSampler
()
{}
void
take_sample
()
{
void
take_sample
()
override
{
// Make _q ready.
// If _window_size is larger than what _q can hold, e.g. a larger
// Window<> is created after running of sampler, make _q larger.
...
...
src/bvar/gflag.h
View file @
fe556250
...
...
@@ -34,11 +34,10 @@ public:
// Calling hide() in dtor manually is a MUST required by Variable.
~
GFlag
()
{
hide
();
}
// Implement Variable::describe() and Variable::get_value().
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
;
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
override
;
#ifdef BAIDU_INTERNAL
void
get_value
(
boost
::
any
*
value
)
const
;
void
get_value
(
boost
::
any
*
value
)
const
override
;
#endif
// Get value of the gflag.
...
...
src/bvar/latency_recorder.h
View file @
fe556250
...
...
@@ -37,8 +37,8 @@ class CDF : public Variable {
public
:
explicit
CDF
(
PercentileWindow
*
w
);
~
CDF
();
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
;
int
describe_series
(
std
::
ostream
&
os
,
const
SeriesOptions
&
options
)
const
;
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
override
;
int
describe_series
(
std
::
ostream
&
os
,
const
SeriesOptions
&
options
)
const
override
;
private
:
PercentileWindow
*
_w
;
};
...
...
src/bvar/passive_status.h
View file @
fe556250
...
...
@@ -57,7 +57,7 @@ public:
~
SeriesSampler
()
{
delete
_vector_names
;
}
void
take_sample
()
{
_series
.
append
(
_owner
->
get_value
());
}
void
take_sample
()
override
{
_series
.
append
(
_owner
->
get_value
());
}
void
describe
(
std
::
ostream
&
os
)
{
_series
.
describe
(
os
,
_vector_names
);
}
void
set_vector_names
(
const
std
::
string
&
names
)
{
if
(
_vector_names
==
NULL
)
{
...
...
@@ -120,12 +120,12 @@ public:
return
-
1
;
}
void
describe
(
std
::
ostream
&
os
,
bool
/*quote_string*/
)
const
{
void
describe
(
std
::
ostream
&
os
,
bool
/*quote_string*/
)
const
override
{
os
<<
get_value
();
}
#ifdef BAIDU_INTERNAL
void
get_value
(
boost
::
any
*
value
)
const
{
void
get_value
(
boost
::
any
*
value
)
const
override
{
if
(
_getfn
)
{
*
value
=
_getfn
(
_arg
);
}
else
{
...
...
@@ -217,7 +217,7 @@ public:
hide
();
}
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
{
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
override
{
if
(
quote_string
)
{
if
(
_print
)
{
os
<<
'"'
;
...
...
src/bvar/recorder.h
View file @
fe556250
...
...
@@ -154,7 +154,7 @@ public:
AddStat
op
()
const
{
return
AddStat
();
}
MinusStat
inv_op
()
const
{
return
MinusStat
();
}
void
describe
(
std
::
ostream
&
os
,
bool
/*quote_string*/
)
const
{
void
describe
(
std
::
ostream
&
os
,
bool
/*quote_string*/
)
const
override
{
os
<<
get_value
();
}
...
...
src/bvar/reducer.h
View file @
fe556250
...
...
@@ -74,7 +74,7 @@ public:
SeriesSampler
(
Reducer
*
owner
,
const
Op
&
op
)
:
_owner
(
owner
),
_series
(
op
)
{}
~
SeriesSampler
()
{}
void
take_sample
()
{
_series
.
append
(
_owner
->
get_value
());
}
void
take_sample
()
override
{
_series
.
append
(
_owner
->
get_value
());
}
void
describe
(
std
::
ostream
&
os
)
{
_series
.
describe
(
os
,
NULL
);
}
private
:
Reducer
*
_owner
;
...
...
@@ -125,8 +125,7 @@ public:
// Returns the reduced value before reset.
T
reset
()
{
return
_combiner
.
reset_all_agents
();
}
// Implement Variable::describe() and Variable::get_value().
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
{
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
override
{
if
(
butil
::
is_same
<
T
,
std
::
string
>::
value
&&
quote_string
)
{
os
<<
'"'
<<
get_value
()
<<
'"'
;
}
else
{
...
...
@@ -135,7 +134,7 @@ public:
}
#ifdef BAIDU_INTERNAL
void
get_value
(
boost
::
any
*
value
)
const
{
*
value
=
get_value
();
}
void
get_value
(
boost
::
any
*
value
)
const
override
{
*
value
=
get_value
();
}
#endif
// True if this reducer is constructed successfully.
...
...
@@ -153,7 +152,7 @@ public:
return
_sampler
;
}
int
describe_series
(
std
::
ostream
&
os
,
const
SeriesOptions
&
options
)
const
{
int
describe_series
(
std
::
ostream
&
os
,
const
SeriesOptions
&
options
)
const
override
{
if
(
_series_sampler
==
NULL
)
{
return
1
;
}
...
...
@@ -166,7 +165,7 @@ public:
protected
:
int
expose_impl
(
const
butil
::
StringPiece
&
prefix
,
const
butil
::
StringPiece
&
name
,
DisplayFilter
display_filter
)
{
DisplayFilter
display_filter
)
override
{
const
int
rc
=
Variable
::
expose_impl
(
prefix
,
name
,
display_filter
);
if
(
rc
==
0
&&
_series_sampler
==
NULL
&&
...
...
src/bvar/status.h
View file @
fe556250
...
...
@@ -52,13 +52,12 @@ public:
// Calling hide() manually is a MUST required by Variable.
~
Status
()
{
hide
();
}
// Implement Variable::describe() and Variable::get_value().
void
describe
(
std
::
ostream
&
os
,
bool
/*quote_string*/
)
const
{
void
describe
(
std
::
ostream
&
os
,
bool
/*quote_string*/
)
const
override
{
os
<<
get_value
();
}
#ifdef BAIDU_INTERNAL
void
get_value
(
boost
::
any
*
value
)
const
{
void
get_value
(
boost
::
any
*
value
)
const
override
{
butil
::
AutoLock
guard
(
_lock
);
*
value
=
_value
;
}
...
...
@@ -122,13 +121,12 @@ public:
}
}
// Implement Variable::describe() and Variable::get_value().
void
describe
(
std
::
ostream
&
os
,
bool
/*quote_string*/
)
const
{
void
describe
(
std
::
ostream
&
os
,
bool
/*quote_string*/
)
const
override
{
os
<<
get_value
();
}
#ifdef BAIDU_INTERNAL
void
get_value
(
boost
::
any
*
value
)
const
{
void
get_value
(
boost
::
any
*
value
)
const
override
{
*
value
=
get_value
();
}
#endif
...
...
@@ -197,7 +195,7 @@ public:
~
Status
()
{
hide
();
}
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
{
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
override
{
if
(
quote_string
)
{
os
<<
'"'
<<
get_value
()
<<
'"'
;
}
else
{
...
...
@@ -211,7 +209,7 @@ public:
}
#ifdef BAIDU_INTERNAL
void
get_value
(
boost
::
any
*
value
)
const
{
void
get_value
(
boost
::
any
*
value
)
const
override
{
*
value
=
get_value
();
}
#endif
...
...
src/bvar/variable.cpp
View file @
fe556250
...
...
@@ -315,8 +315,8 @@ public:
explicit
CharArrayStreamBuf
()
:
_data
(
NULL
),
_size
(
0
)
{}
~
CharArrayStreamBuf
();
virtual
int
overflow
(
int
ch
)
;
virtual
int
sync
()
;
int
overflow
(
int
ch
)
override
;
int
sync
()
override
;
void
reset
();
butil
::
StringPiece
data
()
{
return
butil
::
StringPiece
(
pbase
(),
pptr
()
-
pbase
());
...
...
@@ -586,7 +586,7 @@ public:
_fp
=
NULL
;
}
}
bool
dump
(
const
std
::
string
&
name
,
const
butil
::
StringPiece
&
desc
)
{
bool
dump
(
const
std
::
string
&
name
,
const
butil
::
StringPiece
&
desc
)
override
{
if
(
_fp
==
NULL
)
{
butil
::
File
::
Error
error
;
butil
::
FilePath
dir
=
butil
::
FilePath
(
_filename
).
DirName
();
...
...
@@ -647,7 +647,7 @@ public:
dumpers
.
clear
();
}
bool
dump
(
const
std
::
string
&
name
,
const
butil
::
StringPiece
&
desc
)
{
bool
dump
(
const
std
::
string
&
name
,
const
butil
::
StringPiece
&
desc
)
override
{
for
(
size_t
i
=
0
;
i
<
dumpers
.
size
()
-
1
;
++
i
)
{
if
(
dumpers
[
i
].
second
->
match
(
name
))
{
return
dumpers
[
i
].
first
->
dump
(
name
,
desc
);
...
...
src/bvar/window.h
View file @
fe556250
...
...
@@ -56,7 +56,7 @@ public:
SeriesSampler
(
WindowBase
*
owner
,
R
*
var
)
:
_owner
(
owner
),
_series
(
Op
(
var
))
{}
~
SeriesSampler
()
{}
void
take_sample
()
{
void
take_sample
()
override
{
if
(
series_freq
==
SERIES_IN_SECOND
)
{
// Get one-second window value for PerSecond<>, otherwise the
// "smoother" plot may hide peaks.
...
...
@@ -108,8 +108,7 @@ public:
value_type
get_value
()
const
{
return
get_value
(
_window_size
);
}
// Implement Variable::describe() and Variable::get_value().
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
{
void
describe
(
std
::
ostream
&
os
,
bool
quote_string
)
const
override
{
if
(
butil
::
is_same
<
value_type
,
std
::
string
>::
value
&&
quote_string
)
{
os
<<
'"'
<<
get_value
()
<<
'"'
;
}
else
{
...
...
@@ -118,7 +117,7 @@ public:
}
#ifdef BAIDU_INTERNAL
void
get_value
(
boost
::
any
*
value
)
const
{
*
value
=
get_value
();
}
void
get_value
(
boost
::
any
*
value
)
const
override
{
*
value
=
get_value
();
}
#endif
time_t
window_size
()
const
{
return
_window_size
;
}
...
...
@@ -219,7 +218,7 @@ public:
this
->
expose_as
(
prefix
,
name
);
}
v
irtual
value_type
get_value
(
time_t
window_size
)
const
{
v
alue_type
get_value
(
time_t
window_size
)
const
override
{
detail
::
Sample
<
value_type
>
s
;
this
->
get_span
(
window_size
,
&
s
);
// We may test if the multiplication overflows and use integral ops
...
...
src/mcpack2pb/generator.cpp
View file @
fe556250
...
...
@@ -1345,7 +1345,7 @@ public:
bool
Generate
(
const
google
::
protobuf
::
FileDescriptor
*
file
,
const
std
::
string
&
parameter
,
google
::
protobuf
::
compiler
::
GeneratorContext
*
,
std
::
string
*
error
)
const
;
std
::
string
*
error
)
const
override
;
};
bool
McpackToProtobuf
::
Generate
(
const
google
::
protobuf
::
FileDescriptor
*
file
,
...
...
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