Motr  M0
source_dock_fom.c File Reference
#include "lib/trace.h"
#include "lib/memory.h"
#include "rpc/rpc_opcodes.h"
#include "fop/fom_generic.h"
#include "fdmi/fdmi.h"
#include "fdmi/source_dock.h"
#include "fdmi/source_dock_internal.h"
#include "fdmi/fops.h"
#include "fdmi/fol_fdmi_src.h"
Include dependency graph for source_dock_fom.c:

Go to the source code of this file.

Data Structures

struct  fdmi_pending_fop
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_FDMI
 

Enumerations

enum  fdmi_src_dock_fom_phase { FDMI_SRC_DOCK_FOM_PHASE_INIT = M0_FOM_PHASE_INIT, FDMI_SRC_DOCK_FOM_PHASE_FINI = M0_FOM_PHASE_FINISH, FDMI_SRC_DOCK_FOM_PHASE_WAIT = M0_FOM_PHASE_NR, FDMI_SRC_DOCK_FOM_PHASE_GET_REC }
 
enum  fdmi_src_dock_timer_fom_phase { FDMI_SRC_DOCK_TIMER_FOM_PHASE_INIT = M0_FOM_PHASE_INIT, FDMI_SRC_DOCK_TIMER_FOM_PHASE_FINI = M0_FOM_PHASE_FINISH, FDMI_SRC_DOCK_TIMER_FOM_PHASE_WAIT = M0_FOM_PHASE_NR, FDMI_SRC_DOCK_TIMER_FOM_PHASE_ALARMED }
 
enum  fdmi_rr_fom_phase { FDMI_RR_FOM_PHASE_INIT = M0_FOM_PHASE_INIT, FDMI_RR_FOM_PHASE_FINI = M0_FOM_PHASE_FINISH, FDMI_RR_FOM_PHASE_RELEASE_RECORD = M0_FOM_PHASE_NR }
 
enum  { FDMI_RPC_MAX_RETRIES = 60 }
 
enum  { FDMI_SRC_DOCK_MAX_CHECKPOINT_TIME = 60 }
 

Functions

static void fdmi_sd_fom_fini (struct m0_fom *fom)
 
static int fdmi_sd_fom_tick (struct m0_fom *fom)
 
static size_t fdmi_sd_fom_locality (const struct m0_fom *fom)
 
static int sd_fom_send_record (struct fdmi_sd_fom *sd_fom, struct m0_fop *fop, const char *ep)
 
static int fdmi_filter_calc (struct fdmi_sd_fom *sd_fom, struct m0_fdmi_src_rec *src_rec, struct m0_conf_fdmi_filter *fdmi_filter)
 
static int fdmi_rr_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static void fdmi_rr_fom_fini (struct m0_fom *fom)
 
static int fdmi_rr_fom_tick (struct m0_fom *fom)
 
static void fdmi_rec_notif_replied (struct m0_rpc_item *item)
 
 M0_TL_DESCR_DEFINE (pending_fops, "pending fops list", M0_INTERNAL, struct fdmi_pending_fop, fti_linkage, fti_magic, M0_FDMI_SRC_DOCK_PENDING_FOP_MAGIC, M0_FDMI_SRC_DOCK_PENDING_FOP_HEAD_MAGIC)
 
 M0_TL_DEFINE (pending_fops, static, struct fdmi_pending_fop)
 
 M0_TL_DESCR_DECLARE (fdmi_record_inflight, M0_EXTERN)
 
 M0_TL_DECLARE (fdmi_record_inflight, M0_EXTERN, struct m0_fdmi_src_rec)
 
static void fdmi_sd_timer_fom_fini (struct m0_fom *fom)
 
static int fdmi_sd_timer_fom_tick (struct m0_fom *fom)
 
M0_INTERNAL void m0_fdmi__src_dock_fom_init (void)
 
M0_INTERNAL int m0_fdmi__src_dock_fom_start (struct m0_fdmi_src_dock *src_dock, const struct m0_filterc_ops *filterc_ops, struct m0_reqh *reqh)
 
