-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
suport sending command to all nodes in cluster with the for_each inte…
…rface.
- Loading branch information
Showing
7 changed files
with
143 additions
and
0 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
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,57 @@ | ||
/************************************************************************** | ||
Copyright (c) 2023 sewenew | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*************************************************************************/ | ||
|
||
#ifndef SEWENEW_REDISPLUSPLUS_TEST_CLUSTER_TEST_H | ||
#define SEWENEW_REDISPLUSPLUS_TEST_CLUSTER_TEST_H | ||
|
||
#include <sw/redis++/redis++.h> | ||
|
||
namespace sw { | ||
|
||
namespace redis { | ||
|
||
namespace test { | ||
|
||
template <typename RedisInstance> | ||
class ClusterTest { | ||
public: | ||
explicit ClusterTest(RedisInstance &instance) : _redis(instance) {} | ||
|
||
void run(); | ||
|
||
private: | ||
RedisInstance &_redis; | ||
}; | ||
|
||
template <> | ||
class ClusterTest<sw::redis::Redis> { | ||
public: | ||
explicit ClusterTest(sw::redis::Redis &) {} | ||
|
||
void run() { | ||
// Do nothing, since this is cluster specific test. | ||
} | ||
}; | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
#include "cluster_test.hpp" | ||
|
||
#endif // end SEWENEW_REDISPLUSPLUS_TEST_CLUSTER_TEST_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/************************************************************************** | ||
Copyright (c) 2023 sewenew | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*************************************************************************/ | ||
|
||
#ifndef SEWENEW_REDISPLUSPLUS_TEST_CLUSTER_TEST_HPP | ||
#define SEWENEW_REDISPLUSPLUS_TEST_CLUSTER_TEST_HPP | ||
|
||
#include "utils.h" | ||
|
||
namespace sw { | ||
|
||
namespace redis { | ||
|
||
namespace test { | ||
|
||
template <typename RedisInstance> | ||
void ClusterTest<RedisInstance>::run() { | ||
_redis.for_each([](sw::redis::Redis &r) { | ||
REDIS_ASSERT(r.ping() == "PONG", "failed to test for_each"); | ||
}); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
#endif // end SEWENEW_REDISPLUSPLUS_TEST_CLUSTER_TEST_HPP |
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