Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QuarkDB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eos
QuarkDB
Commits
486d7cdb
Commit
486d7cdb
authored
7 years ago
by
Georgios Bitzes
Browse files
Options
Downloads
Patches
Plain Diff
Allow the broadcasting of MultiOps directly from CommandMonitor
parent
fb21d255
Branches
Branches containing commit
Tags
v6r6
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/redis/CommandMonitor.cc
+12
-2
12 additions, 2 deletions
src/redis/CommandMonitor.cc
src/redis/CommandMonitor.hh
+9
-3
9 additions, 3 deletions
src/redis/CommandMonitor.hh
with
21 additions
and
5 deletions
src/redis/CommandMonitor.cc
+
12
−
2
View file @
486d7cdb
...
...
@@ -30,14 +30,14 @@ CommandMonitor::CommandMonitor() {
}
void
CommandMonitor
::
broadcast
(
const
std
::
string
&
linkDescription
,
const
RedisRequest
&
received
)
{
void
CommandMonitor
::
broadcast
(
const
std
::
string
&
linkDescription
,
const
std
::
string
&
printableString
)
{
if
(
!
active
)
return
;
std
::
lock_guard
<
std
::
mutex
>
lock
(
mtx
);
auto
it
=
monitors
.
begin
();
while
(
it
!=
monitors
.
end
())
{
bool
stillAlive
=
(
*
it
)
->
appendIfAttached
(
Formatter
::
status
(
SSTR
(
linkDescription
<<
": "
<<
received
.
toP
rintableString
()
)));
bool
stillAlive
=
(
*
it
)
->
appendIfAttached
(
Formatter
::
status
(
SSTR
(
linkDescription
<<
": "
<<
p
rintableString
)));
if
(
!
stillAlive
)
{
it
=
monitors
.
erase
(
it
);
...
...
@@ -50,6 +50,16 @@ void CommandMonitor::broadcast(const std::string& linkDescription, const RedisRe
if
(
monitors
.
size
()
==
0
)
active
=
false
;
}
void
CommandMonitor
::
broadcast
(
const
std
::
string
&
linkDescription
,
const
RedisRequest
&
req
)
{
if
(
!
active
)
return
;
return
broadcast
(
linkDescription
,
req
.
toPrintableString
());
}
void
CommandMonitor
::
broadcast
(
const
std
::
string
&
linkDescription
,
const
MultiOp
&
multiOp
)
{
if
(
!
active
)
return
;
return
broadcast
(
linkDescription
,
multiOp
.
toPrintableString
());
}
void
CommandMonitor
::
addRegistration
(
Connection
*
c
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mtx
);
...
...
This diff is collapsed.
Click to expand it.
src/redis/CommandMonitor.hh
+
9
−
3
View file @
486d7cdb
...
...
@@ -21,23 +21,29 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
************************************************************************/
#ifndef
__
QUARKDB_COMMAND_MONITOR_H
__
#define
__
QUARKDB_COMMAND_MONITOR_H
__
#ifndef QUARKDB_COMMAND_MONITOR_H
#define QUARKDB_COMMAND_MONITOR_H
#include
<list>
#include
"../Connection.hh"
namespace
quarkdb
{
class
MultiOp
;
class
CommandMonitor
{
public:
CommandMonitor
();
void
broadcast
(
const
std
::
string
&
linkDescription
,
const
RedisRequest
&
received
);
void
broadcast
(
const
std
::
string
&
linkDescription
,
const
RedisRequest
&
received
);
void
broadcast
(
const
std
::
string
&
linkDescription
,
const
MultiOp
&
multiOp
);
void
addRegistration
(
Connection
*
c
);
size_t
size
();
private:
void
broadcast
(
const
std
::
string
&
linkDescription
,
const
std
::
string
&
printableString
);
std
::
atomic
<
int64_t
>
active
{
false
};
std
::
mutex
mtx
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment