mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-07-15 16:14:12 +00:00
New ScanIterator class.
Not yet tested and only supporting the SCAN command for now, more to come. Also includes some refactoring that was needed to make everything work.
This commit is contained in:
parent
04b667485e
commit
c1e79c435b
10 changed files with 423 additions and 48 deletions
46
src/backends/redis/scan_iterator.cpp
Normal file
46
src/backends/redis/scan_iterator.cpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* Copyright 2015, 2016, Michele Santullo
|
||||
* This file is part of "dindexer".
|
||||
*
|
||||
* "dindexer" is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "dindexer" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with "dindexer". If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "scan_iterator.hpp"
|
||||
#include "command.hpp"
|
||||
#include <cassert>
|
||||
#include <ciso646>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace redis {
|
||||
namespace implem {
|
||||
ScanIteratorBaseClass::ScanIteratorBaseClass (Command* parCommand) :
|
||||
m_command(parCommand)
|
||||
{
|
||||
assert(m_command);
|
||||
assert(m_command->is_connected());
|
||||
}
|
||||
|
||||
bool ScanIteratorBaseClass::is_connected() const {
|
||||
return m_command and m_command->is_connected();
|
||||
}
|
||||
|
||||
RedisReplyType ScanIteratorBaseClass::run (const char* parCommand, long long parScanContext) {
|
||||
return m_command->run(parCommand, boost::lexical_cast<std::string>(parScanContext));
|
||||
}
|
||||
|
||||
RedisReplyType ScanIteratorBaseClass::run (const char* parCommand, const std::string& parParameter, long long parScanContext) {
|
||||
return m_command->run(parCommand, parParameter, boost::lexical_cast<std::string>(parScanContext));
|
||||
}
|
||||
} //namespace implem
|
||||
} //namespace redis
|
Loading…
Add table
Add a link
Reference in a new issue