-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from mochi-hpc/carns/dev-bedrock-service-query
[WIP] bedrock service query update
- Loading branch information
Showing
8 changed files
with
121 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "bedrock-c-wrapper.h" | ||
#include <bedrock/Client.hpp> | ||
#include <bedrock/ServiceHandle.hpp> | ||
|
||
struct bedrock_client { | ||
bedrock::Client inner; | ||
}; | ||
|
||
struct bedrock_service { | ||
bedrock::ServiceHandle inner; | ||
}; | ||
|
||
extern "C" int bedrock_client_init(margo_instance_id mid, | ||
bedrock_client_t* client) | ||
{ | ||
*client = new bedrock_client{bedrock::Client{mid}}; | ||
return BEDROCK_SUCCESS; | ||
} | ||
|
||
extern "C" int bedrock_client_finalize(bedrock_client_t client) | ||
{ | ||
delete client; | ||
return BEDROCK_SUCCESS; | ||
} | ||
|
||
extern "C" int bedrock_service_handle_create(bedrock_client_t client, | ||
const char* address, | ||
uint16_t provider_id, | ||
bedrock_service_t* sh) | ||
{ | ||
*sh = new bedrock_service{ | ||
client->inner.makeServiceHandle(address, provider_id)}; | ||
return BEDROCK_SUCCESS; | ||
} | ||
|
||
extern "C" int bedrock_service_handle_destroy(bedrock_service_t sh) | ||
{ | ||
delete sh; | ||
return BEDROCK_SUCCESS; | ||
} | ||
|
||
extern "C" char* bedrock_service_query_config(bedrock_service_t sh, | ||
const char* script) | ||
{ | ||
std::string config; | ||
sh->inner.queryConfig(script, &config); | ||
return strdup(config.c_str()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef BEDROCK_C_WRAPPER | ||
#define BEDROCK_C_WRAPPER | ||
|
||
#include <margo.h> | ||
#include <stdint.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define BEDROCK_SUCCESS 0 | ||
|
||
typedef struct bedrock_client* bedrock_client_t; | ||
typedef struct bedrock_service* bedrock_service_t; | ||
|
||
int bedrock_client_init(margo_instance_id mid, bedrock_client_t* client); | ||
|
||
int bedrock_client_finalize(bedrock_client_t client); | ||
|
||
int bedrock_service_handle_create(bedrock_client_t, | ||
const char* address, | ||
uint16_t provider_id, | ||
bedrock_service_t* sh); | ||
|
||
int bedrock_service_handle_destroy(bedrock_service_t sh); | ||
|
||
char* bedrock_service_query_config(bedrock_service_t sh, const char* script); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters