acl
3.5.3.0
|
#include <redis_stream.hpp>
Public 成员函数 | |
redis_stream (void) | |
redis_stream (redis_client *conn) | |
redis_stream (redis_client_cluster *cluster) | |
redis_stream (redis_client_pipeline *pipeline) | |
ACL_CPP_DEPRECATED | redis_stream (redis_client_cluster *cluster, size_t max_conns) |
virtual | ~redis_stream (void) |
bool | xadd (const char *key, const std::map< string, string > &fields, string &result, const char *id="*") |
bool | xadd (const char *key, const std::vector< string > &names, const std::vector< string > &values, string &result, const char *id="*") |
bool | xadd (const char *key, const std::vector< const char * > &names, const std::vector< const char * > &values, string &result, const char *id="*") |
bool | xadd (const char *key, const char *names[], const size_t names_len[], const char *values[], const size_t values_len[], size_t argc, string &result, const char *id="*") |
bool | xadd_with_maxlen (const char *key, size_t maxlen, const std::map< string, string > &fields, string &result, const char *id="*") |
int | xlen (const char *key) |
int | xdel (const char *key, const char *id) |
int | xdel (const char *key, const std::vector< string > &ids) |
int | xdel (const char *key, const std::vector< const char * > &ids) |
int | xtrim (const char *key, size_t maxlen, bool tilde=false) |
bool | xread (redis_stream_messages &messages, const std::map< string, string > &streams, size_t count=1000, ssize_t block=0) |
bool | xreadgroup (redis_stream_messages &messages, const char *group, const char *consumer, const std::map< string, string > &streams, size_t count=1000, ssize_t block=0, bool noack=false) |
bool | xreadgroup_with_noack (redis_stream_messages &messages, const char *group, const char *consumer, const std::map< string, string > &streams, size_t count=1000, ssize_t block=0) |
bool | xrange (redis_stream_messages &messages, const char *key, const char *start="-", const char *end="+", size_t count=1000) |
bool | xrevrange (redis_stream_messages &messages, const char *key, const char *start="+", const char *end="-", size_t count=1000) |
bool | xclaim (std::vector< redis_stream_message > &messages, const char *key, const char *group, const char *consumer, long min_idle_time, const std::vector< string > &ids, size_t idle=0, long long time_ms=-1, int retry_count=-1, bool force=false) |
bool | xclaim_with_justid (std::vector< string > &messages_ids, const char *key, const char *group, const char *consumer, long min_idle_time, const std::vector< string > &ids, size_t idle=0, long long time_ms=-1, int retry_count=-1, bool force=false) |
int | xack (const char *key, const char *group, const char *id) |
int | xack (const char *key, const char *group, const std::vector< string > &ids) |
int | xack (const char *key, const char *group, const std::vector< const char * > &ids) |
int | xack (const char *key, const char *group, const std::list< string > &ids, size_t size) |
int | xack (const char *key, const char *group, const std::list< const char * > &ids, size_t size) |
bool | xpending_summary (const char *key, const char *group, redis_pending_summary &result) |
bool | xpending_detail (redis_pending_detail &result, const char *key, const char *group, const char *start_id="-", const char *end_id="+", size_t count=1, const char *consumer=NULL) |
bool | xgroup_help (std::vector< string > &result) |
bool | xgroup_create (const char *key, const char *group, const char *id="$", bool mkstream=true) |
int | xgroup_destroy (const char *key, const char *group) |
bool | xgroup_setid (const char *key, const char *group, const char *id="$") |
int | xgroup_delconsumer (const char *key, const char *group, const char *consumer) |
bool | xinfo_help (std::vector< string > &result) |
bool | xinfo_consumers (const char *key, const char *group, std::map< string, redis_xinfo_consumer > &result) |
bool | xinfo_groups (const char *key, std::map< string, redis_xinfo_group > &result) |
bool | xinfo_stream (const char *key, redis_stream_info &result) |
Public 成员函数 继承自 acl::redis_command | |
redis_command (void) | |
redis_command (redis_client *conn) | |
redis_command (redis_client_cluster *cluster) | |
ACL_CPP_DEPRECATED | redis_command (redis_client_cluster *cluster, size_t max_conns) |
redis_command (redis_client_pipeline *pipeline) | |
virtual | ~redis_command (void) |
void | set_check_addr (bool on) |
void | clear (bool save_slot=false) |
void | reset (bool save_slot=false) |
void | set_client (redis_client *conn) |
redis_client * | get_client (void) const |
const char * | get_client_addr (void) const |
void | set_cluster (redis_client_cluster *cluster) |
ACL_CPP_DEPRECATED void | set_cluster (redis_client_cluster *cluster, size_t max_conns) |
redis_client_cluster * | get_cluster (void) const |
void | set_pipeline (redis_client_pipeline *pipeline, bool use_mbox=true) |
redis_client_pipeline * | get_pipeline (void) const |
dbuf_pool * | get_dbuf (void) const |
redis_result_t | result_type (void) const |
const char * | result_status (void) const |
const char * | result_error (void) const |
size_t | result_size (void) const |
int | result_number (bool *success=NULL) const |
long long int | result_number64 (bool *success=NULL) const |
const char * | get_result (size_t i, size_t *len=NULL) const |
bool | eof (void) const |
const redis_result * | get_result (void) const |
const redis_result * | result_child (size_t i) const |
const char * | result_value (size_t i, size_t *len=NULL) const |
void | set_slice_request (bool on) |
void | set_slice_respond (bool on) |
const redis_result * | request (size_t argc, const char *argv[], size_t lens[], size_t nchild=0) |
const redis_result * | request (const std::vector< string > &args, size_t nchild=0) |
const string * | request_buf (void) const |
void | build_request (size_t argc, const char *argv[], size_t lens[]) |
void | hash_slot (const char *key) |
void | hash_slot (const char *key, size_t len) |
int | get_slot (void) const |
bool | is_check_addr (void) const |
const char * | get_addr (const char *info) |
void | set_client_addr (const char *addr) |
void | set_client_addr (redis_client &conn) |
redis_request * | get_request_obj (void) const |
string * | get_request_buf (void) const |
bool | is_slice_req (void) const |
redis_pipeline_message & | get_pipeline_message (void) |
额外继承的成员函数 | |
静态 Public 成员函数 继承自 acl::redis_command | |
static void | build_request (size_t argc, const char *argv[], size_t lens[], string &out) |
Protected 成员函数 继承自 acl::redis_command | |
const redis_result * | run (size_t nchild=0, int *timeout=NULL) |
void | clear_request (void) |
const redis_result ** | scan_keys (const char *cmd, const char *key, int &cursor, size_t &size, const char *pattern, const size_t *count) |
const redis_result ** | scan_keys (const char *cmd, const char *key, size_t klen, int &cursor, size_t &size, const char *pattern, const size_t *count) |
void | build (const char *cmd, const char *key, const std::map< string, string > &attrs) |
void | build (const char *cmd, const char *key, size_t klen, const std::map< string, string > &attrs) |
void | build (const char *cmd, const char *key, const std::map< string, const char * > &attrs) |
void | build (const char *cmd, const char *key, const std::vector< string > &names, const std::vector< string > &values) |
void | build (const char *cmd, const char *key, size_t klen, const std::vector< string > &names, const std::vector< string > &values) |
void | build (const char *cmd, const char *key, const std::vector< const char * > &names, const std::vector< const char * > &values) |
void | build (const char *cmd, const char *key, const char *names[], const char *values[], size_t argc) |
void | build (const char *cmd, const char *key, const int names[], const char *values[], size_t argc) |
void | build (const char *cmd, const char *key, const char *names[], const size_t names_len[], const char *values[], const size_t values_len[], size_t argc) |
void | build (const char *cmd, const char *key, size_t klen, const char *names[], const size_t names_len[], const char *values[], const size_t values_len[], size_t argc) |
void | build (const char *cmd, const char *key, const std::vector< string > &names) |
void | build (const char *cmd, const char *key, size_t klen, const std::vector< string > &names) |
void | build (const char *cmd, const char *key, const std::vector< const char * > &names) |
void | build (const char *cmd, const char *key, const std::vector< int > &names) |
void | build (const char *cmd, const char *key, const char *names[], size_t argc) |
void | build (const char *cmd, const char *key, const char *names[], const size_t lens[], size_t argc) |
void | build (const char *cmd, const char *key, size_t klen, const char *names[], const size_t lens[], size_t argc) |
void | build (const char *cmd, const char *key, const int names[], size_t argc) |
int | get_number (bool *success=NULL) |
long long int | get_number64 (bool *success=NULL) |
int | get_number (std::vector< int > &out) |
int | get_number64 (std::vector< long long int > &out) |
bool | check_status (const char *success="OK") |
int | get_status (std::vector< bool > &out) |
const char * | get_status (void) |
int | get_string (string &buf) |
int | get_string (string *buf) |
int | get_string (char *buf, size_t size) |
int | get_strings (std::vector< string > &result) |
int | get_strings (std::vector< string > *result) |
int | get_strings (std::list< string > &result) |
int | get_strings (std::list< string > *result) |
int | get_strings (std::map< string, string > &result) |
int | get_strings (std::vector< string > &names, std::vector< string > &values) |
int | get_strings (std::vector< const char * > &names, std::vector< const char * > &values) |
void | argv_space (size_t n) |
void | build_request1 (size_t argc, const char *argv[], size_t lens[]) |
void | build_request2 (size_t argc, const char *argv[], size_t lens[]) |
void | logger_result (const redis_result *result) |
Protected 成员函数 继承自 acl::acl::noncopyable | |
noncopyable () | |
~noncopyable () | |
Protected 属性 继承自 acl::redis_command | |
dbuf_pool * | dbuf_ |
bool | check_addr_ |
char | addr_ [32] |
redis_client * | conn_ |
redis_client_cluster * | cluster_ |
redis_client_pipeline * | pipeline_ |
bool | pipe_use_mbox_ |
int | slot_ |
int | redirect_max_ |
int | redirect_sleep_ |
bool | slice_req_ |
string * | request_buf_ |
redis_request * | request_obj_ |
size_t | argv_size_ |
const char ** | argv_ |
size_t * | argv_lens_ |
size_t | argc_ |
bool | slice_res_ |
redis_pipeline_message * | pipe_msg_ |
const redis_result * | result_ |
在文件 redis_stream.hpp 第 142 行定义.
acl::redis_stream::redis_stream | ( | void | ) |
acl::redis_stream::redis_stream | ( | redis_client * | conn | ) |
acl::redis_stream::redis_stream | ( | redis_client_cluster * | cluster | ) |
acl::redis_stream::redis_stream | ( | redis_client_pipeline * | pipeline | ) |
ACL_CPP_DEPRECATED acl::redis_stream::redis_stream | ( | redis_client_cluster * | cluster, |
size_t | max_conns | ||
) |
|
virtual |
int acl::redis_stream::xack | ( | const char * | key, |
const char * | group, | ||
const char * | id | ||
) |
Removes one message from the pending entries list (PEL) of a stream consumer group.
key | {const char*} |
group | {const char*} |
id | {const char*} |
int acl::redis_stream::xack | ( | const char * | key, |
const char * | group, | ||
const std::vector< string > & | ids | ||
) |
Removes one or multiple message from the pending entries list (PEL) of a stream consumer group.
key | {const char*} |
group | {const char*} |
ids | {const std::vector<string>&} |
int acl::redis_stream::xack | ( | const char * | key, |
const char * | group, | ||
const std::vector< const char * > & | ids | ||
) |
int acl::redis_stream::xack | ( | const char * | key, |
const char * | group, | ||
const std::list< string > & | ids, | ||
size_t | size | ||
) |
int acl::redis_stream::xack | ( | const char * | key, |
const char * | group, | ||
const std::list< const char * > & | ids, | ||
size_t | size | ||
) |
bool acl::redis_stream::xadd | ( | const char * | key, |
const std::map< string, string > & | fields, | ||
string & | result, | ||
const char * | id = "*" |
||
) |
appends the specified stream entry to the stream at the specified key
key | {const char*} the specified key of the stream |
fields | {const std::map<string, string>&} holds all the entries to be appended to the stream, the map's key is the entry's name, and the value is the entry's value |
result | {string&} will hold the message-id of the added entry |
id | {const char*} a stream entry ID identifies a given entry inside a stream, default "*" mean that redis-server will choose one ID internal. When the user specified and explicit ID, the ID's format is look like 1526919030474-55 that includes two numbers separated by '-', the minimum valid ID is 0-1 param maxlen {size_t} if > 0, limit the size of the stream |
bool acl::redis_stream::xadd | ( | const char * | key, |
const std::vector< string > & | names, | ||
const std::vector< string > & | values, | ||
string & | result, | ||
const char * | id = "*" |
||
) |
bool acl::redis_stream::xadd | ( | const char * | key, |
const std::vector< const char * > & | names, | ||
const std::vector< const char * > & | values, | ||
string & | result, | ||
const char * | id = "*" |
||
) |
bool acl::redis_stream::xadd | ( | const char * | key, |
const char * | names[], | ||
const size_t | names_len[], | ||
const char * | values[], | ||
const size_t | values_len[], | ||
size_t | argc, | ||
string & | result, | ||
const char * | id = "*" |
||
) |
bool acl::redis_stream::xadd_with_maxlen | ( | const char * | key, |
size_t | maxlen, | ||
const std::map< string, string > & | fields, | ||
string & | result, | ||
const char * | id = "*" |
||
) |
bool acl::redis_stream::xclaim | ( | std::vector< redis_stream_message > & | messages, |
const char * | key, | ||
const char * | group, | ||
const char * | consumer, | ||
long | min_idle_time, | ||
const std::vector< string > & | ids, | ||
size_t | idle = 0 , |
||
long long | time_ms = -1 , |
||
int | retry_count = -1 , |
||
bool | force = false |
||
) |
In the context of a stream consumer group, this command changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument.
messages | {std::vector<redis_stream_message>&} holds the messages been XLAIMed |
key | {const char*} |
group | {const char*} |
consumer | {const char*} |
min_idle_time | {long} |
ids | {const std::vector<string>&} the IDs to be XCLAIMed |
idle | {size_t} |
time_ms | {long long} |
retry_count | {int} |
force | {bool} |
bool acl::redis_stream::xclaim_with_justid | ( | std::vector< string > & | messages_ids, |
const char * | key, | ||
const char * | group, | ||
const char * | consumer, | ||
long | min_idle_time, | ||
const std::vector< string > & | ids, | ||
size_t | idle = 0 , |
||
long long | time_ms = -1 , |
||
int | retry_count = -1 , |
||
bool | force = false |
||
) |
XCLAIM with the JUSTID subcommand
int acl::redis_stream::xdel | ( | const char * | key, |
const char * | id | ||
) |
removes the specified entries from a stream, and returns the number of entries deleted, that may be different from the number of IDs passed to the command in case certain IDs do not exist.
key | {const char*} the specified key of the stream |
id | {const char*} a stream entry ID look like 1526919030474-55 |
int acl::redis_stream::xdel | ( | const char * | key, |
const std::vector< string > & | ids | ||
) |
removes some entries with the specified IDs, and returns the number of entries deleted.
key | {const char*} |
ids | {const std::vector<string>&} holds the entries' IDs to be deleted |
int acl::redis_stream::xdel | ( | const char * | key, |
const std::vector< const char * > & | ids | ||
) |
bool acl::redis_stream::xgroup_create | ( | const char * | key, |
const char * | group, | ||
const char * | id = "$" , |
||
bool | mkstream = true |
||
) |
The XGROUP command with the subcommand CREATE
key | {const char*} |
group | {const char*} |
id | {const char*} the ID of the last item in the stream to consider already delivered, "$" means the ID of the last item in the stream |
mkstream | {bool} when mkstream is true, the stream with the specified key will be created if the stream doesn't exist |
int acl::redis_stream::xgroup_delconsumer | ( | const char * | key, |
const char * | group, | ||
const char * | consumer | ||
) |
The XGROUP command with the subcommand DELCONSUMER. With this command, just remove a given consumer from a consumer group.
key | {const char*} |
group | {const char*} |
consumer | {const char*} |
int acl::redis_stream::xgroup_destroy | ( | const char * | key, |
const char * | group | ||
) |
The XGROUP command with the subcommand DESTROY. With this command, the consumer group will be destroyed even if there are active consumers and pending messages, so make sure to call this command only when really needed.
key | {const char*} |
group | {const char*} |
bool acl::redis_stream::xgroup_help | ( | std::vector< string > & | result | ) |
The XGROUP command with the subcommand HELP
result | {std::vector<string>&} will hold the result |
bool acl::redis_stream::xgroup_setid | ( | const char * | key, |
const char * | group, | ||
const char * | id = "$" |
||
) |
bool acl::redis_stream::xinfo_consumers | ( | const char * | key, |
const char * | group, | ||
std::map< string, redis_xinfo_consumer > & | result | ||
) |
The XINFO command with the subcommand CONSUMERS. With this command, every consumer in a specific consumer group can be got.
key | {const char*} |
group | {const char*} |
result | {std::map<string, redis_xinfo_consumer>&} |
bool acl::redis_stream::xinfo_groups | ( | const char * | key, |
std::map< string, redis_xinfo_group > & | result | ||
) |
The XINFO command with the subcommand GROUPS.
key | {const char*} |
result | {std::map<string, redis_xinfo_group>&} |
bool acl::redis_stream::xinfo_help | ( | std::vector< string > & | result | ) |
The XINFO command with the subcommand HELP
result | {std::vector<string>&} |
bool acl::redis_stream::xinfo_stream | ( | const char * | key, |
redis_stream_info & | result | ||
) |
The XINFO command with the subcommand STREAM. In this form the command returns general information about the stream stored at the specified key.
key | {const char*} |
result | {redis_stream_info&} devined about |
int acl::redis_stream::xlen | ( | const char * | key | ) |
returns the number of entries inside a stream.
key | {const char*} the specified key of the stream |
bool acl::redis_stream::xpending_detail | ( | redis_pending_detail & | result, |
const char * | key, | ||
const char * | group, | ||
const char * | start_id = "-" , |
||
const char * | end_id = "+" , |
||
size_t | count = 1 , |
||
const char * | consumer = NULL |
||
) |
The XPENDING command with DETAIL subcommand.
result | {redis_pending_summary&} defined above |
key | {const char*} |
group | {const char*} |
start_id | {const char*} |
end_id | {const char*} |
count | {size_t} limit the max count to be saved in result |
consumer | {const char*} |
bool acl::redis_stream::xpending_summary | ( | const char * | key, |
const char * | group, | ||
redis_pending_summary & | result | ||
) |
The XPENDING command with SUMMARY subcommand.
key | {const char*} |
group | {const char*} |
result | {redis_pending_summary&} defined above |
bool acl::redis_stream::xrange | ( | redis_stream_messages & | messages, |
const char * | key, | ||
const char * | start = "-" , |
||
const char * | end = "+" , |
||
size_t | count = 1000 |
||
) |
The command returns the stream entries matching a given range of IDs.
messages | {redis_stream_messages&} |
key | {const char*} |
start | {const char*} the start ID of the query interval; '-' means starting from the minimum ID possible inside a stream |
end | {const char*} the end ID of the query interval; '+' means the end of the maximum ID possible inside a stream |
count | {size_t} reduce the number of entries reported |
bool acl::redis_stream::xread | ( | redis_stream_messages & | messages, |
const std::map< string, string > & | streams, | ||
size_t | count = 1000 , |
||
ssize_t | block = 0 |
||
) |
read data from one or multiple streams, only returning entries with an ID greater than the last received ID reported by the caller.
messages | {redis_stream_messages&} will hold the read's items, redis_stream_messages defined above |
streams | {const std::map<string, string>&} holds the specified streams' keys to be read by users |
count | {size_t} specifies the max count of items to be read, no limit when 0 was set |
block | {ssize_t} specifies the read timeout, block if 0 set, no-block if -1 set |
bool acl::redis_stream::xreadgroup | ( | redis_stream_messages & | messages, |
const char * | group, | ||
const char * | consumer, | ||
const std::map< string, string > & | streams, | ||
size_t | count = 1000 , |
||
ssize_t | block = 0 , |
||
bool | noack = false |
||
) |
the XREADGROUP command is a special version of the XREAD command with support for consumer groups.
messages | {redis_stream_messages&} |
group | {const char*} the consumer group |
consumer | {const char*} the consumer belonging to the group |
streams | {const std::map<string, string>&} holds the streams' keys and IDs for each streams, the map's key is the stream's key and the map's value is the stream's ID option, which can be one of the following two:
|
count | {size_t} |
block | {ssize_t} set the blocked timeout waiting for messages, if block is 0, will block until getting one message at least; if block is -1, don't block for messages. |
noack | {bool} The NOACK subcommand can be used to avoid adding the message to the PEL in cases where reliability is not a requirement and the occasional message loss is acceptable. This is equivalent to acknowledging the message when it is read. |
bool acl::redis_stream::xreadgroup_with_noack | ( | redis_stream_messages & | messages, |
const char * | group, | ||
const char * | consumer, | ||
const std::map< string, string > & | streams, | ||
size_t | count = 1000 , |
||
ssize_t | block = 0 |
||
) |
the XREADGROUP with NOACK subcommand for reading messages.
messages | {redis_stream_messages&} |
group | {const char*} |
consumer | {const char*} |
streams | {const std::map<string, string>&} |
count | {size_t} |
block | {ssize_t} |
bool acl::redis_stream::xrevrange | ( | redis_stream_messages & | messages, |
const char * | key, | ||
const char * | start = "+" , |
||
const char * | end = "-" , |
||
size_t | count = 1000 |
||
) |
Return a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from greater to smaller IDs) compared to XRANGE.
messages | {redis_stream_messages&} |
key | {const char*} |
start | {const char*} start with the higher ID |
end | (const char*} end with the lower ID |
count | {size_t} |
int acl::redis_stream::xtrim | ( | const char * | key, |
size_t | maxlen, | ||
bool | tilde = false |
||
) |
trims the stream to a given number of items, evicting older items (items with lower IDs) if needed.
key | {const char*} |
maxlen | {size_t} specify the latest exactly items to be deleted |
tilde | {bool} if true, the number of items to be deleted is not exactly equal the maxlen, the real number maybe more than the maxlen with a few tens, but never less than the maxlen |