Redis asynchronous I/O connection allocation.
More...
#include <freeradius-devel/redis/base.h>
#include <freeradius-devel/util/event.h>
#include <freeradius-devel/server/connection.h>
#include <hiredis/async.h>
Go to the source code of this file.
Redis asynchronous I/O connection allocation.
- Id
- a027da416621b73fe9ea483a71b5a68ce52e2fb0
- Copyright
- 2019 The FreeRADIUS server project
-
2019 Network RADIUS SAS (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
- Author
- Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg)
Definition in file io.h.
◆ fr_redis_handle_t
Store I/O state.
There are three layers of wrapping structures
connection_t -> fr_redis_handle_t -> redisAsyncContext
Definition at line 66 of file io.h.
Data Fields |
redisAsyncContext * |
ac |
Async handle for hiredis. |
fr_dlist_head_t |
ignore |
Contains SQNs for responses that should be ignored. |
bool |
ignore_disconnect_cb |
Ensure that redisAsyncFree doesn't cause a callback loop. |
bool |
read_set |
We're listening for reads. |
fr_redis_sqn_t |
req_sqn |
Current redis request number. Note: It would take 5.8 million years running at 100,000 requests/s to overflow, but my OCD requires that the max uses for trunk connections is set to UINT64_MAX if not specified by the user. It's one branch, and it makes me happy, deal with it.
|
fr_redis_sqn_t |
rsp_sqn |
Current redis response number. |
fr_event_timer_t const * |
timer |
Connection timer. |
bool |
write_set |
We're listening for writes. |
◆ fr_redis_io_conf_t
struct fr_redis_io_conf_t |
Definition at line 41 of file io.h.
◆ fr_redis_sqn_ignore_t
struct fr_redis_sqn_ignore_t |
Definition at line 54 of file io.h.
◆ fr_redis_sqn_t
Definition at line 52 of file io.h.
◆ fr_redis_connection_alloc()
Allocate an async redis I/O connection.
Definition at line 422 of file io.c.
◆ fr_redis_connection_get_async_ctx()
redisAsyncContext* fr_redis_connection_get_async_ctx |
( |
connection_t * |
conn | ) |
|
Return the redisAsyncContext associated with the connection.
This is needed to issue commands to the redis server.
- Parameters
-
[in] | conn | To retrieve async ctx from. |
- Returns
- The async ctx.
Definition at line 455 of file io.c.
◆ fr_redis_connection_ignore_response()
Ignore a response with a specific sequence number.
- Parameters
-
[in] | h | to ignore the response on. |
[in] | sqn | the command to ignore. |
Definition at line 106 of file io.h.
◆ fr_redis_connection_process_response()
Update the response sequence number and check if we should ignore the response.
MUST be called for every reply received using the handle. Relies on the fact that responses from REDIS are FIFO with requests.
- Parameters
-
[in] | h | to check for ignored responses. |
Definition at line 124 of file io.h.
◆ fr_redis_connection_sent_request()
Tell the handle we sent a command, and get the SQN that command was assigned.
MUST be called for every command sent using the handle. Relies on the fact that responses from REDIS are FIFO with requests.
- Parameters
-
[in] | h | the request was sent on. |
- Returns
- the handle specific SQN.
Definition at line 96 of file io.h.