static void wakeup_iff_waiting (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
M0_INTERNAL void m0_fdmi__src_dock_fom_wakeup (struct fdmi_sd_fom *sd_fom)
 
static void fdmi__src_dock_timer_fom_wakeup (struct fdmi_sd_timer_fom *timer_fom)
 
M0_INTERNAL void m0_fdmi__src_dock_fom_stop (struct m0_fdmi_src_dock *src_dock)
 
static int apply_filters (struct fdmi_sd_fom *sd_fom, struct m0_fdmi_src_rec *src_rec)
 
static int process_fdmi_rec (struct fdmi_sd_fom *sd_fom, struct m0_fdmi_src_rec *src_rec)
 
static int fdmi_post_fop (struct m0_fop *fop, struct m0_rpc_session *session)
 
static bool pending_fop_clink_cb (struct m0_clink *clink)
 
static int sd_fom_save_pending_fop (struct fdmi_sd_fom *sd_fom, struct m0_fop *fop, struct m0_rpc_session *session)
 
static int filters_nr (struct m0_fdmi_src_rec *src_rec, const char *endpoint)
 
static struct m0_rpc_machinem0_fdmi__sd_conn_pool_rpc_machine (void)
 
static struct m0_fopalloc_fdmi_rec_fop (int filter_num)
 
static struct m0_fopfop_create (struct m0_fdmi_src_rec *src_rec, const char *endpoint)
 
static int payload_encode (struct m0_fdmi_src_rec *src_rec, struct m0_fop *fop)
 
static int sd_fom_process_matched_filters (struct m0_fdmi_src_dock *sd_ctx, struct m0_fdmi_src_rec *src_rec)
 
static int node_eval (void *data, struct m0_fdmi_flt_var_node *value_desc, struct m0_fdmi_flt_operand *value)
 
static void fdmi_sd_fom_check (struct fdmi_sd_fom *sd_fom)
 

Variables

static const struct m0_rpc_item_ops fdmi_rec_not_item_ops
 
static struct m0_sm_state_descr fdmi_src_dock_state_descr []
 
static struct m0_sm_conf fdmi_src_dock_fom_sm_conf
 
static const struct m0_fom_ops fdmi_sd_fom_ops
 
static const struct m0_fom_type_ops fdmi_sd_fom_type_ops
 
static struct m0_fom_type fdmi_sd_fom_type
 
static struct m0_sm_state_descr fdmi_src_dock_timer_fom_state_descr []
 
static struct m0_sm_conf fdmi_src_dock_timer_fom_sm_conf
 
static const struct m0_fom_ops fdmi_sd_timer_fom_ops
 
static const struct m0_fom_type_ops fdmi_sd_timer_fom_type_ops
 
static struct m0_fom_type fdmi_sd_timer_fom_type
 
static struct m0_sm_state_descr fdmi_rr_fom_state_descr []
 
const struct m0_sm_conf fdmi_rr_fom_sm_conf
 
const struct m0_fom_type_ops fdmi_rr_fom_type_ops
 
const struct m0_fom_ops fdmi_rr_fom_ops
 
static struct m0_fdmi_sd_filter_type_handler fdmi_filter_type_handlers []
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_FDMI

Definition at line 23 of file source_dock_fom.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FDMI_RPC_MAX_RETRIES 

Definition at line 513 of file source_dock_fom.c.

◆ anonymous enum

anonymous enum
Enumerator
FDMI_SRC_DOCK_MAX_CHECKPOINT_TIME 

Definition at line 536 of file source_dock_fom.c.

◆ fdmi_rr_fom_phase

Enumerator
FDMI_RR_FOM_PHASE_INIT 
FDMI_RR_FOM_PHASE_FINI 
FDMI_RR_FOM_PHASE_RELEASE_RECORD 

Definition at line 201 of file source_dock_fom.c.

◆ fdmi_src_dock_fom_phase

Enumerator
FDMI_SRC_DOCK_FOM_PHASE_INIT 
FDMI_SRC_DOCK_FOM_PHASE_FINI 
FDMI_SRC_DOCK_FOM_PHASE_WAIT 
FDMI_SRC_DOCK_FOM_PHASE_GET_REC 

Definition at line 83 of file source_dock_fom.c.

◆ fdmi_src_dock_timer_fom_phase

Enumerator
FDMI_SRC_DOCK_TIMER_FOM_PHASE_INIT 
FDMI_SRC_DOCK_TIMER_FOM_PHASE_FINI 
FDMI_SRC_DOCK_TIMER_FOM_PHASE_WAIT 
FDMI_SRC_DOCK_TIMER_FOM_PHASE_ALARMED 

Definition at line 142 of file source_dock_fom.c.

Function Documentation

◆ alloc_fdmi_rec_fop()

static struct m0_fop* alloc_fdmi_rec_fop ( int  filter_num)
static

Definition at line 684 of file source_dock_fom.c.

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

◆ apply_filters()

static int apply_filters ( struct fdmi_sd_fom sd_fom,
struct m0_fdmi_src_rec src_rec 
)
static
Todo:
Mark FDMI filter as invalid (send HA not?) (phase 2)

This list is accessed and modified from thread at a time. No protection needed.

Definition at line 415 of file source_dock_fom.c.

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

◆ fdmi__src_dock_timer_fom_wakeup()

static void fdmi__src_dock_timer_fom_wakeup ( struct fdmi_sd_timer_fom timer_fom)
static

Definition at line 366 of file source_dock_fom.c.

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

◆ fdmi_filter_calc()

static int fdmi_filter_calc ( struct fdmi_sd_fom sd_fom,
struct m0_fdmi_src_rec src_rec,
struct m0_conf_fdmi_filter fdmi_filter 
)
static

Definition at line 863 of file source_dock_fom.c.

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

◆ fdmi_post_fop()

static int fdmi_post_fop ( struct m0_fop fop,
struct m0_rpc_session session 
)
static
Todo:
what deadline is better? (phase 2)

Definition at line 515 of file source_dock_fom.c.

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

◆ fdmi_rec_notif_replied()

static void fdmi_rec_notif_replied ( struct m0_rpc_item item)
static

Definition at line 1032 of file source_dock_fom.c.

Here is the call graph for this function:

◆ fdmi_rr_fom_create()

static int fdmi_rr_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Definition at line 1099 of file source_dock_fom.c.

Here is the call graph for this function:

◆ fdmi_rr_fom_fini()

static void fdmi_rr_fom_fini ( struct m0_fom fom)
static

Definition at line 1133 of file source_dock_fom.c.

Here is the call graph for this function:

◆ fdmi_rr_fom_tick()

static int fdmi_rr_fom_tick ( struct m0_fom fom)
static

Definition at line 1143 of file source_dock_fom.c.

Here is the call graph for this function:

◆ fdmi_sd_fom_check()

static void fdmi_sd_fom_check ( struct fdmi_sd_fom sd_fom)
static

Checking the inflight list.

  • If not enough time has passed, just return.
    • If a record has expired specified time, we have to give up resending.
    • If not, resend the record to process again.

Definition at line 901 of file source_dock_fom.c.

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

◆ fdmi_sd_fom_fini()

static void fdmi_sd_fom_fini ( struct m0_fom fom)
static

Definition at line 490 of file source_dock_fom.c.

Here is the call graph for this function:

◆ fdmi_sd_fom_locality()

static size_t fdmi_sd_fom_locality ( const struct m0_fom fom)
static

Definition at line 410 of file source_dock_fom.c.

◆ fdmi_sd_fom_tick()

static int fdmi_sd_fom_tick ( struct m0_fom fom)
static

Definition at line 956 of file source_dock_fom.c.

Here is the call graph for this function:

◆ fdmi_sd_timer_fom_fini()

static void fdmi_sd_timer_fom_fini ( struct m0_fom fom)
static

Definition at line 1163 of file source_dock_fom.c.

Here is the call graph for this function:

◆ fdmi_sd_timer_fom_tick()

static int fdmi_sd_timer_fom_tick ( struct m0_fom fom)
static

Definition at line 1174 of file source_dock_fom.c.

Here is the call graph for this function:

◆ filters_nr()

static int filters_nr ( struct m0_fdmi_src_rec src_rec,
const char *  endpoint 
)
static

Definition at line 665 of file source_dock_fom.c.

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

◆ fop_create()

static struct m0_fop* fop_create ( struct m0_fdmi_src_rec src_rec,
const char *  endpoint 
)
static

Definition at line 713 of file source_dock_fom.c.

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

◆ m0_fdmi__sd_conn_pool_rpc_machine()

static struct m0_rpc_machine* m0_fdmi__sd_conn_pool_rpc_machine ( void  )
static

Definition at line 678 of file source_dock_fom.c.

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

◆ M0_TL_DECLARE()

M0_TL_DECLARE ( fdmi_record_inflight  ,
M0_EXTERN  ,
struct m0_fdmi_src_rec   
)

◆ M0_TL_DEFINE()

M0_TL_DEFINE ( pending_fops  ,
static  ,
struct fdmi_pending_fop   
)

◆ M0_TL_DESCR_DECLARE()

M0_TL_DESCR_DECLARE ( fdmi_record_inflight  ,
M0_EXTERN   
)

◆ M0_TL_DESCR_DEFINE()

M0_TL_DESCR_DEFINE ( pending_fops  ,
"pending fops list ,
M0_INTERNAL  ,
struct fdmi_pending_fop  ,
fti_linkage  ,
fti_magic  ,
M0_FDMI_SRC_DOCK_PENDING_FOP_MAGIC  ,
M0_FDMI_SRC_DOCK_PENDING_FOP_HEAD_MAGIC   
)

◆ node_eval()

static int node_eval ( void *  data,
struct m0_fdmi_flt_var_node value_desc,
struct m0_fdmi_flt_operand value 
)
static

Definition at line 842 of file source_dock_fom.c.

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

◆ payload_encode()

static int payload_encode ( struct m0_fdmi_src_rec src_rec,
struct m0_fop fop 
)
static

Definition at line 766 of file source_dock_fom.c.

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

◆ pending_fop_clink_cb()

static bool pending_fop_clink_cb ( struct m0_clink clink)
static

Definition at line 537 of file source_dock_fom.c.

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

◆ process_fdmi_rec()

static int process_fdmi_rec ( struct fdmi_sd_fom sd_fom,
struct m0_fdmi_src_rec src_rec 
)
static

Definition at line 459 of file source_dock_fom.c.

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

◆ sd_fom_process_matched_filters()

static int sd_fom_process_matched_filters ( struct m0_fdmi_src_dock sd_ctx,
struct m0_fdmi_src_rec src_rec 
)
static
Todo:
store map <fdmi record id, endpoint>, Phase 2

Definition at line 775 of file source_dock_fom.c.

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

◆ sd_fom_save_pending_fop()

static int sd_fom_save_pending_fop ( struct fdmi_sd_fom sd_fom,
struct m0_fop fop,
struct m0_rpc_session session 
)
static

Definition at line 611 of file source_dock_fom.c.

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

◆ sd_fom_send_record()

static int sd_fom_send_record ( struct fdmi_sd_fom sd_fom,
struct m0_fop fop,
const char *  ep 
)
static

Definition at line 637 of file source_dock_fom.c.

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

◆ wakeup_iff_waiting()

static void wakeup_iff_waiting ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 328 of file source_dock_fom.c.

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

Variable Documentation

◆ fdmi_filter_type_handlers

struct m0_fdmi_sd_filter_type_handler fdmi_filter_type_handlers[]
static
Initial value:
= {
{
.ffth_handler = &m0_fdmi_eval_flt,
},
{
},
}
M0_INTERNAL int m0_fdmi_eval_flt(struct m0_fdmi_eval_ctx *ctx, struct m0_conf_fdmi_filter *filter, struct m0_fdmi_eval_var_info *var_info)
Definition: flt_eval.c:184
M0_INTERNAL int m0_fol_fdmi_filter_kv_substring(struct m0_fdmi_eval_ctx *ctx, struct m0_conf_fdmi_filter *filter, struct m0_fdmi_eval_var_info *var_info)
Definition: fol_fdmi_src.c:738

Definition at line 852 of file source_dock_fom.c.

◆ fdmi_rec_not_item_ops

const struct m0_rpc_item_ops fdmi_rec_not_item_ops
static
Initial value:
= {
.rio_replied = fdmi_rec_notif_replied
}
static void fdmi_rec_notif_replied(struct m0_rpc_item *item)

Definition at line 54 of file source_dock_fom.c.

◆ fdmi_rr_fom_ops

const struct m0_fom_ops fdmi_rr_fom_ops
Initial value:
= {
.fo_fini = fdmi_rr_fom_fini,
.fo_tick = fdmi_rr_fom_tick,
.fo_home_locality = fdmi_sd_fom_locality
}
static size_t fdmi_sd_fom_locality(const struct m0_fom *fom)
static int fdmi_rr_fom_tick(struct m0_fom *fom)
static void fdmi_rr_fom_fini(struct m0_fom *fom)

Definition at line 230 of file source_dock_fom.c.

◆ fdmi_rr_fom_sm_conf

const struct m0_sm_conf fdmi_rr_fom_sm_conf
Initial value:
= {
.scf_name = "fdmi-rr-fom-sm",
}
static struct m0_sm_state_descr fdmi_rr_fom_state_descr[]
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 220 of file source_dock_fom.c.

◆ fdmi_rr_fom_state_descr

struct m0_sm_state_descr fdmi_rr_fom_state_descr[]
static
Initial value:
= {
.sd_flags = M0_SDF_INITIAL,
.sd_name = "Init",
},
.sd_flags = M0_SDF_TERMINAL,
.sd_name = "Fini",
.sd_allowed = 0
}
}
#define M0_BITS(...)
Definition: misc.h:236

