Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Cameo
cameo
Commits
5d7fa164
Commit
5d7fa164
authored
Oct 15, 2020
by
legoc
Browse files
(split) The cameo server sends the value in the remove key event
parent
d5472078
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/EventStreamSocket.cpp
View file @
5d7fa164
...
@@ -23,9 +23,9 @@
...
@@ -23,9 +23,9 @@
#include
"ResultEvent.h"
#include
"ResultEvent.h"
#include
"StatusEvent.h"
#include
"StatusEvent.h"
#include
"StoreKeyValueEvent.h"
#include
"StoreKeyValueEvent.h"
#include
"RemoveKeyEvent.h"
#include
"impl/StreamSocketImpl.h"
#include
"impl/StreamSocketImpl.h"
#include
"message/Message.h"
#include
"message/Message.h"
#include
"RemoveKeyValueEvent.h"
using
namespace
std
;
using
namespace
std
;
...
@@ -126,7 +126,7 @@ std::unique_ptr<Event> EventStreamSocket::receive(bool blocking) {
...
@@ -126,7 +126,7 @@ std::unique_ptr<Event> EventStreamSocket::receive(bool blocking) {
return
unique_ptr
<
Event
>
(
new
StoreKeyValueEvent
(
id
,
name
,
key
,
value
));
return
unique_ptr
<
Event
>
(
new
StoreKeyValueEvent
(
id
,
name
,
key
,
value
));
}
}
else
if
(
response
==
message
::
Event
::
REMOVEKEY
)
{
else
if
(
response
==
message
::
Event
::
REMOVEKEY
VALUE
)
{
message
=
m_impl
->
receive
();
message
=
m_impl
->
receive
();
...
@@ -134,11 +134,12 @@ std::unique_ptr<Event> EventStreamSocket::receive(bool blocking) {
...
@@ -134,11 +134,12 @@ std::unique_ptr<Event> EventStreamSocket::receive(bool blocking) {
json
::
Object
event
;
json
::
Object
event
;
json
::
parse
(
event
,
message
.
get
());
json
::
parse
(
event
,
message
.
get
());
int
id
=
event
[
message
::
RemoveKeyEvent
::
ID
].
GetInt
();
int
id
=
event
[
message
::
RemoveKeyValueEvent
::
ID
].
GetInt
();
string
name
=
event
[
message
::
RemoveKeyEvent
::
NAME
].
GetString
();
string
name
=
event
[
message
::
RemoveKeyValueEvent
::
NAME
].
GetString
();
string
key
=
event
[
message
::
RemoveKeyEvent
::
KEY
].
GetString
();
string
key
=
event
[
message
::
RemoveKeyValueEvent
::
KEY
].
GetString
();
string
value
=
event
[
message
::
RemoveKeyValueEvent
::
VALUE
].
GetString
();
return
unique_ptr
<
Event
>
(
new
RemoveKeyEvent
(
id
,
name
,
key
));
return
unique_ptr
<
Event
>
(
new
RemoveKey
Value
Event
(
id
,
name
,
key
,
value
));
}
}
else
if
(
response
==
message
::
Event
::
CANCEL
)
{
else
if
(
response
==
message
::
Event
::
CANCEL
)
{
...
...
src/KeyEvent.cpp
View file @
5d7fa164
...
@@ -20,17 +20,24 @@
...
@@ -20,17 +20,24 @@
namespace
cameo
{
namespace
cameo
{
KeyEvent
::
KeyEvent
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
)
:
KeyEvent
::
KeyEvent
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
,
const
std
::
string
&
value
)
:
Event
(
id
,
name
),
Event
(
id
,
name
),
m_key
(
key
)
{
m_key
(
key
),
m_value
(
value
)
{
}
}
KeyEvent
::
KeyEvent
(
const
KeyEvent
&
event
)
:
KeyEvent
::
KeyEvent
(
const
KeyEvent
&
event
)
:
Event
(
event
),
m_key
(
event
.
m_key
)
{
Event
(
event
),
m_key
(
event
.
m_key
),
m_value
(
event
.
m_value
)
{
}
}
const
std
::
string
&
KeyEvent
::
getKey
()
const
{
const
std
::
string
&
KeyEvent
::
getKey
()
const
{
return
m_key
;
return
m_key
;
}
}
const
std
::
string
&
KeyEvent
::
getValue
()
const
{
return
m_value
;
}
}
}
src/KeyEvent.h
View file @
5d7fa164
...
@@ -25,13 +25,15 @@ namespace cameo {
...
@@ -25,13 +25,15 @@ namespace cameo {
class
KeyEvent
:
public
Event
{
class
KeyEvent
:
public
Event
{
public:
public:
KeyEvent
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
);
KeyEvent
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
,
const
std
::
string
&
value
);
KeyEvent
(
const
KeyEvent
&
event
);
KeyEvent
(
const
KeyEvent
&
event
);
const
std
::
string
&
getKey
()
const
;
const
std
::
string
&
getKey
()
const
;
const
std
::
string
&
getValue
()
const
;
private:
private:
std
::
string
m_key
;
std
::
string
m_key
;
std
::
string
m_value
;
};
};
}
}
...
...
src/RemoveKeyEvent.cpp
→
src/RemoveKey
Value
Event.cpp
View file @
5d7fa164
...
@@ -14,28 +14,28 @@
...
@@ -14,28 +14,28 @@
* limitations under the Licence.
* limitations under the Licence.
*/
*/
#include
"RemoveKeyEvent.h"
#include
<iostream>
#include
<iostream>
#include
"RemoveKeyValueEvent.h"
namespace
cameo
{
namespace
cameo
{
RemoveKeyEvent
::
RemoveKeyEvent
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
)
:
RemoveKey
Value
Event
::
RemoveKey
Value
Event
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
,
const
std
::
string
&
value
)
:
KeyEvent
(
id
,
name
,
key
)
{
KeyEvent
(
id
,
name
,
key
,
value
)
{
}
}
RemoveKeyEvent
::
RemoveKeyEvent
(
const
RemoveKeyEvent
&
event
)
:
RemoveKey
Value
Event
::
RemoveKey
Value
Event
(
const
RemoveKey
Value
Event
&
event
)
:
KeyEvent
(
event
)
{
KeyEvent
(
event
)
{
}
}
RemoveKeyEvent
*
RemoveKeyEvent
::
clone
()
{
RemoveKey
Value
Event
*
RemoveKey
Value
Event
::
clone
()
{
return
new
RemoveKeyEvent
(
*
this
);
return
new
RemoveKey
Value
Event
(
*
this
);
}
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
cameo
::
RemoveKeyEvent
&
event
)
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
cameo
::
RemoveKey
Value
Event
&
event
)
{
os
<<
"name="
<<
event
.
m_name
os
<<
"name="
<<
event
.
m_name
<<
"
\n
id="
<<
event
.
m_id
<<
"
\n
id="
<<
event
.
m_id
<<
"
\n
key="
<<
event
.
m_key
;
<<
"
\n
key="
<<
event
.
m_key
<<
"
\n
value="
<<
event
.
m_value
;
return
os
;
return
os
;
}
}
...
...
src/RemoveKeyEvent.h
→
src/RemoveKey
Value
Event.h
View file @
5d7fa164
...
@@ -14,26 +14,26 @@
...
@@ -14,26 +14,26 @@
* limitations under the Licence.
* limitations under the Licence.
*/
*/
#ifndef CAMEO_REMOVEKEYEVENT_H_
#ifndef CAMEO_REMOVEKEY
VALUE
EVENT_H_
#define CAMEO_REMOVEKEYEVENT_H_
#define CAMEO_REMOVEKEY
VALUE
EVENT_H_
#include
<iostream>
#include
<iostream>
#include
"KeyEvent.h"
#include
"KeyEvent.h"
namespace
cameo
{
namespace
cameo
{
class
RemoveKeyEvent
:
public
KeyEvent
{
class
RemoveKey
Value
Event
:
public
KeyEvent
{
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
RemoveKeyEvent
&
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
RemoveKey
Value
Event
&
);
public:
public:
RemoveKeyEvent
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
);
RemoveKey
Value
Event
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
,
const
std
::
string
&
value
);
RemoveKeyEvent
(
const
RemoveKeyEvent
&
event
);
RemoveKey
Value
Event
(
const
RemoveKey
Value
Event
&
event
);
virtual
RemoveKeyEvent
*
clone
();
virtual
RemoveKey
Value
Event
*
clone
();
};
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
RemoveKeyEvent
&
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
RemoveKey
Value
Event
&
);
}
}
...
...
src/StoreKeyValueEvent.cpp
View file @
5d7fa164
...
@@ -21,22 +21,17 @@
...
@@ -21,22 +21,17 @@
namespace
cameo
{
namespace
cameo
{
StoreKeyValueEvent
::
StoreKeyValueEvent
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
,
const
std
::
string
&
value
)
:
StoreKeyValueEvent
::
StoreKeyValueEvent
(
int
id
,
const
std
::
string
&
name
,
const
std
::
string
&
key
,
const
std
::
string
&
value
)
:
KeyEvent
(
id
,
name
,
key
),
KeyEvent
(
id
,
name
,
key
,
value
)
{
m_value
(
value
)
{
}
}
StoreKeyValueEvent
::
StoreKeyValueEvent
(
const
StoreKeyValueEvent
&
event
)
:
StoreKeyValueEvent
::
StoreKeyValueEvent
(
const
StoreKeyValueEvent
&
event
)
:
KeyEvent
(
event
)
,
m_value
(
event
.
m_value
)
{
KeyEvent
(
event
)
{
}
}
StoreKeyValueEvent
*
StoreKeyValueEvent
::
clone
()
{
StoreKeyValueEvent
*
StoreKeyValueEvent
::
clone
()
{
return
new
StoreKeyValueEvent
(
*
this
);
return
new
StoreKeyValueEvent
(
*
this
);
}
}
const
std
::
string
&
StoreKeyValueEvent
::
getValue
()
const
{
return
m_value
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
cameo
::
StoreKeyValueEvent
&
event
)
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
cameo
::
StoreKeyValueEvent
&
event
)
{
os
<<
"name="
<<
event
.
m_name
os
<<
"name="
<<
event
.
m_name
<<
"
\n
id="
<<
event
.
m_id
<<
"
\n
id="
<<
event
.
m_id
...
...
src/StoreKeyValueEvent.h
View file @
5d7fa164
...
@@ -31,11 +31,6 @@ public:
...
@@ -31,11 +31,6 @@ public:
StoreKeyValueEvent
(
const
StoreKeyValueEvent
&
event
);
StoreKeyValueEvent
(
const
StoreKeyValueEvent
&
event
);
virtual
StoreKeyValueEvent
*
clone
();
virtual
StoreKeyValueEvent
*
clone
();
const
std
::
string
&
getValue
()
const
;
private:
std
::
string
m_value
;
};
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
StoreKeyValueEvent
&
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
StoreKeyValueEvent
&
);
...
...
src/message/Message.h
View file @
5d7fa164
...
@@ -70,7 +70,7 @@ namespace message {
...
@@ -70,7 +70,7 @@ namespace message {
constexpr
const
char
*
PORT
=
"PORT"
;
constexpr
const
char
*
PORT
=
"PORT"
;
constexpr
const
char
*
PUBLISHER
=
"PUBLISHER"
;
constexpr
const
char
*
PUBLISHER
=
"PUBLISHER"
;
constexpr
const
char
*
STOREKEYVALUE
=
"STOREKEYVALUE"
;
constexpr
const
char
*
STOREKEYVALUE
=
"STOREKEYVALUE"
;
constexpr
const
char
*
REMOVEKEY
=
"REMOVEKEY"
;
constexpr
const
char
*
REMOVEKEY
VALUE
=
"REMOVEKEY
VALUE
"
;
}
}
namespace
SyncStreamRequest
{
namespace
SyncStreamRequest
{
...
@@ -281,10 +281,11 @@ namespace message {
...
@@ -281,10 +281,11 @@ namespace message {
constexpr
const
char
*
VALUE
=
"value"
;
// string
constexpr
const
char
*
VALUE
=
"value"
;
// string
}
}
namespace
RemoveKeyEvent
{
namespace
RemoveKey
Value
Event
{
constexpr
const
char
*
ID
=
"id"
;
// int32
constexpr
const
char
*
ID
=
"id"
;
// int32
constexpr
const
char
*
NAME
=
"name"
;
// string
constexpr
const
char
*
NAME
=
"name"
;
// string
constexpr
const
char
*
KEY
=
"key"
;
// string
constexpr
const
char
*
KEY
=
"key"
;
// string
constexpr
const
char
*
VALUE
=
"value"
;
// string
}
}
}
}
...
...
Shervin Nourbakhsh
@nourbakhsh
mentioned in commit
46e44691
·
Apr 23, 2021
mentioned in commit
46e44691
mentioned in commit 46e44691a03808a23a464818487b0dd014a9c57e
Toggle commit list
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment