Motr  M0
Resource manager service (RMS)

RMS provides service management API for resource manager. RMS will be registered with Motr request handler and the service will provide interfaces to resource manager, like identification of owner, borrow or revoke requests &c. More...

Data Structures

struct  m0_reqh_rm_service
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_RM
 

Functions

static int rms_allocate (struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
 
static void rms_fini (struct m0_reqh_service *service)
 
static int rms_start (struct m0_reqh_service *service)
 
static void rms_stop (struct m0_reqh_service *service)
 
 M0_BOB_DEFINE (M0_INTERNAL, &rms_bob, m0_reqh_rm_service)
 
M0_INTERNAL int m0_rms_register (void)
 
M0_INTERNAL void m0_rms_unregister (void)
 
static void rms_resources_free (struct m0_rm_resource_type *rtype)
 
static struct m0_rm_ownerrmsvc_owner (const struct m0_rm_resource *res)
 
M0_INTERNAL int m0_rm_svc_owner_create (struct m0_reqh_service *service, struct m0_rm_owner **out, struct m0_buf *resbuf)
 
M0_INTERNAL struct m0_rm_domainm0_rm_svc_domain_get (const struct m0_reqh_service *svc)
 

Variables

static const struct m0_reqh_service_type_ops rms_type_ops
 
static const struct m0_reqh_service_ops rms_ops
 
struct m0_reqh_service_type m0_rms_type
 
static const struct m0_bob_type rms_bob
 
static const struct m0_fid_type owner_fid_type
 
struct m0_reqh_service_type m0_rms_type
 

Detailed Description

RMS provides service management API for resource manager. RMS will be registered with Motr request handler and the service will provide interfaces to resource manager, like identification of owner, borrow or revoke requests &c.

Data Structures

RMS will be represented by an instance of m0_reqh_rm_service, which will be a wrapper to contain m0_reqh_service. RMS will be registered during Motr server initialisation and request handler service specific routines will be provided. RMS has following components associated with it:

It will be simply assumed that the request handler that runs confd also runs resource manager service. Note that there will be multiple resource manager services running in the system, but we need one for boot-strapping to access confd. The locations of other resource manager services can be obtained from confd.

Subroutines

Following new API's are introduced:

Todo:
All the creditors for the resources reside inside RM service; i.e. RM service will be the creditor for all currently available resource types. When specific resource types are implemented, this can be changed.

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_RM

Definition at line 28 of file rm_service.c.

Function Documentation

◆ M0_BOB_DEFINE()

M0_BOB_DEFINE ( M0_INTERNAL  ,
rms_bob,
m0_reqh_rm_service   
)

◆ m0_rm_svc_domain_get()

M0_INTERNAL struct m0_rm_domain * m0_rm_svc_domain_get ( const struct m0_reqh_service svc)

Definition at line 307 of file rm_service.c.

Here is the caller graph for this function:

◆ m0_rm_svc_owner_create()

M0_INTERNAL int m0_rm_svc_owner_create ( struct m0_reqh_service service,
struct m0_rm_owner **  owner,
struct m0_buf resbuf 
)

Creates an owner for resource type description from resbuf. Adds the resource to the domain maintained by m0_reqh_rm_service.

Precondition
service != NULL
resbuf != NULL

Definition at line 224 of file rm_service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rms_register()

M0_INTERNAL int m0_rms_register ( void  )

Register resource manager service

Todo:
Contact confd and take list of resource types for this resource manager.

Definition at line 93 of file rm_service.c.

Here is the call graph for this function:

◆ m0_rms_unregister()

M0_INTERNAL void m0_rms_unregister ( void  )

Unregister resource manager service

Definition at line 109 of file rm_service.c.

Here is the call graph for this function:

◆ rms_allocate()

static int rms_allocate ( struct m0_reqh_service **  service,
const struct m0_reqh_service_type stype 
)
static

Definition at line 120 of file rm_service.c.

Here is the call graph for this function:

◆ rms_fini()

static void rms_fini ( struct m0_reqh_service service)
static

Definition at line 139 of file rm_service.c.

Here is the call graph for this function:

◆ rms_resources_free()

static void rms_resources_free ( struct m0_rm_resource_type rtype)
static

Definition at line 173 of file rm_service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rms_start()

static int rms_start ( struct m0_reqh_service service)
static

Register various resource types

Definition at line 153 of file rm_service.c.

Here is the call graph for this function:

◆ rms_stop()

static void rms_stop ( struct m0_reqh_service service)
static

Definition at line 198 of file rm_service.c.

Here is the call graph for this function:

◆ rmsvc_owner()

static struct m0_rm_owner* rmsvc_owner ( const struct m0_rm_resource res)
static

Definition at line 216 of file rm_service.c.

Here is the caller graph for this function:

Variable Documentation

◆ m0_rms_type [1/2]

struct m0_reqh_service_type m0_rms_type
Initial value:
= {
.rst_name = "M0_CST_RMS",
.rst_ops = &rms_type_ops,
.rst_level = M0_RM_SVC_LEVEL,
.rst_typecode = M0_CST_RMS,
}
static const struct m0_reqh_service_type_ops rms_type_ops
Definition: rm_service.c:55

Definition at line 69 of file rm_service.c.

◆ m0_rms_type [2/2]

struct m0_reqh_service_type m0_rms_type

Definition at line 69 of file rm_service.c.

◆ owner_fid_type

const struct m0_fid_type owner_fid_type
static
Initial value:
= {
.ft_id = 'O',
.ft_name = "rm owner fid"
}

Definition at line 85 of file rm_service.c.

◆ rms_bob

const struct m0_bob_type rms_bob
static
Initial value:
= {
.bt_name = "rm service",
.bt_magix_offset = offsetof(struct m0_reqh_rm_service, rms_magic),
.bt_magix = M0_RM_SERVICE_MAGIC,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 76 of file rm_service.c.

◆ rms_ops

const struct m0_reqh_service_ops rms_ops
static
Initial value:
= {
.rso_start = rms_start,
.rso_stop = rms_stop,
.rso_fini = rms_fini,
}
static int rms_start(struct m0_reqh_service *service)
Definition: rm_service.c:153
int m0_reqh_service_async_start_simple(struct m0_reqh_service_start_async_ctx *asc)
Definition: reqh_service.c:601
static void rms_stop(struct m0_reqh_service *service)
Definition: rm_service.c:198
static void rms_fini(struct m0_reqh_service *service)
Definition: rm_service.c:139

RM Service operations.

Definition at line 62 of file rm_service.c.

◆ rms_type_ops

const struct m0_reqh_service_type_ops rms_type_ops
static
Initial value:
= {
.rsto_service_allocate = rms_allocate
}
static int rms_allocate(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
Definition: rm_service.c:120

RM Service type operations.

Definition at line 55 of file rm_service.c.