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
ce832455
Verified
Commit
ce832455
authored
2 years ago
by
Alberto Miranda
Browse files
Options
Downloads
Patches
Plain Diff
Add ADM_qos_limit_list_t plus creation and destruction functions
parent
1a8d1d0e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!30
Resolve "Refactor library RPC implementation of `admire::transfer_dataset`"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/common/api/admire_types.h
+27
-0
27 additions, 0 deletions
src/common/api/admire_types.h
src/common/api/types.cpp
+69
-0
69 additions, 0 deletions
src/common/api/types.cpp
src/common/net/proto/rpc_types.h
+2
-2
2 additions, 2 deletions
src/common/net/proto/rpc_types.h
with
98 additions
and
2 deletions
src/common/api/admire_types.h
+
27
−
0
View file @
ce832455
...
...
@@ -91,6 +91,9 @@ typedef struct adm_dataset_info* ADM_dataset_info_t;
/** A list of datasets */
typedef
struct
adm_dataset_list
*
ADM_dataset_list_t
;
/** A list of QoS limits */
typedef
struct
adm_qos_limit_list
*
ADM_qos_limit_list_t
;
/* ----------------------------------------------------- */
/* Storage tiers */
...
...
@@ -497,6 +500,30 @@ ADM_qos_limit_create(ADM_qos_entity_t entity, ADM_qos_class_t cls,
ADM_return_t
ADM_qos_limit_destroy
(
ADM_qos_limit_t
limit
);
/**
* Create a list of QoS limits from an array of ADM_QOS_LIMITs and its
* length.
*
* @remark QoS limit lists need to be freed by calling
* ADM_qos_limit_list_destroy().
*
* @param[in] limits The array of QoS limits.
* @param[in] len The length of the array.
* @return A valid ADM_qos_limit_list_t if successful or NULL in case of
* failure.
*/
ADM_qos_limit_list_t
ADM_qos_limit_list_create
(
ADM_qos_limit_t
limits
[],
size_t
len
);
/**
* Destroy a QoS limit list created by ADM_qos_limit_list_create().
*
* @param[in] list A valid ADM_qos_limit_list_t
* @return ADM_SUCCESS or corresponding ADM error code
*/
ADM_return_t
ADM_qos_limit_list_destroy
(
ADM_qos_limit_list_t
list
);
/* ----------------------------------------------------- */
/* Data operations */
...
...
This diff is collapsed.
Click to expand it.
src/common/api/types.cpp
+
69
−
0
View file @
ce832455
...
...
@@ -743,6 +743,75 @@ ADM_transfer_destroy(ADM_transfer_t tx) {
return
ret
;
}
ADM_qos_limit_list_t
ADM_qos_limit_list_create
(
ADM_qos_limit_t
limits
[],
size_t
length
)
{
ADM_qos_limit_list_t
p
=
(
ADM_qos_limit_list_t
)
malloc
(
sizeof
(
*
p
));
if
(
!
p
)
{
LOGGER_ERROR
(
"Could not allocate ADM_qos_limit_list_t"
)
return
NULL
;
}
const
char
*
error_msg
=
NULL
;
p
->
l_length
=
length
;
p
->
l_limits
=
(
struct
adm_qos_limit
*
)
calloc
(
length
,
sizeof
(
adm_qos_limit
));
if
(
!
p
->
l_limits
)
{
error_msg
=
"Could not allocate ADM_qos_limit_list_t"
;
goto
cleanup_on_error
;
}
for
(
size_t
i
=
0
;
i
<
length
;
++
i
)
{
memcpy
(
&
p
->
l_limits
[
i
],
limits
[
i
],
sizeof
(
adm_qos_limit
));
}
return
p
;
cleanup_on_error
:
if
(
p
->
l_limits
)
{
free
(
p
->
l_limits
);
}
free
(
p
);
if
(
error_msg
)
{
LOGGER_ERROR
(
error_msg
);
}
return
NULL
;
}
ADM_return_t
ADM_qos_limit_list_destroy
(
ADM_qos_limit_list_t
list
)
{
ADM_return_t
ret
=
ADM_SUCCESS
;
if
(
!
list
)
{
LOGGER_ERROR
(
"Invalid ADM_qos_limit_list_t"
)
return
ADM_EBADARGS
;
}
// We cannot call ADM_qos_limit_destroy here because adm_limits
// are stored as a consecutive array in memory. Thus, we free
// the entities themselves and then the array.
if
(
list
->
l_limits
)
{
for
(
size_t
i
=
0
;
i
<
list
->
l_length
;
++
i
)
{
ADM_qos_entity_t
entity
=
list
->
l_limits
[
i
].
l_entity
;
if
(
entity
)
{
ADM_qos_entity_destroy
(
entity
);
}
}
free
(
list
->
l_limits
);
}
free
(
list
);
return
ret
;
}
/******************************************************************************/
/* C++ Type definitions and related functions */
/******************************************************************************/
...
...
This diff is collapsed.
Click to expand it.
src/common/net/proto/rpc_types.h
+
2
−
2
View file @
ce832455
...
...
@@ -88,11 +88,11 @@ struct adm_qos_entity {
// TODO: encoder/decoder
struct
adm_qos_limit
{
typedef
struct
adm_qos_limit
{
ADM_qos_entity_t
l_entity
;
ADM_qos_class_t
l_class
;
uint64_t
l_value
;
};
}
adm_qos_limit
;
// TODO: encoder/decoder
...
...
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