PadicoTM

Documentation

« back to PM2 home.

Padico control channel. More...

#include <Padico/Puk.h>
#include <Padico/Module.h>
#include <Padico/PadicoTM.h>
#include <Padico/Topology.h>
#include "PadicoControl-internals.h"
Include dependency graph for na-control.c:

Go to the source code of this file.

Data Structures

struct  padico_control_msg_s
 A control message. More...
 
struct  na_controler_hash_entry_s
 stores an entry in the hashtable More...
 
struct  na_controler_hash_entry_block_lfstack_cell_s
 
struct  na_controler_hash_entry_block_lfstack_s
 
struct  na_controler_hash_entry_slice_lfstack_cell_s
 
struct  na_controler_hash_entry_slice_lfstack_s
 
struct  na_controler_hash_entry_allocator_s
 
struct  na_controler_hashtable_s
 
struct  na_controler_hashtable_enumerator_s
 

Typedefs

typedef uint32_t(* na_controler_hash_hfunc_t) (puk_instance_t key)
 
typedef int(* na_controler_hash_eqfunc_t) (puk_instance_t key1, puk_instance_t key2)
 
typedef void(* na_controler_hash_destructor_t) (puk_instance_t key, padico_topo_node_vect_t data)
 
typedef struct na_controler_hash_entry_block_lfstack_s na_controler_hash_entry_block_lfstack_t
 
typedef struct na_controler_hash_entry_slice_lfstack_s na_controler_hash_entry_slice_lfstack_t
 
typedef struct na_controler_hash_entry_allocator_s * na_controler_hash_entry_allocator_t
 
typedef struct na_controler_hashtable_s * na_controler_hashtable_t
 
typedef struct na_controler_hashtable_enumerator_s * na_controler_hashtable_enumerator_t
 

Functions

static int padico_control_init (void)
 
static void padico_control_finalize (void)
 
static void padico_module_create_initializer__PadicoControl (void)
 
static void padico_module_attr_initializer__selector (void)
 
static void padico_module_attr_finalizer__selector (void)
 
static void padico_module_attr_selector_setvalue (puk_opt_type_string_t v) __attribute__((unused))
 
static puk_opt_type_string_t padico_module_attr_selector_getvalue (void)
 
static void na_control_controlers_destructor (puk_instance_t instance, padico_topo_node_vect_t peers)
 
struct na_controler_hash_entry_block_lfstack_cell_s __attribute__ ((aligned(16)))
 
 __attribute__ ((unused))
 lookup in the oldtable; if found, migrate row and return cell in regular table
 
 __attribute__ ((unused, nonnull))
 initialize a new hashtable
 
static struct na_controler_hash_entry_s * na_controler_hash_entry_lookup (na_controler_hashtable_t h, const puk_instance_t key)
 
static void na_controler_hash_entry_insert (na_controler_hashtable_t h, puk_instance_t key, padico_topo_node_vect_t data)
 
static int na_controler_hash_entry_oldprobe (na_controler_hashtable_t h, const puk_instance_t key)
 
static void na_controler_hash_entry_rehash_row (na_controler_hashtable_t h, ssize_t z)
 
static void na_controler_hash_entry_rehash_n (na_controler_hashtable_t h, ssize_t n)
 
static void na_controler_hash_entry_rehash_flush (na_controler_hashtable_t h)
 
 __attribute__ ((unused, nonnull(1)))
 insert an entry into a hashtable
 
static void na_control_event_listener (void *arg)
 
static void na_control_ping_handler (puk_parse_entity_t e)
 
static void na_control_rc_handler (puk_parse_entity_t e)
 
static void na_control_request_handler (puk_parse_entity_t e)
 
padico_control_msg_t padico_control_msg_new (void)
 create a new empty control message
 
void padico_control_msg_destroy (padico_control_msg_t msg)
 destroy a control message
 
void padico_control_msg_add_part (padico_control_msg_t msg, const void *text, size_t len)
 add an attached binary part to a control message
 
int padico_control_msg_get_iovec_size (padico_control_msg_t msg)
 get the number of iovec entries in the control message
 
const struct iovec * padico_control_msg_get_iovec (padico_control_msg_t msg)
 get an iovec from the control message content; caller takes ownership of iovec and must free it
 
size_t padico_control_msg_get_size (padico_control_msg_t msg)
 get the total number of bytes in the control message
 
struct iovec padico_control_msg_get_bytes (padico_control_msg_t msg)
 get a (contiguous) copy of the content of the control message; caller takes ownership of the copy
 
padico_string_t padico_control_msg_get_cmd (padico_control_msg_t msg)
 
int padico_control_send_msg (padico_topo_node_t node, padico_control_msg_t msg)
 the real function to send a message on control channel- most of the time, we use a wraper, however.
 
void padico_control_send_ext (padico_topo_node_t node, const char *cmd, uint32_t req_id)
 
static void na_control_notify (padico_topo_node_t node, uint32_t req_id, padico_rc_t rc)
 
void padico_control_deliver_message (puk_instance_t controler, padico_topo_node_t from, char *cmd, size_t size)
 Deliver an incoming control message from an component to PadicoControl.
 
padico_tasklet_t padico_control_get_event_channel (void)
 
void padico_control_gen_init_events (padico_event_listener_t l)
 Generates initial events for new subscribers to get the current state.
 

Variables

struct puk_mod_binary_s padico_mod_binary__PadicoControl = { .name = "PadicoControl", .funcs = &padico_mod_funcs__PadicoControl , .mod = NULL, .profile = { .total_mem = 0, .max_mem = 0, .num_malloc = 0, .num_free = 0 } , .auto_deps = & puk_mod_dep_PadicoControl , .n_deps = sizeof((char*[]){ 0, "Topology" }) / sizeof(char*), .deps = { NULL, "Topology" } }
 
static const struct puk_mod_funcs_s padico_mod_funcs__PadicoControl = { .init = ( padico_control_init ), .run = ( NULL ), .finalize = ( padico_control_finalize ) }
 
static struct puk_opt_s padico_module_opt_selector = { .label = "selector", .env_var = ( "PADICO_CONTROL_SELECTOR" ), .desc = ( "selector to use for PadicoControl; default = ControlSimpleSelector" ), .type = puk_opt_type_string , .value = (union puk_opt_value_u){ .as_string = ( "ControlSimpleSelector" ) }, .flags = ( 0 ) }
 
typdef struct padico_string_vect_s * padico_string_vect_t
 
 padico_pending_req
 
padico_topo_node_t node
 
padico_req_id_t req_id
 
struct na_controler_hash_entry_block_lfstack_cell_s * _next
 
struct na_controler_hash_entry_block_lfstack_s __attribute__
 
struct na_controler_hash_entry_block_lfstack_cell_s block []
 
struct { 
 
   padico_topo_network_t   network 
 the control channel as a network More...
 
   padico_tasklet_t   event_channel 
 tasklet used as event channel for control event More...
 
   struct na_controler_hashtable_s   controlers 
 key: puk_instance_t; value : padico_topo_node_vect_t More...
 
   puk_component_t   selector 
 selector for the control channel More...
 
   struct padico_pending_req_list_s   pending_reqs 
 pending requests sent to a remote node More...
 
   volatile int   shutdown 
 
} na_control = { .shutdown = 0} 
 

Detailed Description

Padico control channel.

Definition in file na-control.c.

Typedef Documentation

◆ na_controler_hash_destructor_t

typedef void(* na_controler_hash_destructor_t) (puk_instance_t key, padico_topo_node_vect_t data)

Definition at line 75 of file na-control.c.

◆ na_controler_hash_entry_allocator_t

◆ na_controler_hash_entry_block_lfstack_t

◆ na_controler_hash_entry_slice_lfstack_t

◆ na_controler_hash_eqfunc_t

typedef int(* na_controler_hash_eqfunc_t) (puk_instance_t key1, puk_instance_t key2)

Definition at line 75 of file na-control.c.

◆ na_controler_hash_hfunc_t

typedef uint32_t(* na_controler_hash_hfunc_t) (puk_instance_t key)

Definition at line 75 of file na-control.c.

◆ na_controler_hashtable_enumerator_t

◆ na_controler_hashtable_t

Function Documentation

◆ __attribute__() [1/4]

◆ __attribute__() [2/4]

__attribute__ ( (unused)  )

lookup in the oldtable; if found, migrate row and return cell in regular table

get the seq part of a tagged ptr

pop key & data of any element in the table

remove entry with given key from hashtable; does nothing if key not found

allocate a new hashtable

trigger progressive rehashing

flush all rows of a pending rehash

lookup an entry in the hashtable

insert an entry in the given table, without rehashing

make progress on rehash for n rows

force rehashing of given row

Definition at line 75 of file na-control.c.

◆ __attribute__() [3/4]

__attribute__ ( (unused, nonnull(1))  )

insert an entry into a hashtable

returns <key,value> associated with given key, outkey is set to NULL if key not found

probes whether an entry with given key exists in the hashtable

returns value associated with key, NULL if not found

Definition at line 75 of file na-control.c.

◆ __attribute__() [4/4]

__attribute__ ( (unused, nonnull)  )

initialize a new hashtable

deallocate a hashtable

destroy a hashtable

Definition at line 75 of file na-control.c.

◆ na_control_controlers_destructor()

static void na_control_controlers_destructor ( puk_instance_t  instance,
padico_topo_node_vect_t  peers 
)
static

Definition at line 69 of file na-control.c.

References done.

◆ na_control_event_listener()

◆ na_control_notify()

static void na_control_notify ( padico_topo_node_t  node,
uint32_t  req_id,
padico_rc_t  rc 
)
static

◆ na_control_ping_handler()

static void na_control_ping_handler ( puk_parse_entity_t  e)
static

◆ na_control_rc_handler()

static void na_control_rc_handler ( puk_parse_entity_t  e)
static

Definition at line 481 of file na-control.c.

References done, e, na_control, NULL, padico_pending_req, padico_tm_req_notify(), rc, and req_id.

Referenced by padico_control_init().

◆ na_control_request_handler()

static void na_control_request_handler ( puk_parse_entity_t  e)
static

◆ na_controler_hash_entry_insert()

static void na_controler_hash_entry_insert ( na_controler_hashtable_t  h,
puk_instance_t  key,
padico_topo_node_vect_t  data 
)
inlinestatic

◆ na_controler_hash_entry_lookup()

static struct na_controler_hash_entry_s * na_controler_hash_entry_lookup ( na_controler_hashtable_t  h,
const puk_instance_t  key 
)
inlinestatic

◆ na_controler_hash_entry_oldprobe()

static int na_controler_hash_entry_oldprobe ( na_controler_hashtable_t  h,
const puk_instance_t  key 
)
inlinestatic

◆ na_controler_hash_entry_rehash_flush()

static void na_controler_hash_entry_rehash_flush ( na_controler_hashtable_t  h)
inlinestatic

◆ na_controler_hash_entry_rehash_n()

static void na_controler_hash_entry_rehash_n ( na_controler_hashtable_t  h,
ssize_t  n 
)
inlinestatic

◆ na_controler_hash_entry_rehash_row()

static void na_controler_hash_entry_rehash_row ( na_controler_hashtable_t  h,
ssize_t  z 
)
inlinestatic

◆ padico_control_finalize()

◆ padico_control_init()

◆ padico_module_attr_finalizer__selector()

static void padico_module_attr_finalizer__selector ( void  )
static

Definition at line 44 of file na-control.c.

◆ padico_module_attr_initializer__selector()

static void padico_module_attr_initializer__selector ( void  )
static

Definition at line 44 of file na-control.c.

◆ padico_module_attr_selector_getvalue()

static puk_opt_type_string_t padico_module_attr_selector_getvalue ( void  )
inlinestatic

Definition at line 44 of file na-control.c.

Referenced by padico_control_send_msg().

◆ padico_module_attr_selector_setvalue()

static void padico_module_attr_selector_setvalue ( puk_opt_type_string_t  v)
inlinestatic

Definition at line 44 of file na-control.c.

◆ padico_module_create_initializer__PadicoControl()

static void padico_module_create_initializer__PadicoControl ( void  )
static

Definition at line 41 of file na-control.c.

Variable Documentation

◆ __attribute__

◆ _next

◆ block

◆ controlers

key: puk_instance_t; value : padico_topo_node_vect_t

Definition at line 81 of file na-control.c.

◆ event_channel

padico_tasklet_t event_channel

tasklet used as event channel for control event

Definition at line 80 of file na-control.c.

◆ [struct]

◆ network

the control channel as a network

Definition at line 79 of file na-control.c.

◆ node

Definition at line 65 of file na-control.c.

