Commit b8e72979 authored by Philip Carns's avatar Philip Carns

tweak api and update margo-example-*

parent 680a0d91
...@@ -475,11 +475,14 @@ hg_return_t margo_destroy( ...@@ -475,11 +475,14 @@ hg_return_t margo_destroy(
* @param [in] in_struct input argument struct for RPC * @param [in] in_struct input argument struct for RPC
* @returns 0 on success, hg_return_t values on error * @returns 0 on success, hg_return_t values on error
*/ */
hg_return_t margo_forward( hg_return_t margo_forward_provider_id(
uint16_t provider_id, uint16_t provider_id,
hg_handle_t handle, hg_handle_t handle,
void *in_struct); void *in_struct);
#define margo_forward(__handle, __in_struct)\
margo_forward_provider_id(MARGO_DEFAULT_PROVIDER_ID, __handle, __in_struct)
/** /**
* Forward (without blocking) an RPC request to a remote host * Forward (without blocking) an RPC request to a remote host
* @param [in] provider ID (may be MARGO_DEFAULT_PROVIDER_ID) * @param [in] provider ID (may be MARGO_DEFAULT_PROVIDER_ID)
...@@ -488,12 +491,15 @@ hg_return_t margo_forward( ...@@ -488,12 +491,15 @@ hg_return_t margo_forward(
* @param [out] req request to wait on using margo_wait * @param [out] req request to wait on using margo_wait
* @returns 0 on success, hg_return_t values on error * @returns 0 on success, hg_return_t values on error
*/ */
hg_return_t margo_iforward( hg_return_t margo_iforward_provider_id(
uint16_t provider_id, uint16_t provider_id,
hg_handle_t handle, hg_handle_t handle,
void* in_struct, void* in_struct,
margo_request* req); margo_request* req);
#define margo_iforward(__handle, __in_struct, __req)\
margo_forward_provider_id(MARGO_DEFAULT_PROVIDER_ID, __handle, __in_struct, __req)
/** /**
* Wait for an operation initiated by a non-blocking * Wait for an operation initiated by a non-blocking
* margo function (margo_iforward, margo_irespond, etc.) * margo function (margo_iforward, margo_irespond, etc.)
...@@ -746,6 +752,13 @@ void margo_thread_sleep( ...@@ -746,6 +752,13 @@ void margo_thread_sleep(
*/ */
int margo_get_handler_pool(margo_instance_id mid, ABT_pool* pool); int margo_get_handler_pool(margo_instance_id mid, ABT_pool* pool);
/**
* Retrieve the rpc handler abt pool that is associated with this handle
* @param [in] h handle
* @return pool
*/
ABT_pool margo_hg_handle_get_handler_pool(hg_handle_t h);
/** /**
* Retrieve the Mercury context that was associated with this instance at * Retrieve the Mercury context that was associated with this instance at
* initialization time * initialization time
...@@ -771,6 +784,15 @@ hg_class_t* margo_get_class(margo_instance_id mid); ...@@ -771,6 +784,15 @@ hg_class_t* margo_get_class(margo_instance_id mid);
*/ */
margo_instance_id margo_hg_handle_get_instance(hg_handle_t h); margo_instance_id margo_hg_handle_get_instance(hg_handle_t h);
/**
* Get the margo_instance_id from an hg_info struct
*
* \param [in] info hg_info struct
*
* \return Margo instance
*/
margo_instance_id margo_hg_info_get_instance(const struct hg_info *info);
/** /**
* Enables diagnostic collection on specified Margo instance * Enables diagnostic collection on specified Margo instance
* *
......
...@@ -512,7 +512,7 @@ int margo_shutdown_remote_instance( ...@@ -512,7 +512,7 @@ int margo_shutdown_remote_instance(
mid->shutdown_rpc_id, &handle); mid->shutdown_rpc_id, &handle);
if(hret != HG_SUCCESS) return -1; if(hret != HG_SUCCESS) return -1;
hret = margo_forward(MARGO_DEFAULT_PROVIDER_ID, handle, NULL); hret = margo_forward(handle, NULL);
if(hret != HG_SUCCESS) if(hret != HG_SUCCESS)
{ {
margo_destroy(handle); margo_destroy(handle);
...@@ -759,20 +759,20 @@ static hg_return_t margo_cb(const struct hg_cb_info *info) ...@@ -759,20 +759,20 @@ static hg_return_t margo_cb(const struct hg_cb_info *info)
return(HG_SUCCESS); return(HG_SUCCESS);
} }
hg_return_t margo_forward( hg_return_t margo_forward_provider_id(
uint16_t provider_id, uint16_t provider_id,
hg_handle_t handle, hg_handle_t handle,
void *in_struct) void *in_struct)
{ {
hg_return_t hret; hg_return_t hret;
margo_request req; margo_request req;
hret = margo_iforward(provider_id, handle, in_struct, &req); hret = margo_iforward_provider_id(provider_id, handle, in_struct, &req);
if(hret != HG_SUCCESS) if(hret != HG_SUCCESS)
return hret; return hret;
return margo_wait(req); return margo_wait(req);
} }
hg_return_t margo_iforward( hg_return_t margo_iforward_provider_id(
uint16_t provider_id, uint16_t provider_id,
hg_handle_t handle, hg_handle_t handle,
void *in_struct, void *in_struct,
...@@ -1106,6 +1106,14 @@ ABT_pool margo_hg_handle_get_handler_pool(hg_handle_t h) ...@@ -1106,6 +1106,14 @@ ABT_pool margo_hg_handle_get_handler_pool(hg_handle_t h)
return pool; return pool;
} }
margo_instance_id margo_hg_info_get_instance(const struct hg_info *info)
{
struct margo_rpc_data* data =
(struct margo_rpc_data*) HG_Registered_data(info->hg_class, info->id);
if(!data) return MARGO_INSTANCE_NULL;
return data->mid;
}
margo_instance_id margo_hg_handle_get_instance(hg_handle_t h) margo_instance_id margo_hg_handle_get_instance(hg_handle_t h)
{ {
struct margo_rpc_data* data; struct margo_rpc_data* data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment