![]() |
The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
|
Redis asynchronous cluster management. More...
#include <freeradius-devel/server/trunk.h>#include <freeradius-devel/io/coord_pair.h>#include "base.h"#include "pipeline.h"
Include dependency graph for cluster_async.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | KEY_SLOTS 16384 |
| Maximum number of keyslots (should not change). | |
| #define | REDIS_ASYNC_COORD_CALLBACKS(_thread_type) |
| #define | REDIS_ASYNC_START_RCODE_PROCESS(_rcode, _cluster, _cw, _coord_pair_reg, _error_msg, _error_ret) |
| Convenience macro to reduce boilerplate. | |
Typedefs | |
| typedef struct fr_redis_async_cmd_s | fr_redis_async_cmd_t |
| typedef struct fr_redis_ct_key_slot_s | fr_redis_ct_key_slot_t |
| typedef struct fr_redis_ct_node_s | fr_redis_ct_node_t |
Functions | |
| void | fr_redis_async_cmd_cancel (fr_redis_async_cmd_t *cmd) |
| Cancel a Redis async command. | |
| fr_redis_ct_node_t * | fr_redis_async_cmd_node (fr_redis_async_cmd_t *cmd) |
| Fetch the cluster node a command was last sent to. | |
| fr_redis_async_rcode_t | fr_redis_async_cmd_redirect (fr_redis_async_cmd_t *cmd) |
| Re-submit a redis async command set on a different node. | |
| fr_redis_async_rcode_t | fr_redis_async_cmd_resend (fr_redis_async_cmd_t *cmd) |
| Re-submit a redis async command set. | |
| fr_redis_async_cmd_t * | fr_redis_async_cmd_start (TALLOC_CTX *ctx, request_t *request, fr_redis_async_rcode_t *rcode, fr_redis_ct_t *rtcluster, uint8_t const *key, size_t key_len, fr_redis_command_set_t *cmds, bool read_only, fr_redis_ct_node_t *node) |
| Start running a command set on an async redis cluster. | |
| fr_redis_trunk_t * | fr_redis_async_cmd_trunk (fr_redis_async_cmd_t *cmd) |
| Fetch the redis trunk a command is associated with. | |
| fr_redis_ct_t * | fr_redis_ct_alloc (TALLOC_CTX *ctx, CONF_SECTION *tls_conf, fr_event_list_t *el, fr_redis_conf_t *conf, fr_redis_trunk_active_t active, void *active_uctx, bool active_oneshot) |
| Allocate per-thread, per-cluster instance. | |
| fr_event_list_t * | fr_redis_ct_el (fr_redis_ct_t *rtcluster) |
| char const * | fr_redis_ct_ipaddr (fr_redis_ct_node_t const *node) |
| Return the ipaddr of a particular node. | |
| int | fr_redis_ct_map_bootstrap (fr_redis_ct_t *rtcluster, fr_coord_worker_t *cw, fr_coord_pair_reg_t *coord_pair_reg) |
| Initiate bootstrapping of the cluster map. | |
| int | fr_redis_ct_map_fail (fr_redis_ct_t *rtcluster, fr_pair_list_t const *list) |
| fr_redis_async_rcode_t | fr_redis_ct_map_get (fr_redis_ct_t *rtcluster, fr_coord_worker_t *cw, fr_coord_pair_reg_t *coord_pair_reg, bool force) |
| Initiate updating of the cluster map. | |
| int | fr_redis_ct_map_update (fr_redis_ct_t *thread, fr_pair_list_t const *list) |
| Update a Redis cluster map from a pair list returned from a coordinator. | |
| fr_redis_ct_node_t const * | fr_redis_ct_master (fr_redis_ct_t *thread, fr_redis_ct_key_slot_t const *key_slot) |
| Return the master node that would be used for a particular key slot. | |
| fr_redis_async_rcode_t | fr_redis_ct_node_addr_by_role (TALLOC_CTX *ctx, fr_redis_io_conf_t *out[], uint8_t *count_out, fr_redis_ct_t *rtcluster, bool is_master, bool is_replica) |
| fr_redis_ct_node_t * | fr_redis_ct_node_by_addr (fr_redis_ct_t *rtcluster, fr_redis_io_conf_t *addr) |
| int | fr_redis_ct_port (uint16_t *out, fr_redis_ct_node_t const *node) |
| Return the port of a particular node. | |
| fr_redis_ct_node_t const * | fr_redis_ct_replica (fr_redis_ct_t *thread, fr_redis_ct_key_slot_t const *key_slot, uint8_t replica_num) |
| Return the replica node that would be used for a particular key slot. | |
| void | fr_redis_ct_request_yield (TALLOC_CTX *ctx, fr_redis_ct_t *rtcluster, request_t *request) |
| Add a request to the list of those waiting for the cluster map. | |
| fr_redis_ct_key_slot_t const * | fr_redis_ct_slot_by_key (fr_redis_ct_t *rtcluster, request_t *request, uint8_t const *key, size_t key_len) |
| Resolve key to key slot. | |
| trunk_conf_t const * | fr_redis_ct_trunk_conf (fr_redis_ct_t *thread) |
Redis asynchronous cluster management.
Definition in file cluster_async.h.
| #define KEY_SLOTS 16384 |
Maximum number of keyslots (should not change).
Definition at line 36 of file cluster_async.h.
| #define REDIS_ASYNC_COORD_CALLBACKS | ( | _thread_type | ) |
Definition at line 67 of file cluster_async.h.
| #define REDIS_ASYNC_START_RCODE_PROCESS | ( | _rcode, | |
| _cluster, | |||
| _cw, | |||
| _coord_pair_reg, | |||
| _error_msg, | |||
| _error_ret | |||
| ) |
Convenience macro to reduce boilerplate.
| _rcode | to process. |
| _cluster | Redis cluster thread. |
| _cw | Coordinator worker for cluster bootstrapping. |
| _coord_pair_reg | Coordinator pair reg for cluster bootstrapping. |
| _error_msg | Message to report on error. |
| _error_ret | Return value on error. |
Definition at line 51 of file cluster_async.h.
| typedef struct fr_redis_async_cmd_s fr_redis_async_cmd_t |
Definition at line 40 of file cluster_async.h.
| typedef struct fr_redis_ct_key_slot_s fr_redis_ct_key_slot_t |
Definition at line 38 of file cluster_async.h.
| typedef struct fr_redis_ct_node_s fr_redis_ct_node_t |
Definition at line 39 of file cluster_async.h.
| void fr_redis_async_cmd_cancel | ( | fr_redis_async_cmd_t * | cmd | ) |
Cancel a Redis async command.
Definition at line 528 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| fr_redis_ct_node_t * fr_redis_async_cmd_node | ( | fr_redis_async_cmd_t * | cmd | ) |
Fetch the cluster node a command was last sent to.
Definition at line 543 of file cluster_async.c.
Here is the caller graph for this function:| fr_redis_async_rcode_t fr_redis_async_cmd_redirect | ( | fr_redis_async_cmd_t * | cmd | ) |
Re-submit a redis async command set on a different node.
Using the node returned by a MOVED / ASK response.
| cmd | Async command set to redirect |
Definition at line 555 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| fr_redis_async_rcode_t fr_redis_async_cmd_resend | ( | fr_redis_async_cmd_t * | cmd | ) |
Re-submit a redis async command set.
To be used following TRYAGAIN responses
| cmd | Async command set to redirect |
Definition at line 578 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| fr_redis_async_cmd_t * fr_redis_async_cmd_start | ( | TALLOC_CTX * | ctx, |
| request_t * | request, | ||
| fr_redis_async_rcode_t * | rcode, | ||
| fr_redis_ct_t * | rtcluster, | ||
| uint8_t const * | key, | ||
| size_t | key_len, | ||
| fr_redis_command_set_t * | cmds, | ||
| bool | read_only, | ||
| fr_redis_ct_node_t * | node | ||
| ) |
Start running a command set on an async redis cluster.
| ctx | to allocate tracking structure. |
| request | current request. |
| rcode | Where to write the result code. |
| rtcluster | to start the command set on |
| key | to identify the cluster slot. |
| key_len | Length of key. |
| cmds | Command set to run. |
| read_only | Should the command set be run on read only nodes. |
| node | Specific node to run the command set on. |
Definition at line 474 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| fr_redis_trunk_t * fr_redis_async_cmd_trunk | ( | fr_redis_async_cmd_t * | cmd | ) |
Fetch the redis trunk a command is associated with.
Definition at line 536 of file cluster_async.c.
Here is the caller graph for this function:| fr_redis_ct_t * fr_redis_ct_alloc | ( | TALLOC_CTX * | ctx, |
| CONF_SECTION * | tls_cs, | ||
| fr_event_list_t * | el, | ||
| fr_redis_conf_t * | conf, | ||
| fr_redis_trunk_active_t | active, | ||
| void * | active_uctx, | ||
| bool | active_oneshot | ||
| ) |
Allocate per-thread, per-cluster instance.
This structure represents all the connections for a given thread for a given cluster. The structures holds the trunk connections to talk to each cluster member.
Definition at line 616 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| fr_event_list_t * fr_redis_ct_el | ( | fr_redis_ct_t * | rtcluster | ) |
| char const * fr_redis_ct_ipaddr | ( | fr_redis_ct_node_t const * | node | ) |
Return the ipaddr of a particular node.
| [in] | node | to get ip address from. |
Definition at line 369 of file cluster_async.c.
Here is the caller graph for this function:| int fr_redis_ct_map_bootstrap | ( | fr_redis_ct_t * | rtcluster, |
| fr_coord_worker_t * | cw, | ||
| fr_coord_pair_reg_t * | coord_pair_reg | ||
| ) |
Initiate bootstrapping of the cluster map.
To be used when a module first wants to fetch a cluster map
| rtcluster | Cluster to fetch map for |
| cw | Coord worker to launch request |
| coord_pair_reg | Coord pair registration |
Definition at line 1003 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int fr_redis_ct_map_fail | ( | fr_redis_ct_t * | rtcluster, |
| fr_pair_list_t const * | list | ||
| ) |
| fr_redis_async_rcode_t fr_redis_ct_map_get | ( | fr_redis_ct_t * | rtcluster, |
| fr_coord_worker_t * | cw, | ||
| fr_coord_pair_reg_t * | coord_pair_reg, | ||
| bool | force | ||
| ) |
Initiate updating of the cluster map.
To be used when a command returns MOVED
Definition at line 1064 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int fr_redis_ct_map_update | ( | fr_redis_ct_t * | rtcluster, |
| fr_pair_list_t const * | list | ||
| ) |
Update a Redis cluster map from a pair list returned from a coordinator.
| rtcluster | Cluster to update |
| list | pairs sent by a coordinator |
Definition at line 762 of file cluster_async.c.
Here is the call graph for this function:| fr_redis_ct_node_t const * fr_redis_ct_master | ( | fr_redis_ct_t * | rtcluster, |
| fr_redis_ct_key_slot_t const * | key_slot | ||
| ) |
Return the master node that would be used for a particular key slot.
| [in] | rtcluster | To resolve key slot in. |
| [in] | key_slot | to resolve to node. |
Definition at line 338 of file cluster_async.c.
Here is the caller graph for this function:| fr_redis_async_rcode_t fr_redis_ct_node_addr_by_role | ( | TALLOC_CTX * | ctx, |
| fr_redis_io_conf_t * | out[], | ||
| uint8_t * | count_out, | ||
| fr_redis_ct_t * | rtcluster, | ||
| bool | is_master, | ||
| bool | is_replica | ||
| ) |
Definition at line 1121 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| fr_redis_ct_node_t * fr_redis_ct_node_by_addr | ( | fr_redis_ct_t * | rtcluster, |
| fr_redis_io_conf_t * | addr | ||
| ) |
Definition at line 1111 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int fr_redis_ct_port | ( | uint16_t * | out, |
| fr_redis_ct_node_t const * | node | ||
| ) |
Return the port of a particular node.
| [out] | out | Port of the node. |
| [in] | node | to get ip address from. |
Definition at line 384 of file cluster_async.c.
Here is the caller graph for this function:| fr_redis_ct_node_t const * fr_redis_ct_replica | ( | fr_redis_ct_t * | rtcluster, |
| fr_redis_ct_key_slot_t const * | key_slot, | ||
| uint8_t | replica_num | ||
| ) |
Return the replica node that would be used for a particular key slot.
| [in] | rtcluster | To resolve key slot in. |
| [in] | key_slot | To resolve to node. |
| [in] | replica_num | 0..n. |
Definition at line 354 of file cluster_async.c.
Here is the caller graph for this function:| void fr_redis_ct_request_yield | ( | TALLOC_CTX * | ctx, |
| fr_redis_ct_t * | rtcluster, | ||
| request_t * | request | ||
| ) |
Add a request to the list of those waiting for the cluster map.
Definition at line 1181 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| fr_redis_ct_key_slot_t const * fr_redis_ct_slot_by_key | ( | fr_redis_ct_t * | rtcluster, |
| request_t * | request, | ||
| uint8_t const * | key, | ||
| size_t | key_len | ||
| ) |
Resolve key to key slot.
| [in] | rtcluster | to resolve the key slot in. |
| [in] | request | Current request (for debugging). |
| [in] | key | to resolve. |
| [in] | key_len | length of key. |
Definition at line 302 of file cluster_async.c.
Here is the call graph for this function:
Here is the caller graph for this function:| trunk_conf_t const * fr_redis_ct_trunk_conf | ( | fr_redis_ct_t * | thread | ) |
1.9.8