-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc/man3: add flux_rpc(3), flux_rpc_the(3), etc.
Code examples are built as check_PROGRAMS and run as part of sharness t/t0002-request.t
- Loading branch information
Showing
9 changed files
with
497 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
flux_rpc(3) | ||
=========== | ||
:doctype: manpage | ||
|
||
|
||
NAME | ||
---- | ||
flux_rpc, flux_rpc_get, flux_rpc_destroy - perform a remote procedure call to a Flux service | ||
|
||
|
||
SYNOPSIS | ||
-------- | ||
#include <flux/core.h> | ||
|
||
flux_rpc_t *flux_rpc (flux_t h, const char *topic, const char *json_str, | ||
uint32_t nodeid, int flags); | ||
void flux_rpc_destroy (flux_rpc_t *rpc); | ||
int flux_rpc_get (flux_rpc_t *rpc, uint32_t *nodeid, const char **json_str); | ||
DESCRIPTION | ||
----------- | ||
`flux_rpc()` constructs a request for the Flux service identified by | ||
_topic_, with optional payload _json_str_, that will routed be according | ||
to _nodeid_. The request message is assigned a matchtag from the handle | ||
matchtag pool, and is then sent to the broker via handle _h_. | ||
A flux_rpc_t object is returned to the caller, used to complete the RPC. | ||
_nodeid_ affects how the broker will route the request, and may be set | ||
to one of the following values: | ||
FLUX_NODEID_ANY:: | ||
Route to first available matching service instance. | ||
FLUX_NODEID_UPSTREAM:: | ||
Route upstream via the tree based overlay network, then to first available | ||
matching service instance, skipping any instance on the sending rank. | ||
integer:: | ||
Route to a specific broker rank. | ||
If _json_str_ is non-NULL, it must represent valid serialized JSON, | ||
and will be attached as request payload. | ||
Flags may be zero or a mask of the following values: | ||
FLUX_RPC_NORESPONSE:: | ||
No response is expected, and the request will not be assigned a matchtag. | ||
The flux_rpc_t may be immediately destroyed. | ||
`flux_rpc_get()` obtains the result of the RPC, blocking until the response | ||
is received. If non-NULL, _nodeid_ is set to the _nodeid_ argument given | ||
to `flux_rpc()` -- primarily useful with `flux_rpc_multi(3)`. Similarly, | ||
_json_str_, if non-NULL, is set the response payload. The storage associated | ||
with _json_str_ belongs to the flux_rpc_t object. It is a protocol error | ||
if _json_str_ is NULL and the response has an unexpected payload, or if | ||
_json_str_ is non-NULL and the payload is missing. | ||
`flux_rpc_destroy()` destroys a completed `flux_rpc_t`, invalidating | ||
any payload returned by `flux_rpc_get()`, and freeing matchtags. | ||
CANCELLATION | ||
------------ | ||
Flux RFC 6 does not currently specify a cancellation protocol for an | ||
individual RPC, but does stipulate that an RPC may be canceled if a disconnect | ||
message is received, as is automatically generated by the local connector | ||
upon client disconnection. | ||
If `flux_rpc_destroy()` is called before a response is received, a | ||
matchtag value from the handle _h_'s matchtag pool is leaked. | ||
If enough matchtags are leaked, it will be impossible to make RPC calls | ||
on that handle. | ||
RETURN VALUE | ||
------------ | ||
`flux_rpc()` returns a flux_rpc_t object on success. On error, NULL | ||
is returned, and errno is set appropriately. | ||
`flux_rpc_get()` returns zero on success. On error, -1 is returned, | ||
and errno is set appropriately. | ||
ERRORS | ||
------ | ||
ENOSYS:: | ||
Handle has no send operation. | ||
EINVAL:: | ||
Some arguments were invalid. | ||
EPROTO:: | ||
A protocol error was encountered. | ||
EXAMPLES | ||
-------- | ||
This example performs a synchronous RPC with the broker's "cmb.info" service | ||
and extracts the broker's rank. | ||
.... | ||
include::trpc.c[] | ||
.... | ||
AUTHOR | ||
------ | ||
This page is maintained by the Flux community. | ||
RESOURCES | ||
--------- | ||
Github: <http://github.com/flux-framework> | ||
COPYRIGHT | ||
--------- | ||
include::COPYRIGHT.adoc[] | ||
SEE ALSO | ||
--------- | ||
flux_rpc_then(3), flux_rpc_multi(3) | ||
https://github.com/flux-framework/rfc/blob/master/spec_6.adoc[RFC 6: Flux | ||
Remote Procedure Call Protocol] |
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,116 @@ | ||
flux_rpc_multi(3) | ||
================= | ||
:doctype: manpage | ||
|
||
|
||
NAME | ||
---- | ||
flux_rpc_multi, flux_rpc_completed, - send a remote procedure call to a Flux service on multiple ranks | ||
|
||
|
||
SYNOPSIS | ||
-------- | ||
#include <flux/core.h> | ||
|
||
flux_rpc_t *flux_rpc_multi (flux_t h, const char *topic, const char *json_str, | ||
const char *nodeset, int flags); | ||
bool flux_rpc_completed (flux_rpc_t *rpc); | ||
DESCRIPTION | ||
----------- | ||
`flux_rpc_multi()` sends requests to a Flux service identified by _topic_ | ||
via Flux broker handle _h_. The _nodeset_ represents a set of ranks | ||
that will receive the request, and is specified in bracketed range format, | ||
e.g. "[0-255]", "[1,3,5-10]", or "all" for all ranks in the session. | ||
If _json_str_ is non-NULL, it should represent a valid JSON string | ||
that will be attached as request payload. | ||
Flags may be zero or a mask of the following values: | ||
FLUX_RPC_NORESPONSE:: | ||
No response will be expected to the request, and the request will not be | ||
assigned a matchtag. | ||
`flux_rpc_get(3)` may be used, as with `flux_rpc(3)`, to process responses. | ||
Each call to `flux_rpc_get(3)` invalidates any payload obtained via a | ||
previous call. | ||
`flux_rpc_check(3)` may be used, as with `flux_rpc(3)`, to determine | ||
whether `flux_rpc_get(3)` will block. | ||
`flux_rpc_completed()` returns true once all the RPC responses have been | ||
received and handled via `flux_rpc_get()`. It can be used to terminate | ||
synchronous response collection, e.g. | ||
.... | ||
while (!flux_rpc_completed (rpc)) | ||
flux_rpc_get (rpc, &nodeid, &payload); | ||
.... | ||
`flux_rpc_then(3)` may be used, as with `flux_rpc(3)`, to register a | ||
reactor callback to handle each RPC responses message. | ||
`flux_rpc_destroy(3)` should be used to dispose of the flux_rpc_t object | ||
once the RPC has completed. After this function is called, any payload | ||
returned by `flux_rpc_get()` is invalidated. | ||
RETURN VALUE | ||
------------ | ||
`flux_rpc_multi()` returns a flux_rpc_t object on success. On error, NULL | ||
is returned, and errno is set appropriately. | ||
`flux_rpc_completed()` returns true if the RPC has completed, else false. | ||
It does not report any errors. | ||
ERRORS | ||
------ | ||
ENOSYS:: | ||
Handle has no send operation. | ||
EINVAL:: | ||
Some arguments were invalid. | ||
EPROTO:: | ||
A protocol error was encountered. | ||
EXAMPLE | ||
------- | ||
This example performs an RPC with the broker's "cmb.info" service on all | ||
ranks. A continuation is registered to process the responses as they arrive. | ||
The reactor loop terminates once the RPC is completed since the completion | ||
is its only event handler. | ||
.... | ||
include::trpc_then_multi.c[] | ||
.... | ||
AUTHOR | ||
------ | ||
This page is maintained by the Flux community. | ||
RESOURCES | ||
--------- | ||
Github: <http://github.com/flux-framework> | ||
COPYRIGHT | ||
--------- | ||
include::COPYRIGHT.adoc[] | ||
SEE ALSO | ||
--------- | ||
flux_rpc(3), flux_rpc_then(3) | ||
https://github.com/flux-framework/rfc/blob/master/spec_6.adoc[RFC 6: Flux | ||
Remote Procedure Call Protocol] |
Oops, something went wrong.