1
1

Checkpoint the registry. Now have several of the basic functions operating - can define segments, get index of dictionaries, etc - all the basic elements required to build get/put. Will continue tonight.

This commit was SVN r2169.
Этот коммит содержится в:
Ralph Castain 2004-08-16 21:36:50 +00:00
родитель c11d3896f0
Коммит 2db94bb016
9 изменённых файлов: 99 добавлений и 31 удалений

Просмотреть файл

@ -34,7 +34,6 @@ int mca_gpr_base_select(bool *allow_multi_user_threads,
/* Iterate through all the available components */
ompi_output(mca_gpr_base_output, "in gpr_base_select");
for (item = ompi_list_get_first(&mca_gpr_base_components_available);
item != ompi_list_get_end(&mca_gpr_base_components_available);
item = ompi_list_get_next(item)) {
@ -43,7 +42,6 @@ int mca_gpr_base_select(bool *allow_multi_user_threads,
/* Call the component's init function and see if it wants to be
selected */
ompi_output(mca_gpr_base_output, "checking component");
module = component->gpr_init(&multi, &hidden, &priority);
/* If we got a non-NULL module back, then the component wants to
@ -52,7 +50,6 @@ int mca_gpr_base_select(bool *allow_multi_user_threads,
if (NULL != module) {
/* If this is the best one, save it */
ompi_output(mca_gpr_base_output, "priority: %d", priority);
if (priority > best_priority) {
/* If there was a previous best one, finalize */
@ -62,7 +59,6 @@ int mca_gpr_base_select(bool *allow_multi_user_threads,
}
/* Save the new best one */
best_module = module;
best_component = component;
*allow_multi_user_threads = multi;

Просмотреть файл

@ -91,13 +91,13 @@ OBJ_CLASS_DECLARATION(ompi_registry_value_t);
/** Return value structure for index requests.
*/
struct ompi_registry_index_t {
struct ompi_registry_index_value_t {
ompi_list_item_t item; /**< Allows this item to be placed on a list */
char *token; /**< Pointer to the token string */
};
typedef struct ompi_registry_index_t ompi_registry_index_t;
typedef struct ompi_registry_index_value_t ompi_registry_index_value_t;
OBJ_CLASS_DECLARATION(ompi_registry_index_t);
OBJ_CLASS_DECLARATION(ompi_registry_index_value_t);
/*
* Component functions that MUST be provided
@ -107,11 +107,11 @@ typedef int (*mca_gpr_base_module_delete_segment_fn_t)(char *segment);
typedef int (*mca_gpr_base_module_put_fn_t)(ompi_registry_mode_t mode, char *segment,
char **tokens, ompi_registry_object_t *object,
ompi_registry_object_size_t size);
typedef ompi_registry_value_t* (*mca_gpr_base_module_get_fn_t)(ompi_registry_mode_t mode,
char *segment, char **tokens);
typedef ompi_list_t* (*mca_gpr_base_module_get_fn_t)(ompi_registry_mode_t mode,
char *segment, char **tokens);
typedef int (*mca_gpr_base_module_delete_fn_t)(ompi_registry_mode_t mode,
char *segment, char **tokens);
typedef ompi_registry_index_t* (*mca_gpr_base_module_index_fn_t)(char *segment);
typedef ompi_list_t* (*mca_gpr_base_module_index_fn_t)(char *segment);
typedef int (*mca_gpr_base_module_subscribe_fn_t)(ompi_process_name_t* subscriber,
ompi_registry_mode_t mode,
ompi_registry_notify_action_t action,
@ -132,6 +132,7 @@ struct mca_gpr_base_module_1_0_0_t {
mca_gpr_base_module_subscribe_fn_t subscribe;
mca_gpr_base_module_unsubscribe_fn_t unsubscribe;
mca_gpr_base_module_delete_fn_t delete_object;
mca_gpr_base_module_index_fn_t index;
};
typedef struct mca_gpr_base_module_1_0_0_t mca_gpr_base_module_1_0_0_t;
typedef mca_gpr_base_module_1_0_0_t mca_gpr_base_module_t;

Просмотреть файл

@ -45,9 +45,13 @@ int gpr_proxy_delete(ompi_registry_mode_t mode,
}
ompi_registry_index_t* gpr_proxy_index(char *segment)
ompi_list_t* gpr_proxy_index(char *segment)
{
return NULL;
ompi_list_t *answer;
answer = OBJ_NEW(ompi_list_t);
return answer;
}
@ -66,8 +70,12 @@ int gpr_proxy_unsubscribe(ompi_process_name_t *caller, ompi_registry_mode_t mode
}
ompi_registry_value_t* gpr_proxy_get(ompi_registry_mode_t mode, char *segment, char **tokens)
ompi_list_t* gpr_proxy_get(ompi_registry_mode_t mode, char *segment, char **tokens)
{
return NULL;
ompi_list_t *answer;
answer = OBJ_NEW(ompi_list_t);
return answer;
}

Просмотреть файл

@ -59,7 +59,7 @@ int gpr_proxy_delete(ompi_registry_mode_t mode,
/*
* Implementation of index()
*/
ompi_registry_index_t* gpr_proxy_index(char *segment);
ompi_list_t* gpr_proxy_index(char *segment);
/*
@ -78,8 +78,8 @@ int gpr_proxy_unsubscribe(ompi_process_name_t *caller, ompi_registry_mode_t mode
/*
* Implementation of get()
*/
ompi_registry_value_t* gpr_proxy_get(ompi_registry_mode_t mode,
char *segment, char **tokens);
ompi_list_t* gpr_proxy_get(ompi_registry_mode_t mode,
char *segment, char **tokens);
#endif

Просмотреть файл

@ -52,7 +52,8 @@ static mca_gpr_base_module_t mca_gpr_proxy = {
gpr_proxy_delete_segment,
gpr_proxy_subscribe,
gpr_proxy_unsubscribe,
gpr_proxy_delete
gpr_proxy_delete,
gpr_proxy_index
};
/*

Просмотреть файл

@ -175,13 +175,13 @@ int gpr_replica_put(ompi_registry_mode_t mode, char *segment,
ompi_registry_object_size_t size);
int gpr_replica_delete_object(ompi_registry_mode_t mode,
char *segment, char **tokens);
ompi_registry_index_t* gpr_replica_index(char *segment);
ompi_list_t* gpr_replica_index(char *segment);
int gpr_replica_subscribe(ompi_process_name_t *caller, ompi_registry_mode_t mode,
ompi_registry_notify_action_t action,
char *segment, char **tokens);
int gpr_replica_unsubscribe(ompi_process_name_t *caller, ompi_registry_mode_t mode,
char *segment, char **tokens);
ompi_registry_value_t* gpr_replica_get(ompi_registry_mode_t mode,
char *segment, char **tokens);
ompi_list_t* gpr_replica_get(ompi_registry_mode_t mode,
char *segment, char **tokens);
#endif

Просмотреть файл

@ -20,6 +20,7 @@
#include "mca/oob/base/base.h"
#include "mca/gpr/base/base.h"
#include "gpr_replica.h"
#include "gpr_replica_internals.h"
/*
@ -53,7 +54,8 @@ static mca_gpr_base_module_t mca_gpr_replica = {
gpr_replica_delete_segment,
gpr_replica_subscribe,
gpr_replica_unsubscribe,
gpr_replica_delete_object
gpr_replica_delete_object,
gpr_replica_index
};
/*
@ -91,7 +93,7 @@ OBJ_CLASS_INSTANCE(
mca_gpr_keytable_destructor); /* destructor */
/* constructor - used to initialize state of keytable instance */
/* constructor - used to initialize state of keylist instance */
static void mca_gpr_keylist_construct(mca_gpr_keylist_t* keylist)
{
keylist->key = 0;
@ -109,7 +111,29 @@ OBJ_CLASS_INSTANCE(
mca_gpr_keylist_construct, /* constructor */
mca_gpr_keylist_destructor); /* destructor */
/* constructor - used to initialize state of keytable instance */
/* constructor - used to initialize state of index_value instance */
static void mca_gpr_index_value_construct(ompi_registry_index_value_t* value)
{
value->token = NULL;
}
/* destructor - used to free any resources held by instance */
static void mca_gpr_index_value_destructor(ompi_registry_index_value_t* value)
{
if (value->token) {
free(value->token);
}
}
/* define instance of ompi_class_t */
OBJ_CLASS_INSTANCE(
ompi_registry_index_value_t, /* type name */
ompi_list_item_t, /* parent "class" name */
mca_gpr_index_value_construct, /* constructor */
mca_gpr_index_value_destructor); /* destructor */
/* constructor - used to initialize state of subscriber list instance */
static void mca_gpr_subscriber_list_construct(mca_gpr_subscriber_list_t* subscriber)
{
subscriber->subscriber = NULL;
@ -230,7 +254,8 @@ int mca_gpr_replica_close(void)
mca_gpr_base_module_t *mca_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority)
{
/* ompi_registry_segment_t *seg; */
mca_gpr_registry_segment_t *seg;
mca_gpr_replica_key_t key;
/* If we're the seed, then we want to be selected, so do all the
setup and return the module */
@ -259,15 +284,15 @@ mca_gpr_base_module_t *mca_gpr_replica_init(bool *allow_multi_user_threads, bool
mca_gpr_replica_head.lastkey = 0;
/* define the "universe" segment key */
/* if (0 == gpr_replica_definekey("universe", NULL)) {
ompi_output(0, "registry_init(error): could not create universe dictionary entry\n");
key = gpr_replica_define_key("universe", NULL);
if (MCA_GPR_REPLICA_KEY_MAX == key) {
ompi_output(mca_gpr_base_output, "registry_init(error): could not create universe dictionary entry\n");
exit(OMPI_ERROR);
}
*/
/* initialize the "universe" segment */
/* seg = OBJ_NEW(ompi_registry_segment_t);
seg->segment = gpr_replica_getkey("universe", NULL);
ompi_list_append(&mca_gpr_head.registry, &seg->item); */
seg = OBJ_NEW(mca_gpr_registry_segment_t);
seg->segment = gpr_replica_get_key("universe", NULL);
ompi_list_append(&mca_gpr_replica_head.registry, &seg->item);
/* Return the module */
@ -286,6 +311,7 @@ int mca_gpr_replica_finalize(void)
/* free all storage, but only if this component was initialized */
if (initialized) {
OBJ_DESTRUCT(&mca_gpr_replica_head);
initialized = false;
}

Просмотреть файл

@ -114,6 +114,33 @@ mca_gpr_replica_key_t gpr_replica_get_key(char *segment, char *token)
}
ompi_list_t *gpr_replica_get_key_list(char *segment, char **tokens)
{
ompi_list_t *keys;
char **token;
mca_gpr_keytable_t *keyptr, *dict_entry;
/* protect against errors */
if (NULL == segment || NULL == tokens) {
return NULL;
}
token = tokens;
keys = OBJ_NEW(ompi_list_t);
while (NULL != *token) { /* traverse array of tokens until NULL */
keyptr = OBJ_NEW(mca_gpr_keytable_t);
if (NULL == (dict_entry = gpr_replica_find_dict_entry(segment, *token))) {
keyptr->key = MCA_GPR_REPLICA_KEY_MAX; /* indicate unknown token */
} else { /* found existing dictionary entry */
keyptr->key = dict_entry->key;
keyptr->token = strdup(dict_entry->token);
}
ompi_list_append(keys, &keyptr->item);
token++;
}
return keys;
}
mca_gpr_replica_key_t gpr_replica_define_key(char *segment, char *token)
{
mca_gpr_registry_segment_t *seg;
@ -281,3 +308,8 @@ int gpr_replica_empty_segment(mca_gpr_registry_segment_t *seg)
return OMPI_SUCCESS;
}
bool gpr_replica_check_key_list(ompi_list_t *key_list, mca_gpr_replica_key_t key)
{
return true;
}

Просмотреть файл

@ -67,3 +67,7 @@ mca_gpr_registry_segment_t *gpr_replica_find_seg(char *segment);
mca_gpr_keytable_t *gpr_replica_find_dict_entry(char *segment, char *token);
int gpr_replica_empty_segment(mca_gpr_registry_segment_t *seg);
ompi_list_t *gpr_replica_get_key_list(char *segment, char **tokens);
bool gpr_replica_check_key_list(ompi_list_t *key_list, mca_gpr_replica_key_t key);