Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scord
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eu
ADMIRE
scord
Commits
94f7b312
Verified
Commit
94f7b312
authored
2 years ago
by
Alberto Miranda
Browse files
Options
Downloads
Patches
Plain Diff
Refactor ADM_node_t type
parent
3efff1ed
No related branches found
No related tags found
1 merge request
!17
Resolve "Hide implementation of API types behind opaque types"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/admire.h
+21
-1
21 additions, 1 deletion
src/lib/admire.h
src/lib/c_wrapper.cpp
+46
-2
46 additions, 2 deletions
src/lib/c_wrapper.cpp
with
67 additions
and
3 deletions
src/lib/admire.h
+
21
−
1
View file @
94f7b312
...
...
@@ -78,7 +78,27 @@ ADM_return_t
ADM_server_destroy
(
ADM_server_t
server
);
/* A node */
typedef
char
*
ADM_node_t
;
typedef
struct
adm_node
*
ADM_node_t
;
/**
* Initialize a node from a user-provided hostname/address.
*
* @remark Nodes need to be freed by calling ADM_server_destroy().
*
* @param[in] hostname The hostname of the node.
* @return A valid ADM_server_t if successful or NULL in case of failure.
*/
ADM_node_t
ADM_node_create
(
const
char
*
hostname
);
/**
* Destroy a node created by ADM_node_create().
*
* @param[in] node A valid ADM_node_t
* @return ADM_SUCCESS or corresponding ADM error code
*/
ADM_return_t
ADM_node_destroy
(
ADM_node_t
node
);
/* A dataset handle */
...
...
This diff is collapsed.
Click to expand it.
src/lib/c_wrapper.cpp
+
46
−
2
View file @
94f7b312
...
...
@@ -27,19 +27,28 @@
#include
<logger/logger.hpp>
#include
"detail/impl.hpp"
/******************************************************************************/
/* Type definitions and related functions */
/******************************************************************************/
struct
adm_server
{
const
char
*
s_protocol
;
const
char
*
s_address
;
};
struct
adm_
job
{
uint64_t
j_id
;
struct
adm_
node
{
const
char
*
n_hostname
;
};
struct
adm_dataset
{
const
char
*
d_id
;
};
struct
adm_job
{
uint64_t
j_id
;
};
/** The I/O requirements for a job */
struct
adm_job_requirements
{
/** An array of input datasets */
...
...
@@ -84,6 +93,37 @@ ADM_server_destroy(ADM_server_t server) {
return
ret
;
}
ADM_node_t
ADM_node_create
(
const
char
*
hostname
)
{
struct
adm_node
*
adm_node
=
(
struct
adm_node
*
)
malloc
(
sizeof
(
struct
adm_node
));
if
(
!
adm_node
)
{
LOGGER_ERROR
(
"Could not allocate ADM_node_t"
)
return
NULL
;
}
adm_node
->
n_hostname
=
hostname
;
return
adm_node
;
}
ADM_return_t
ADM_node_destroy
(
ADM_node_t
node
)
{
ADM_return_t
ret
=
ADM_SUCCESS
;
if
(
!
node
)
{
LOGGER_ERROR
(
"Invalid ADM_node_t"
)
return
ADM_EBADARGS
;
}
free
(
node
);
return
ret
;
}
ADM_dataset_handle_t
ADM_dataset_create
(
const
char
*
id
)
{
...
...
@@ -173,6 +213,10 @@ ADM_job_create(uint64_t id) {
return
adm_job
;
}
/******************************************************************************/
/* C API implementation */
/******************************************************************************/
ADM_return_t
ADM_ping
(
ADM_server_t
server
)
{
const
admire
::
server
srv
{
server
->
s_protocol
,
server
->
s_address
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment