PadicoTM

Documentation

« back to PM2 home.
control-simple-selector.c
Go to the documentation of this file.
1/*
2 * Padico -- a High Performance Parallel and Distributed Computing Environment
3 * Copyright (c) 2002-2026 INRIA and the University of Rennes 1
4 * Alexandre DENIS <Alexandre.Denis@inria.fr>
5 * Christian PEREZ <Christian.Perez@inria.fr>
6 *
7 * The software has been registered at the Agency for the Protection of
8 * Programs (APP) under the number IDDN.FR.001.260013.000.S.P.2002.000.10000.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
30#include <Padico/Puk.h>
31#include <Padico/Module.h>
32#include <Padico/PadicoTM.h>
33#include <Padico/NetSelector.h>
34#include <Padico/PadicoControl.h>
35
36static int control_simpleselector_init(void);
37static void control_simpleselector_finalize(void);
38
40 "Topology", "NetSelector", "PadicoControl");
41
48
49static struct
50{
51 struct css_controler_hashtable_s table; /* hash: node -> controler instance */
53} cs_selector = { .selector = NULL };
54
55static void css_event_listener(void*arg);
56
58
59/* ********************************************************* */
60
68
69/* ********************************************************* */
70
72{
73 cs_selector.selector =
74 puk_component_declare("ControlSimpleSelector",
75 puk_component_provides("ControlSelector", "selector", &control_simpleselector_driver));
79 return 0;
80}
81
95
96/* ********************************************************* */
97/* *** ControlSimpleSelector ******************************* */
98
110
111/* ********************************************************* */
112
113static void css_event_listener(void*arg)
114{
116 switch(event->kind)
117 {
119 {
121 const puk_instance_t controler = event->INIT_CONTROLER.controler;
122 padico_out(40, "init node event- %zd nodes; controler=%s\n",
123 padico_topo_node_vect_size(nodes), controler->component->name);
126 {
127 const padico_topo_node_t node = *i;
129 padico_out(40, "init node event- new node *%s* served by %s\n",
130 padico_topo_node_getname(node), controler->component->name);
131 }
132 }
133 break;
134
136 {
137 const padico_topo_node_t node = event->NODE.node;
138 const puk_instance_t controler = event->NODE.controler;
141 {
142 padico_out(40, "node event- new node *%s* served by %s\n",
143 padico_topo_node_getname(node), controler->component->name);
145 }
146 }
147 break;
148
150 {
151 const padico_topo_node_t node = event->NODE.node;
153 {
155 }
156 }
157 break;
158
160 {
161 puk_instance_t controler = event->UNPLUG_CONTROLER.controler;
165 restart:
168 while(node)
169 {
170 if(node_controler == controler)
171 {
174 /* we have modified the hashtable, enumerator is not consistent anymore */
175 goto restart;
176 }
178 }
180 }
181 break;
182
183 default:
184 break;
185 }
186}
assert(slab_size > 0)
struct ns_rulebucket_hash_entry_s * e
return NULL
Definition Shm.h:88
static int done
Definition console-mod.c:49
padico_topo_node_vect_t nodes
puk_instance_t instance
the listening bootstrap instance
static void control_simpleselector_finalize(void)
static int control_simpleselector_init(void)
static puk_instance_t control_select_controler(padico_topo_node_t node)
struct css_controler_hashtable_s table
static void css_event_listener(void *arg)
static struct @19 cs_selector
puk_component_t selector
static const struct padico_control_selector_driver_s control_simpleselector_driver
'ControlSelector' facet for the ControlSimpleSelector component
static void padico_control_event_enable(void)
static void padico_control_event_disable(void)
static void padico_control_event_flush(void)
static void padico_control_event_unsubscribe(padico_event_listener_t l)
static void padico_control_event_subscribe(padico_event_listener_t l)
static void padico_control_unplug_selector(puk_component_t selector)
static void padico_control_plug_selector(puk_component_t selector)
void * arg
Definition PadicoTM.h:167
const char * padico_topo_node_getname(padico_topo_node_t node)
Get the canonical name of a node.
Definition topology.c:1917
typdef struct padico_topo_node_vect_s * padico_topo_node_vect_t
Definition Topology.h:84
padico_topo_node_t node
Definition na-control.c:65
struct padico_control_event_s::@47::@49 INIT_CONTROLER
puk_instance_t controler
@ PADICO_CONTROL_EVENT_INIT_CONTROLER
initial event sent to new controlers to get the past events and current topology state
@ PADICO_CONTROL_EVENT_UNPLUG_CONTROLER
a controler (PadicoControl) is unloaded
@ PADICO_CONTROL_EVENT_DELETE_NODE
a node was deleted/disconnected/became unreachable
@ PADICO_CONTROL_EVENT_NEW_NODE
a new node appeared in the known topology
padico_topo_node_vect_t nodes
Interface: "ControlSelector".
puk_instance_t(* router)(padico_topo_node_t node)
returns an instance with a PadicoControl facet
marcel_cond_t event
Definition tm-boot.c:65