Skip to content

Commit

Permalink
reapi: add shrink function to C API
Browse files Browse the repository at this point in the history
  • Loading branch information
milroy committed Jan 15, 2025
1 parent 478cbd3 commit 701dfbe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions resource/reapi/bindings/c/reapi_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ extern "C" int reapi_cli_grow (reapi_cli_ctx_t *ctx, const char *R_subgraph)
return reapi_cli_t::grow (ctx->rqt, R_subgraph);
}

extern "C" int reapi_cli_shrink (reapi_cli_ctx_t *ctx, const char *subgraph_path)
{
if (!ctx || !ctx->rqt || !subgraph_path) {
errno = EINVAL;
return -1;
}
return reapi_cli_t::shrink (ctx->rqt, subgraph_path);
}

extern "C" int reapi_cli_cancel (reapi_cli_ctx_t *ctx, const uint64_t jobid, bool noent_ok)
{
if (!ctx || !ctx->rqt) {
Expand Down
13 changes: 13 additions & 0 deletions resource/reapi/bindings/c/reapi_cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,19 @@ int reapi_cli_update_allocate (reapi_cli_ctx_t *ctx,
*/
int reapi_cli_grow (reapi_cli_ctx_t *ctx, const char *R_subgraph);

/*! Shrink the resource graph with a path.
*
* \param h Opaque handle. How it is used is an implementation
* detail. However, when it is used within a Flux's
* service module, it is expected to be a pointer
* to a flux_t object.
* \param subgraph_path String representing the path from the cluster root
* to the root of the subgraph to be removed from
* the resource graph
* \return 0 on success; -1 on error.
*/
int reapi_cli_shrink (reapi_cli_ctx_t *ctx, const char *subgraph_path);

/*! Cancel the allocation or reservation corresponding to jobid.
*
* \param ctx reapi_cli_ctx_t context object
Expand Down

0 comments on commit 701dfbe

Please sign in to comment.