Motr  M0
reqh_service.c File Reference
#include "lib/trace.h"
#include "lib/errno.h"
#include "lib/finject.h"
#include "lib/locality.h"
#include "lib/lockers.h"
#include "lib/memory.h"
#include "lib/misc.h"
#include "lib/rwlock.h"
#include "lib/string.h"
#include "lib/time.h"
#include "fop/fom.h"
#include "rpc/conn.h"
#include "rpc/rpc_machine_internal.h"
#include "rpc/rpclib.h"
#include "reqh/reqh.h"
#include "reqh/reqh_service.h"
#include "reqh/reqh_service_internal.h"
#include "rpc/rpc.h"
#include "rpc/rpc_machine.h"
#include "motr/magic.h"
#include "conf/obj_ops.h"
#include "conf/helpers.h"
#include "pool/pool.h"
#include "fid/fid.h"
#include "module/instance.h"
#include "conf/ha.h"
Include dependency graph for reqh_service.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_RPC
 

Enumerations

enum  { M0_REQH_SVC_RPC_SERVICE_TYPE, REQH_SVC_CONNECT_TIMEOUT = 1 }
 

Functions

 M0_TL_DESCR_DECLARE (abandoned_svc_ctxs, M0_EXTERN)
 
 M0_TL_DECLARE (abandoned_svc_ctxs, M0_EXTERN, struct m0_reqh_service_ctx)
 
 M0_TL_DESCR_DEFINE (rstypes, "reqh service types", static, struct m0_reqh_service_type, rst_linkage, rst_magix, M0_REQH_SVC_TYPE_MAGIC, M0_REQH_SVC_HEAD_MAGIC)
 
 M0_TL_DEFINE (rstypes, static, struct m0_reqh_service_type)
 
 M0_BOB_DEFINE (static, &rstypes_bob, m0_reqh_service_type)
 
 M0_BOB_DEFINE (static, &reqh_svc_ctx, m0_reqh_service_ctx)
 
static void reqh_service_ctx_destroy_if_abandoned (struct m0_reqh_service_ctx *ctx)
 
M0_INTERNAL bool m0_reqh_service_invariant (const struct m0_reqh_service *svc)
 
M0_INTERNAL struct m0_reqh_service_typem0_reqh_service_type_find (const char *sname)
 
M0_INTERNAL int m0_reqh_service_allocate (struct m0_reqh_service **out, const struct m0_reqh_service_type *stype, struct m0_reqh_context *rctx)
 
static void reqh_service_ha_event (struct m0_reqh_service *service, enum m0_reqh_service_state state)
 
static void reqh_service_state_set (struct m0_reqh_service *service, enum m0_reqh_service_state state)
 
static void reqh_service_starting_common (struct m0_reqh *reqh, struct m0_reqh_service *service, unsigned key)
 
static void reqh_service_failed_common (struct m0_reqh *reqh, struct m0_reqh_service *service, unsigned key)
 
M0_INTERNAL int m0_reqh_service_start_async (struct m0_reqh_service_start_async_ctx *asc)
 
static void reqh_service_started_common (struct m0_reqh *reqh, struct m0_reqh_service *service)
 
M0_INTERNAL void m0_reqh_service_started (struct m0_reqh_service *service)
 
M0_INTERNAL void m0_reqh_service_failed (struct m0_reqh_service *service)
 
M0_INTERNAL int m0_reqh_service_start (struct m0_reqh_service *service)
 
M0_INTERNAL void m0_reqh_service_prepare_to_stop (struct m0_reqh_service *service)
 
M0_INTERNAL void m0_reqh_service_stop (struct m0_reqh_service *service)
 
M0_INTERNAL void m0_reqh_service_init (struct m0_reqh_service *service, struct m0_reqh *reqh, const struct m0_fid *fid)
 
M0_INTERNAL void m0_reqh_service_fini (struct m0_reqh_service *service)
 
int m0_reqh_service_type_register (struct m0_reqh_service_type *rstype)
 
void m0_reqh_service_type_unregister (struct m0_reqh_service_type *rstype)
 
M0_INTERNAL int m0_reqh_service_types_length (void)
 
M0_INTERNAL void m0_reqh_service_list_print (void)
 
M0_INTERNAL bool m0_reqh_service_is_registered (const char *sname)
 
M0_INTERNAL int m0_reqh_service_types_init (void)
 
M0_INTERNAL void m0_reqh_service_types_fini (void)
 