Referenced by answer_cmd(), cascade_delete_end_handler(), control_bootstrap_event_listener(), control_router_broadcast(), control_router_disappeared(), control_router_event_listener(), control_router_table_print(), control_select_controler(), control_twostep_new_node(), control_twostep_select_controler(), control_twostep_selector_event_listener(), css_event_listener(), defgroup_end_handler(), disappear_end_handler(), na_control_event_listener(), na_control_notify(), na_control_ping_handler(), ns_basic_debug_init(), ns_basic_node_start_handler(), ns_besteffort_getnetworks(), ns_node_in_entity(), nsdb_create_node(), padico_addrdb_dynget(), padico_addrdb_get(), padico_addrdb_insert(), padico_addrdb_publish(), padico_addrkey_new(), padico_control_delete_node(), padico_control_new_node(), padico_control_send(), padico_control_send_async(), padico_control_send_ext(), padico_control_send_msg(), padico_control_send_oneway(), padico_gatekeeper__CreateGroup(), padico_gatekeeper__GetNodeInfo(), padico_gatekeeper__GetNodeInfo(), padico_getaddrinfo(), padico_group_barrier(), padico_group_kill(), padico_group_node_add(), padico_group_rank(), padico_group_send_to_all(), padico_na_topology_serialize(), padico_psp_connect(), padico_psp_listen(), padico_psp_new_message(), padico_shm_directory_dump(), padico_shm_directory_node_lookup(), padico_shm_directory_register_self(), padico_shm_directory_unregister_self(), padico_shm_seg_init(), padico_topo_getnodebyname(), padico_topo_network_contains_node(), padico_topo_node_bind(), padico_topo_node_disconnect(), padico_topo_node_getaddress(), padico_topo_node_gethost(), padico_topo_node_getname(), padico_topo_node_getnetworks(), padico_topo_node_getsession(), padico_topo_node_getuuid(), padico_topo_node_serialize(), padico_topo_session_getnodebyrank(), padico_topo_session_getrank(), padico_topology_finalize(), psp_control_event_listener(), psp_control_getstream(), psp_control_new_message(), psp_ibv_new_message(), psp_sf_connect(), psp_sf_new_message(), psp_shm_new_message(), remote_control_del_node(), remote_control_event_listener(), remote_control_new_node(), remote_control_node_send(), router_announce_end_handler(), router_message_end_handler(), router_new_node(), router_update_end_handler(), secondary_connector_connect(), ssh2_control_send_common(), sysio_control_send_common(), topo_binding_bind_node(), topo_node_create(), topo_node_destroy(), topo_node_end_handler(), topo_node_start_handler(), vlink_control_resolve(), vlink_packet_new_message(), vlink_resolver_resolve_node(), vopw_control_event_listener(), vopw_dynres_reverse_lookup(), and vsock_madio_sendto().

◆ padico_mod_binary__PadicoControl

struct puk_mod_binary_s padico_mod_binary__PadicoControl = { .name = "PadicoControl", .funcs = &padico_mod_funcs__PadicoControl , .mod = NULL, .profile = { .total_mem = 0, .max_mem = 0, .num_malloc = 0, .num_free = 0 } , .auto_deps = & puk_mod_dep_PadicoControl , .n_deps = sizeof((char*[]){ 0, "Topology" }) / sizeof(char*), .deps = { NULL, "Topology" } }

Definition at line 41 of file na-control.c.

◆ padico_mod_funcs__PadicoControl

const struct puk_mod_funcs_s padico_mod_funcs__PadicoControl = { .init = ( padico_control_init ), .run = ( NULL ), .finalize = ( padico_control_finalize ) }
static

Definition at line 41 of file na-control.c.

◆ padico_module_opt_selector

struct puk_opt_s padico_module_opt_selector = { .label = "selector", .env_var = ( "PADICO_CONTROL_SELECTOR" ), .desc = ( "selector to use for PadicoControl; default = ControlSimpleSelector" ), .type = puk_opt_type_string , .value = (union puk_opt_value_u){ .as_string = ( "ControlSimpleSelector" ) }, .flags = ( 0 ) }
static

Definition at line 44 of file na-control.c.

◆ padico_pending_req

padico_pending_req

Definition at line 64 of file na-control.c.

Referenced by na_control_rc_handler().

◆ padico_string_vect_t

typdef struct padico_string_vect_s* padico_string_vect_t

Definition at line 49 of file na-control.c.

◆ pending_reqs

pending requests sent to a remote node

Definition at line 83 of file na-control.c.

◆ req_id

◆ selector

puk_component_t selector

selector for the control channel

Definition at line 82 of file na-control.c.

Referenced by na_control_event_listener(), and padico_control_send_msg().

◆ shutdown