qredisclient
|
The Connection class Main client class. More...
#include <connection.h>
Classes | |
class | InvalidModeException |
Public Types | |
enum | Mode { Normal, PubSub, Cluster, Sentinel } |
typedef QList< QByteArray > | RawKeysList |
RawKeysList. | |
typedef std::function< void(const RawKeysList &, const QString &)> | RawKeysListCallback |
typedef QPair< QString, int > | Host |
typedef QList< Host > | HostList |
typedef std::function< void(QVariant, QString err)> | CollectionCallback |
CollectionCallback. | |
typedef std::function< void(QVariant, QString err, bool final)> | IncrementalCollectionCallback |
IncrementalCollectionCallback. | |
Signals | |
void | addCommandToWorker (const Command &) |
void | error (const QString &) |
void | log (const QString &) |
void | connected () |
void | disconnected () |
void | authOk () |
void | authError (const QString &) |
void | reconnectTo (const QString &host, int port) |
Public Member Functions | |
Connection (const ConnectionConfig &c, bool autoConnect=true) | |
Constructs connection class. More... | |
virtual | ~Connection () |
~Connection If connection established internally call disconnect() | |
virtual bool | connect (bool wait=true) |
connects to redis-server More... | |
virtual bool | isConnected () |
isConnected More... | |
virtual void | disconnect () |
disconnect from redis-server | |
ConnectionConfig | getConfig () const |
getConfig More... | |
void | setConnectionConfig (const ConnectionConfig &) |
setConnectionConfig | |
Mode | mode () const |
Get current mode. More... | |
virtual double | getServerVersion () |
Get redis-server version. More... | |
virtual DatabaseList | getKeyspaceInfo () |
Get keyspace info parsed from INFO command. More... | |
virtual void | getDatabaseKeys (RawKeysListCallback callback, const QString &pattern=QString("*"), uint dbIndex=0) |
getDatabaseKeys - async keys loading More... | |
virtual void | getClusterKeys (RawKeysListCallback callback, const QString &pattern) |
getClusterKeys - async keys loading from all cluster nodes More... | |
HostList | getMasterNodes () |
getMasterNodes - Get master nodes of cluster More... | |
void | command (const Command &cmd) |
command More... | |
void | command (QList< QByteArray > rawCmd, int db=-1) |
Execute command without callback in async mode. More... | |
void | command (QList< QByteArray > rawCmd, QObject *owner, RedisClient::Command::Callback callback, int db=-1) |
Execute command with callback in async mode. More... | |
Response | commandSync (const Command &cmd) |
commandSync More... | |
Response | commandSync (QList< QByteArray > rawCmd, int db=-1) |
Execute command without callback and wait for response. More... | |
Response | commandSync (QString cmd, int db=-1) |
Response | commandSync (QString cmd, QString arg1, int db=-1) |
Response | commandSync (QString cmd, QString arg1, QString arg2, int db=-1) |
Response | commandSync (QString cmd, QString arg1, QString arg2, QString arg3, int db=-1) |
virtual void | retrieveCollection (QSharedPointer< ScanCommand > cmd, CollectionCallback callback) |
retrieveCollection More... | |
virtual void | retrieveCollectionIncrementally (QSharedPointer< ScanCommand > cmd, IncrementalCollectionCallback callback) |
retrieveCollection More... | |
virtual void | runCommand (const Command &cmd) |
runCommand - Low level commands execution API More... | |
bool | waitForIdle (uint timeout) |
waitForIdle - Wait until all commands in queue will be processed More... | |
void | setTransporter (QSharedPointer< AbstractTransporter >) |
QSharedPointer< AbstractTransporter > | getTransporter () const |
Protected Slots | |
void | auth () |
Protected Member Functions | |
void | createTransporter () |
bool | isTransporterRunning () |
Response | internalCommandSync (QList< QByteArray > rawCmd) |
void | processScanCommand (QSharedPointer< ScanCommand > cmd, CollectionCallback callback, QSharedPointer< QVariantList > result=QSharedPointer< QVariantList >(), bool incrementalProcessing=false) |
void | changeCurrentDbNumber (int db) |
Protected Attributes | |
ConnectionConfig | m_config |
QSharedPointer< QThread > | m_transporterThread |
QSharedPointer< AbstractTransporter > | m_transporter |
int | m_dbNumber |
ServerInfo | m_serverInfo |
Mode | m_currentMode |
QMutex | m_dbNumberMutex |
bool | m_autoConnect |
bool | m_stoppingTransporter |
RawKeysListCallback | m_wrapper |
Friends | |
class | AbstractTransporter |
The Connection class Main client class.
RedisClient::Connection::Connection | ( | const ConnectionConfig & | c, |
bool | autoConnect = true |
||
) |
Constructs connection class.
c | - connection config NOTE: different config options are required for different transporters. |
void RedisClient::Connection::command | ( | const Command & | cmd | ) |
command
cmd |
void RedisClient::Connection::command | ( | QList< QByteArray > | rawCmd, |
int | db = -1 |
||
) |
Execute command without callback in async mode.
rawCmd | |
db |
void RedisClient::Connection::command | ( | QList< QByteArray > | rawCmd, |
QObject * | owner, | ||
RedisClient::Command::Callback | callback, | ||
int | db = -1 |
||
) |
Execute command with callback in async mode.
rawCmd | |
owner | |
callback | |
db |
RedisClient::Response RedisClient::Connection::commandSync | ( | const Command & | cmd | ) |
commandSync
cmd |
RedisClient::Response RedisClient::Connection::commandSync | ( | QList< QByteArray > | rawCmd, |
int | db = -1 |
||
) |
Execute command without callback and wait for response.
rawCmd | |
db |
|
virtual |
connects to redis-server
wait | - true = sync mode, false = async mode |
Connection::Exception | if config is invalid or something went wrong. |
|
virtual |
getClusterKeys - async keys loading from all cluster nodes
callback | |
pattern |
RedisClient::ConnectionConfig RedisClient::Connection::getConfig | ( | ) | const |
getConfig
|
virtual |
getDatabaseKeys - async keys loading
callback | |
pattern | |
dbIndex |
|
virtual |
Get keyspace info parsed from INFO command.
RedisClient::Connection::HostList RedisClient::Connection::getMasterNodes | ( | ) |
getMasterNodes - Get master nodes of cluster
|
virtual |
Get redis-server version.
|
virtual |
isConnected
RedisClient::Connection::Mode RedisClient::Connection::mode | ( | ) | const |
Get current mode.
|
virtual |
retrieveCollection
cmd | |
callback |
|
virtual |
retrieveCollection
cmd | |
callback |
|
virtual |
runCommand - Low level commands execution API
cmd |
bool RedisClient::Connection::waitForIdle | ( | uint | timeout | ) |
waitForIdle - Wait until all commands in queue will be processed
timeout | - in milliseconds |