M0_INTERNAL struct m0_reqh_servicem0_reqh_service_find (const struct m0_reqh_service_type *st, const struct m0_reqh *reqh)
 
M0_INTERNAL struct m0_reqh_servicem0_reqh_service_lookup (const struct m0_reqh *reqh, const struct m0_fid *fid)
 
M0_INTERNAL int m0_reqh_service_state_get (const struct m0_reqh_service *s)
 
M0_INTERNAL int m0_reqh_service_setup (struct m0_reqh_service **out, struct m0_reqh_service_type *stype, struct m0_reqh *reqh, struct m0_reqh_context *rctx, const struct m0_fid *fid)
 
M0_INTERNAL void m0_reqh_service_quit (struct m0_reqh_service *svc)
 
int m0_reqh_service_async_start_simple (struct m0_reqh_service_start_async_ctx *asc)
 
static bool service_type_is_valid (enum m0_conf_service_type t)
 
static bool reqh_service_context_invariant (const struct m0_reqh_service_ctx *ctx)
 
M0_INTERNAL void m0_reqh_service_ctx_subscribe (struct m0_reqh_service_ctx *ctx)
 
M0_INTERNAL void m0_reqh_service_ctx_unsubscribe (struct m0_reqh_service_ctx *ctx)
 
static void reqh_service_connect_locked (struct m0_reqh_service_ctx *ctx, m0_time_t deadline)
 
M0_INTERNAL void m0_reqh_service_connect (struct m0_reqh_service_ctx *ctx)
 
M0_INTERNAL bool m0_reqh_service_ctx_is_connected (const struct m0_reqh_service_ctx *ctx)
 
static void reqh_service_disconnect_locked (struct m0_reqh_service_ctx *ctx)
 
M0_INTERNAL void m0_reqh_service_disconnect (struct m0_reqh_service_ctx *ctx)
 
static int reqh_service_ctx_state_wait (struct m0_reqh_service_ctx *ctx, int state)
 
M0_INTERNAL void m0_reqh_service_connect_wait (struct m0_reqh_service_ctx *ctx)
 
M0_INTERNAL int m0_reqh_service_disconnect_wait (struct m0_reqh_service_ctx *ctx)
 
static void reqh_service_reconnect_locked (struct m0_reqh_service_ctx *ctx, const char *addr)
 
M0_INTERNAL void m0_reqh_service_cancel_reconnect (struct m0_reqh_service_ctx *ctx)
 
static void reqh_service_session_cancel (struct m0_reqh_service_ctx *ctx)
 
static bool reqh_service_ctx_is_cancelled (struct m0_reqh_service_ctx *ctx)
 
M0_INTERNAL void m0_reqh_service_ctxs_shutdown_prepare (struct m0_reqh *reqh)
 
M0_INTERNAL void m0_reqh_service_ctx_fini (struct m0_reqh_service_ctx *ctx)
 
static void reqh_service_ctx_ast_cb (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static bool reqh_service_ctx_rlink_cb (struct m0_clink *clink)
 
static bool process_event_handler (struct m0_clink *clink)
 
static bool service_event_handler (struct m0_clink *clink)
 
M0_INTERNAL int m0_reqh_service_ctx_init (struct m0_reqh_service_ctx *ctx, struct m0_conf_obj *svc_obj, enum m0_conf_service_type stype, struct m0_rpc_machine *rmach, const char *addr, uint32_t max_rpc_nr_in_flight)
 
M0_INTERNAL int m0_reqh_service_ctx_create (struct m0_conf_obj *svc_obj, enum m0_conf_service_type stype, struct m0_rpc_machine *rmach, const char *addr, uint32_t max_rpc_nr_in_flight, struct m0_reqh_service_ctx **out)
 
M0_INTERNAL void m0_reqh_service_ctx_destroy (struct m0_reqh_service_ctx *ctx)
 
M0_INTERNAL struct m0_reqh_service_ctxm0_reqh_service_ctx_from_session (struct m0_rpc_session *session)
 
static void abandoned_ctx_destroy_cb (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 

Variables

static struct m0_tl rstypes
 
static struct m0_rwlock rstypes_rwlock
 
static struct m0_bob_type rstypes_bob
 
static const struct m0_bob_type reqh_svc_ctx
 
static struct m0_sm_state_descr service_states []
 
const struct m0_sm_conf service_states_conf
 
static struct m0_sm_state_descr service_ctx_states []
 
static const struct m0_sm_conf service_ctx_states_conf
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_RPC

Definition at line 23 of file reqh_service.c.