#include <stdio.h>
#include "motr/setup.h"
#include "reqh/reqh.h"
#include "cob/cob.h"
#include "net/net.h"
#include "net/buffer_pool.h"
#include "rpc/rpc.h"
Go to the source code of this file.
|
int | m0_rpc_server_start (struct m0_rpc_server_ctx *sctx) |
|
void | m0_rpc_server_stop (struct m0_rpc_server_ctx *sctx) |
|
M0_INTERNAL struct m0_rpc_machine * | m0_rpc_server_ctx_get_rmachine (struct m0_rpc_server_ctx *sctx) |
|
M0_INTERNAL int | m0_rpc_client_connect (struct m0_rpc_conn *conn, struct m0_rpc_session *session, struct m0_rpc_machine *rpc_mach, const char *remote_addr, struct m0_fid *svc_fid, uint64_t max_rpcs_in_flight, m0_time_t abs_timeout) |
|
M0_INTERNAL int | m0_rpc_client_find_connect (struct m0_rpc_conn *conn, struct m0_rpc_session *session, struct m0_rpc_machine *rpc_mach, const char *remote_addr, enum m0_conf_service_type stype, uint64_t max_rpcs_in_flight, m0_time_t abs_timeout) |
|
int | m0_rpc_client_start (struct m0_rpc_client_ctx *cctx) |
|
int | m0_rpc_client_stop (struct m0_rpc_client_ctx *cctx) |
|
int | m0_rpc_client_stop_stats (struct m0_rpc_client_ctx *cctx, void(*printout)(struct m0_rpc_machine *)) |
|
int | m0_rpc_post_sync (struct m0_fop *fop, struct m0_rpc_session *session, const struct m0_rpc_item_ops *ri_ops, m0_time_t deadline) |
|
int | m0_rpc_post_with_timeout_sync (struct m0_fop *fop, struct m0_rpc_session *session, const struct m0_rpc_item_ops *ri_ops, m0_time_t deadline, m0_time_t timeout) |
|
◆ __MOTR_RPC_RPCLIB_H__
#define __MOTR_RPC_RPCLIB_H__ |
◆ anonymous enum
◆ m0_rpc_client_connect()
Establishes RPC connection and creates a session.
Connection automatically handles HA notifications regarding state of service identified by service object, if provided. In case of service death being announced, all rpc items on the connection get cancelled letting connection close safe.
- Parameters
-
[out] | conn | |
[out] | session | |
[in] | rpc_mach | |
[in] | remote_addr | |
[in] | service | object, optional, can be NULL |
[in] | max_rpcs_in_flight | |
[in] | abs_timeout | |
Definition at line 102 of file rpclib.c.
◆ m0_rpc_client_find_connect()
A bit more intelligent version of m0_rpc_client_connect(). To be sure client connects to right service, client side provides service fid (optional, can be NULL) and service type along with the remote address. The call internally makes sure the provided address belongs to service of correct fid and type.
However even with service object not found, m0_rpc_client_connect() attempt is ultimately done anyway.
- Note
- confc contained by REQH, i.e. accessible by m0_reqh2confc(reqh), is used for service object look-up.
Definition at line 134 of file rpclib.c.
◆ m0_rpc_client_start()
Starts client's rpc machine.
Creates connection to server and establishes an rpc session on top of it. Created session object can be set in an rpc item and used in m0_rpc_post().
- Parameters
-
cctx | Initialised rpc context structure. |
Definition at line 160 of file rpclib.c.
◆ m0_rpc_client_stop()
Terminates RPC session and connection with server and finalises client's RPC machine.
- Parameters
-
cctx | Initialised rpc context structure. |
Definition at line 217 of file rpclib.c.
◆ m0_rpc_client_stop_stats()
◆ m0_rpc_post_sync()
Sends a fop (an RPC item, to be precise) and waits for reply.
By default, fop is resent after every second until reply is received. To change this behaviour set fop->f_item.ri_nr_sent_max and fop->f_item.ri_resend_interval. They are, maximum number of times fop is sent before failing and interval after which the fop is resent, respectively. Their default values are M0_RPCLIB_MAX_RETRIES and m0_time(1, 0).
To simply timeout fop after N seconds set fop->f_item.ri_nr_sent_max to N before calling m0_rpc_post_sync().
- Parameters
-
fop | Fop to send. Presumably, fop->f_item.ri_reply will hold the reply upon successful return. |
session | The session to be used for the client call. |
ri_ops | Pointer to RPC item ops structure. |
deadline | Absolute time after which formation should send the fop as soon as possible. deadline should be 0 if fop shouldn't wait in formation queue and should be sent immediately. |
Definition at line 284 of file rpclib.c.
◆ m0_rpc_post_with_timeout_sync()
◆ m0_rpc_server_ctx_get_rmachine()
◆ m0_rpc_server_start()
Starts server's rpc machine.
- Parameters
-
sctx | Initialized rpc context structure. |
Definition at line 50 of file rpclib.c.
◆ m0_rpc_server_stop()
Stops RPC server.
- Parameters
-
sctx | Initialized rpc context structure. |
Definition at line 85 of file rpclib.c.