Definition at line 207 of file source_dock_fom.c.

◆ fdmi_rr_fom_type_ops

const struct m0_fom_type_ops fdmi_rr_fom_type_ops
Initial value:
= {
.fto_create = fdmi_rr_fom_create
}
static int fdmi_rr_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)

Definition at line 226 of file source_dock_fom.c.

◆ fdmi_sd_fom_ops

const struct m0_fom_ops fdmi_sd_fom_ops
static
Initial value:
= {
.fo_fini = fdmi_sd_fom_fini,
.fo_tick = fdmi_sd_fom_tick,
.fo_home_locality = fdmi_sd_fom_locality
}
static size_t fdmi_sd_fom_locality(const struct m0_fom *fom)
static void fdmi_sd_fom_fini(struct m0_fom *fom)
static int fdmi_sd_fom_tick(struct m0_fom *fom)

Definition at line 123 of file source_dock_fom.c.

◆ fdmi_sd_fom_type

struct m0_fom_type fdmi_sd_fom_type
static

Definition at line 132 of file source_dock_fom.c.

◆ fdmi_sd_fom_type_ops

const struct m0_fom_type_ops fdmi_sd_fom_type_ops
static
Initial value:
= {
}

Definition at line 129 of file source_dock_fom.c.

◆ fdmi_sd_timer_fom_ops

