1
1

Extend the dstore framework to include a new "update_handle" API so the attributes of an existing handle can be changed. We can't just open a new handle as the upper layers won't know where to find the info. :-(

Этот коммит содержится в:
Ralph Castain 2014-10-10 12:40:32 -07:00
родитель 1ae34da5e5
Коммит 4d27eb70f2
5 изменённых файлов: 36 добавлений и 0 удалений

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

@ -80,6 +80,7 @@ typedef struct {
OBJ_CLASS_DECLARATION(opal_dstore_proc_data_t); OBJ_CLASS_DECLARATION(opal_dstore_proc_data_t);
OPAL_DECLSPEC int opal_dstore_base_open(const char *name, opal_list_t *attrs); OPAL_DECLSPEC int opal_dstore_base_open(const char *name, opal_list_t *attrs);
OPAL_DECLSPEC int opal_dstore_base_update(int dstorehandle, opal_list_t *attrs);
OPAL_DECLSPEC int opal_dstore_base_close(int dstorehandle); OPAL_DECLSPEC int opal_dstore_base_close(int dstorehandle);
OPAL_DECLSPEC int opal_dstore_base_store(int dstorehandle, OPAL_DECLSPEC int opal_dstore_base_store(int dstorehandle,
const opal_identifier_t *id, const opal_identifier_t *id,

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

@ -31,6 +31,7 @@
opal_dstore_base_API_t opal_dstore = { opal_dstore_base_API_t opal_dstore = {
opal_dstore_base_open, opal_dstore_base_open,
opal_dstore_base_update,
opal_dstore_base_close, opal_dstore_base_close,
opal_dstore_base_store, opal_dstore_base_store,
opal_dstore_base_fetch, opal_dstore_base_fetch,

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

@ -49,6 +49,25 @@ int opal_dstore_base_open(const char *name, opal_list_t *attrs)
return OPAL_ERROR; return OPAL_ERROR;
} }
int opal_dstore_base_update(int dstorehandle, opal_list_t *attrs)
{
int rc;
if (dstorehandle < 0) {
return OPAL_ERR_NOT_INITIALIZED;
}
if (NULL == opal_dstore_base.storage_component->update_handle) {
return OPAL_SUCCESS;
}
if (OPAL_SUCCESS != (rc = opal_dstore_base.storage_component->update_handle(dstorehandle, attrs))) {
OPAL_ERROR_LOG(rc);
}
return rc;
}
int opal_dstore_base_close(int dstorehandle) int opal_dstore_base_close(int dstorehandle)
{ {
opal_dstore_handle_t *hdl; opal_dstore_handle_t *hdl;

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

@ -66,6 +66,15 @@ OPAL_DECLSPEC extern int opal_dstore_nonpeer;
typedef int (*opal_dstore_base_API_open_fn_t)(const char *name, typedef int (*opal_dstore_base_API_open_fn_t)(const char *name,
opal_list_t *attributes); opal_list_t *attributes);
/*
* Update an existing handle
*
* Sometimes an existing handle requires an update to its attributes, so
* provide an API for doing so
*/
typedef int (*opal_dstore_base_API_update_fn_t)(int dstorehandle,
opal_list_t *attributes);
/* /*
* Close a database handle * Close a database handle
* *
@ -110,6 +119,7 @@ typedef int (*opal_dstore_base_API_remove_fn_t)(int dstorehandle,
*/ */
typedef struct { typedef struct {
opal_dstore_base_API_open_fn_t open; opal_dstore_base_API_open_fn_t open;
opal_dstore_base_API_update_fn_t update;
opal_dstore_base_API_close_fn_t close; opal_dstore_base_API_close_fn_t close;
opal_dstore_base_API_store_fn_t store; opal_dstore_base_API_store_fn_t store;
opal_dstore_base_API_fetch_fn_t fetch; opal_dstore_base_API_fetch_fn_t fetch;
@ -174,6 +184,9 @@ typedef struct {
/* create and return a datastore module */ /* create and return a datastore module */
typedef opal_dstore_base_module_t* (*mca_dstore_base_component_create_hdl_fn_t)(opal_list_t *attributes); typedef opal_dstore_base_module_t* (*mca_dstore_base_component_create_hdl_fn_t)(opal_list_t *attributes);
/* update an existing handle */
typedef int (*mca_dstore_base_component_update_hdl_fn_t)(int hdl, opal_list_t *attributes);
/* provide a chance for the component to finalize */ /* provide a chance for the component to finalize */
typedef void (*mca_dstore_base_component_finalize_fn_t)(void); typedef void (*mca_dstore_base_component_finalize_fn_t)(void);
@ -181,6 +194,7 @@ typedef struct {
mca_base_component_t base_version; mca_base_component_t base_version;
mca_base_component_data_t base_data; mca_base_component_data_t base_data;
mca_dstore_base_component_create_hdl_fn_t create_handle; mca_dstore_base_component_create_hdl_fn_t create_handle;
mca_dstore_base_component_update_hdl_fn_t update_handle;
mca_dstore_base_component_finalize_fn_t finalize; mca_dstore_base_component_finalize_fn_t finalize;
} opal_dstore_base_component_t; } opal_dstore_base_component_t;

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

@ -53,6 +53,7 @@ opal_dstore_base_component_t mca_dstore_hash_component = {
MCA_BASE_METADATA_PARAM_CHECKPOINT MCA_BASE_METADATA_PARAM_CHECKPOINT
}, },
component_create, component_create,
NULL,
NULL NULL
}; };