forked from OpenAtomFoundation/pika
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Pub/Sub (OpenAtomFoundation#207)
* add pubsub interface * modify client connection flag * bugfix * bugfix * bugfix * add pubsub() * type * bugfix channels name * format * optimize code * bugfix interface * bugfix * bugfix * optimize code * bugfix * bugfix * fix conflict * fix conflict * modify header file
- Loading branch information
1 parent
036b8fd
commit a76dd54
Showing
9 changed files
with
566 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (c) 2015-present, Qihoo, Inc. All rights reserved. | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. An additional grant | ||
// of patent rights can be found in the PATENTS file in the same directory. | ||
|
||
#ifndef PIKA_PUBSUB_H_ | ||
#define PIKA_PUBSUB_H_ | ||
#include "pika_command.h" | ||
|
||
/* | ||
* pubsub | ||
*/ | ||
class PublishCmd : public Cmd { | ||
public: | ||
PublishCmd() {} | ||
virtual void Do(); | ||
private: | ||
std::string channel_; | ||
std::string msg_; | ||
virtual void DoInitial(PikaCmdArgsType &argv, const CmdInfo* const ptr_info); | ||
}; | ||
|
||
class SubscribeCmd : public Cmd { | ||
public: | ||
SubscribeCmd() {} | ||
virtual void Do(); | ||
private: | ||
virtual void DoInitial(PikaCmdArgsType &argv, const CmdInfo* const ptr_info); | ||
}; | ||
|
||
class UnSubscribeCmd : public Cmd { | ||
public: | ||
UnSubscribeCmd() {} | ||
virtual void Do(); | ||
private: | ||
virtual void DoInitial(PikaCmdArgsType &argv, const CmdInfo* const ptr_info); | ||
}; | ||
|
||
class PUnSubscribeCmd : public Cmd { | ||
public: | ||
PUnSubscribeCmd() {} | ||
virtual void Do(); | ||
private: | ||
virtual void DoInitial(PikaCmdArgsType &argv, const CmdInfo* const ptr_info); | ||
}; | ||
|
||
class PSubscribeCmd : public Cmd { | ||
public: | ||
PSubscribeCmd() {} | ||
virtual void Do(); | ||
private: | ||
virtual void DoInitial(PikaCmdArgsType &argv, const CmdInfo* const ptr_info); | ||
}; | ||
|
||
class PubSubCmd : public Cmd { | ||
public: | ||
PubSubCmd() {} | ||
virtual void Do(); | ||
private: | ||
std::string subcommand_; | ||
std::vector<std::string > arguments_; | ||
virtual void DoInitial(PikaCmdArgsType &argv, const CmdInfo* const ptr_info); | ||
virtual void Clear() { | ||
arguments_.clear(); | ||
} | ||
}; | ||
|
||
#endif // INCLUDE_PIKA_PUBSUB_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.