const struct m0_fom_ops fdmi_sd_timer_fom_ops
static
Initial value:
= {
.fo_home_locality = fdmi_sd_fom_locality
}
static size_t fdmi_sd_fom_locality(const struct m0_fom *fom)
static int fdmi_sd_timer_fom_tick(struct m0_fom *fom)
static void fdmi_sd_timer_fom_fini(struct m0_fom *fom)

Definition at line 183 of file source_dock_fom.c.

◆ fdmi_sd_timer_fom_type

struct m0_fom_type fdmi_sd_timer_fom_type
static

Definition at line 192 of file source_dock_fom.c.

◆ fdmi_sd_timer_fom_type_ops

const struct m0_fom_type_ops fdmi_sd_timer_fom_type_ops
static
Initial value:
= {
}

Definition at line 189 of file source_dock_fom.c.

◆ fdmi_src_dock_fom_sm_conf

struct m0_sm_conf fdmi_src_dock_fom_sm_conf
static
Initial value:
= {
.scf_name = "fdmi-src-dock-fom-sm",
}
static struct m0_sm_state_descr fdmi_src_dock_state_descr[]
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 116 of file source_dock_fom.c.

◆ fdmi_src_dock_state_descr

struct m0_sm_state_descr fdmi_src_dock_state_descr[]
static
Initial value:

Definition at line 90 of file source_dock_fom.c.

◆ fdmi_src_dock_timer_fom_sm_conf

struct m0_sm_conf fdmi_src_dock_timer_fom_sm_conf
static
Initial value:
= {
.scf_name = "fdmi-src-dock-timer-fom-sm",
}
static struct m0_sm_state_descr fdmi_src_dock_timer_fom_state_descr[]
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 176 of file source_dock_fom.c.

◆ fdmi_src_dock_timer_fom_state_descr