Node Subsystem
[Bio-SPHERE Daemon]

Collaboration diagram for Node Subsystem:


Data Structures

struct  node_address
struct  node_info

Functions

bs_status init_node (apr_pool_t *mp)
bs_status add_node (const char *address, bs_uint16 port)
bs_status remove_node (const char *address, bs_uint16 port)
node_infoget_servicing_node (const bs_service_request *def)
bs_uint32 ping_node (const char *address, bs_uint16 port, apr_pool_t *mp)

Function Documentation

bs_status add_node ( const char *  address,
bs_uint16  port 
)

Add a node to the list of known nodes. This function will use the global memory pool since the node info has to be allocated from a pool that is persistent (unlike the temporal pools of threads).

Parameters:
address Address (IP or hostname) of the node
port Port on which the node is listening
mp Memory pool to use for temporal things (such as setting up a connection)
Returns:
Status code.

Definition at line 90 of file node.c.

References node_info::address, node_address::address, BS_ERROR, BS_OK, connect_and_get(), FALSE, global_mp, node_info::last_seen, list_append(), list_index(), list_insert(), list_size(), lock_node_mux(), lock_pool_mux(), node_already_known(), nodes, node_info::ping, ping_node(), node_address::port, runtestsuite::rv, node_info::services, TRUE, unlock_node_mux(), and unlock_pool_mux().

Referenced by add_node_to_global_list().

Here is the call graph for this function:

node_info* get_servicing_node ( const bs_service_request def  ) 

Returns a node info structure of the first node that can service the given request.

Parameters:
req The request to match with nodes services
Returns:
Node_info structure or NULL if nothing could be found.

Definition at line 180 of file node.c.

References list_index(), list_size(), lock_node_mux(), nodes, request_corresponds_with_definition(), and unlock_node_mux().

Referenced by handle_service_request_remotely().

Here is the call graph for this function:

bs_status init_node ( apr_pool_t *  mp  ) 

Initialize the node subsystem by making a new list.

Parameters:
mp Memory pool to use
Returns:
Status code.

Definition at line 57 of file node.c.

References BS_OK, new_list(), and nodes.

Referenced by main().

Here is the call graph for this function:

bs_uint32 ping_node ( const char *  address,
bs_uint16  port,
apr_pool_t *  mp 
)

Try to connect to a given node and measure how long this takes.

Parameters:
address Address of the node
port Port on which it is listening
Returns:
Time it took to connect or 0xffffffff if the node was unreachable.

Definition at line 156 of file node.c.

References runtestsuite::rv.

Referenced by add_node(), and main().

bs_status remove_node ( const char *  address,
bs_uint16  port 
)

Remove a node from the list of known nodes.

Parameters:
address Address (IP or hostname) of the node
port Port on which the node is listening
Returns:
Status code.

Definition at line 138 of file node.c.

References node_address::address, BS_OK, list_index(), list_remove(), list_size(), lock_node_mux(), nodes, node_address::port, streq(), and unlock_node_mux().

Here is the call graph for this function:


Generated on Tue Jul 17 09:51:30 2007 for Bio-SPHERE by  doxygen 1.5.1