Motr  M0
confc Internals

Data Structures

struct  sm_waiter
 
struct  confc_fop
 

Enumerations

enum  confc_ctx_state {
  S_INITIAL, S_CHECK, S_WAIT_REPLY, S_WAIT_STATUS,
  S_RETRY_CONFD, S_SKIP_CONFD, S_GROW_CACHE, S_FAILURE,
  S_TERMINAL, S_NR
}
 

Functions

static int check_st_in (struct m0_sm *mach)
 
static int wait_reply_st_in (struct m0_sm *mach)
 
static int skip_confd_st_in (struct m0_sm *mach)
 
static int retry_confd_st_in (struct m0_sm *mach)
 
static int grow_cache_st_in (struct m0_sm *mach)
 
static int failure_st_in (struct m0_sm *mach)
 
static bool check_st_invariant (const struct m0_sm *mach)
 
static bool failure_st_invariant (const struct m0_sm *mach)
 
static bool terminal_st_invariant (const struct m0_sm *mach)
 
static bool _confc_check (const void *bob)
 
static bool _ctx_check (const void *bob)
 
 M0_BOB_DEFINE (static, &confc_bob, m0_confc)
 
 M0_BOB_DEFINE (static, &ctx_bob, m0_confc_ctx)
 
M0_INTERNAL bool m0_confc_invariant (const struct m0_confc *confc)
 
static bool ctx_invariant (const struct m0_confc_ctx *ctx)
 
static int confc_cache_preload (struct m0_confc *confc, const char *local_conf)
 
static int connect_to_confd (struct m0_confc *confc, const char *confd_addr, struct m0_rpc_machine *rpc_mach)
 
static void disconnect_from_confd (struct m0_confc *confc)
 
static void confc_lock (struct m0_confc *confc)
 
static void confc_unlock (struct m0_confc *confc)
 
static bool confc_is_locked (const struct m0_confc *confc)
 
static void clink_cleanup_fini (struct m0_clink *link)
 
M0_INTERNAL bool m0_confc_is_inited (const struct m0_confc *confc)
 
M0_INTERNAL bool m0_confc_is_online (const struct m0_confc *confc)
 
static bool not_empty (const char *s)
 
static int confc_cache_create (struct m0_confc *confc, const char *local_conf)
 
M0_INTERNAL int m0_confc_reconnect (struct m0_confc *confc, struct m0_rpc_machine *rpc_mach, const char *confd_addr)
 
M0_INTERNAL int m0_confc_init_wait (struct m0_confc *confc, struct m0_sm_group *sm_group, const char *confd_addr, struct m0_rpc_machine *rpc_mach, const char *local_conf, uint64_t timeout_ns)
 
M0_INTERNAL int m0_confc_init (struct m0_confc *confc, struct m0_sm_group *sm_group, const char *confd_addr, struct m0_rpc_machine *rpc_mach, const char *local_conf)
 
M0_INTERNAL void m0_confc_fini (struct m0_confc *confc)
 
M0_INTERNAL struct m0_confcm0_confc_from_obj (const struct m0_conf_obj *obj)
 
M0_INTERNAL void m0_confc_gate_ops_set (struct m0_confc *confc, struct m0_confc_gate_ops *gops)
 
static bool on_object_updated (struct m0_clink *link)
 
static bool request_check (const struct m0_confc_ctx *ctx)
 
static bool eop (const struct m0_fid *buf)
 
static void confc_group_lock (const struct m0_confc *confc)
 
static void confc_group_unlock (const struct m0_confc *confc)
 
static bool confc_group_is_locked (const struct m0_confc *confc)
 
M0_INTERNAL int m0_confc_ctx_init (struct m0_confc_ctx *ctx, struct m0_confc *confc)
 
M0_INTERNAL void m0_confc_ctx_fini_locked (struct m0_confc_ctx *ctx)
 
M0_INTERNAL void m0_confc_ctx_fini (struct m0_confc_ctx *ctx)
 
M0_INTERNAL bool m0_confc_ctx_is_completed (const struct m0_confc_ctx *ctx)
 
M0_INTERNAL bool m0_confc_ctx_is_completed_lock (const struct m0_confc_ctx *ctx)
 
M0_INTERNAL int32_t m0_confc_ctx_error (const struct m0_confc_ctx *ctx)
 
M0_INTERNAL int32_t m0_confc_ctx_error_lock (const struct m0_confc_ctx *ctx)
 
M0_INTERNAL struct m0_conf_objm0_confc_ctx_result (struct m0_confc_ctx *ctx)
 
static bool sm__filter (struct m0_clink *link)
 
static int sm_waiter_init (struct sm_waiter *w, struct m0_confc *confc)
 
static void sm_waiter_fini (struct sm_waiter *w)
 
static int sm_waiter_wait (struct sm_waiter *w, struct m0_conf_obj **result)
 
static void ctx_state_set (struct m0_confc_ctx *ctx, enum confc_ctx_state state)
 
static void ctx_state_fail (struct m0_confc_ctx *ctx, int rc)
 
static int path_copy (const struct m0_fid *src, struct m0_fid *dest, size_t dest_sz)
 
M0_INTERNAL void m0_confc__open (struct m0_confc_ctx *ctx, struct m0_conf_obj *origin, const struct m0_fid *path)
 
M0_INTERNAL int m0_confc__open_sync (struct m0_conf_obj **result, struct m0_conf_obj *origin, const struct m0_fid *path)
 
M0_INTERNAL void m0_confc_close (struct m0_conf_obj *obj)
 
M0_INTERNAL void m0_confc_open_by_fid (struct m0_confc_ctx *ctx, const struct m0_fid *fid)
 
M0_INTERNAL int m0_confc_open_by_fid_sync (struct m0_confc *confc, const struct m0_fid *fid, struct m0_conf_obj **result)
 
M0_INTERNAL int m0_confc_readdir (struct m0_confc_ctx *ctx, struct m0_conf_obj *dir, struct m0_conf_obj **pptr)
 
M0_INTERNAL int m0_confc_readdir_sync (struct m0_conf_obj *dir, struct m0_conf_obj **pptr)
 
M0_INTERNAL struct m0_rpc_connm0_confc2conn (struct m0_confc *confc)
 
M0_INTERNAL struct m0_rpc_sessionm0_confc2sess (struct m0_confc *confc)
 
static struct m0_confc_ctxmach_to_ctx (struct m0_sm *mach)
 
static const struct m0_confc_ctxconst_mach_to_ctx (const struct m0_sm *mach)
 
static struct m0_confc_ctxast_to_ctx (struct m0_sm_ast *ast)
 
static int path_walk (struct m0_confc_ctx *ctx)
 
static int cache_grow (struct m0_confc *confc, const struct m0_conf_fetch_resp *resp)
 
static struct m0_confc_ctxitem_to_ctx (const struct m0_rpc_item *item)
 
static uint64_t * confc_cache_ver (struct m0_confc_ctx *ctx)
 
static void conf_obj_status_reset (struct m0_confc_ctx *ctx)
 
static void on_replied (struct m0_rpc_item *item)
 
static int path_walk_complete (struct m0_confc_ctx *ctx, struct m0_conf_obj *obj, size_t ri)
 
static int request_create (struct m0_confc_ctx *ctx, const struct m0_conf_obj *orig, size_t ri)
 
static void _state_set (struct m0_sm_group *grp M0_UNUSED, struct m0_sm_ast *ast)
 
static void _state_fail (struct m0_sm_group *grp M0_UNUSED, struct m0_sm_ast *ast)
 
static void _ast_post (struct m0_sm_ast *ast, void(*cb)(struct m0_sm_group *, struct m0_sm_ast *), int datum)
 
static int object_enrich (struct m0_conf_obj *dest, const struct m0_confx_obj *src, struct m0_confc *confc)
 
static int cached_obj_update (struct m0_confc *confc, const struct m0_confx_obj *flat)
 
static m0_time_t confc_deadline (const struct m0_confc *confc)
 
static void confc_fop_release (struct m0_ref *ref)
 
static struct confc_fopconfc_fop_alloc (struct m0_confc_ctx *ctx)
 

Variables

static struct m0_sm_state_descr confc_ctx_states [S_NR]
 
static const struct m0_sm_conf confc_ctx_states_conf
 
static const struct m0_bob_type confc_bob
 
static const struct m0_bob_type ctx_bob
 
static const struct m0_rpc_item_ops confc_item_ops
 

Detailed Description

See also
DLD of configuration caching, Logical Specification of confc

Enumeration Type Documentation

◆ confc_ctx_state

States of m0_confc_ctx::fc_mach.

Enumerator
S_INITIAL 
S_CHECK 
S_WAIT_REPLY 
S_WAIT_STATUS 
S_RETRY_CONFD 
S_SKIP_CONFD 
S_GROW_CACHE 
S_FAILURE 
S_TERMINAL 
S_NR 

Definition at line 306 of file confc.c.

Function Documentation

◆ _ast_post()

static void _ast_post ( struct m0_sm_ast ast,
void(*)(struct m0_sm_group *, struct m0_sm_ast *)  cb,
int  datum 
)
static

Definition at line 1519 of file confc.c.

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

◆ _confc_check()

static bool _confc_check ( const void *  bob)
static

Definition at line 610 of file confc.c.

Here is the call graph for this function:

◆ _ctx_check()

static bool _ctx_check ( const void *  bob)
static

Definition at line 727 of file confc.c.

Here is the call graph for this function:

◆ _state_fail()

static void _state_fail ( struct m0_sm_group *grp  M0_UNUSED,
struct m0_sm_ast ast 
)
static

Definition at line 1493 of file confc.c.

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

◆ _state_set()

static void _state_set ( struct m0_sm_group *grp  M0_UNUSED,
struct m0_sm_ast ast 
)
static

Definition at line 1471 of file confc.c.

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

◆ ast_to_ctx()

static struct m0_confc_ctx* ast_to_ctx ( struct m0_sm_ast ast)
static

Definition at line 1065 of file confc.c.

Here is the caller graph for this function:

◆ cache_grow()

static int cache_grow ( struct m0_confc confc,
const struct m0_conf_fetch_resp resp 
)
static

Adds new objects, contained in confd's response, to the confc configuration cache.

Precondition
resp->fr_rc == 0

Definition at line 1612 of file confc.c.

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

◆ cached_obj_update()

static int cached_obj_update ( struct m0_confc confc,
const struct m0_confx_obj flat 
)
static

Definition at line 1577 of file confc.c.

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

◆ check_st_in()

static int check_st_in ( struct m0_sm mach)
static

Actions to perform on entering S_CHECK state.

Definition at line 1086 of file confc.c.

Here is the call graph for this function:

◆ check_st_invariant()

static bool check_st_invariant ( const struct m0_sm mach)
static

Definition at line 1297 of file confc.c.

Here is the call graph for this function:

◆ clink_cleanup_fini()

static void clink_cleanup_fini ( struct m0_clink link)
static

Definition at line 619 of file confc.c.

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

◆ conf_obj_status_reset()

static void conf_obj_status_reset ( struct m0_confc_ctx ctx)
static

Change status of origin object of the configuration request from M0_CS_LOADING to M0_CS_MISSING.

Definition at line 1131 of file confc.c.

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

◆ confc_cache_create()

static int confc_cache_create ( struct m0_confc confc,
const char *  local_conf 
)
static

Definition at line 463 of file confc.c.

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

◆ confc_cache_preload()

static int confc_cache_preload ( struct m0_confc confc,
const char *  local_conf 
)
static

Adds objects, described by a configuration string, to the cache.

Definition at line 1587 of file confc.c.

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

◆ confc_cache_ver()

static uint64_t * confc_cache_ver ( struct m0_confc_ctx ctx)
static

Definition at line 1317 of file confc.c.

Here is the caller graph for this function:

◆ confc_deadline()

static m0_time_t confc_deadline ( const struct m0_confc confc)
inlinestatic

Definition at line 1644 of file confc.c.

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

◆ confc_fop_alloc()

static struct confc_fop* confc_fop_alloc ( struct m0_confc_ctx ctx)
static

Definition at line 1750 of file confc.c.

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

◆ confc_fop_release()

static void confc_fop_release ( struct m0_ref ref)
static

Definition at line 1726 of file confc.c.

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

◆ confc_group_is_locked()

static bool confc_group_is_locked ( const struct m0_confc confc)
static

Definition at line 1856 of file confc.c.

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

◆ confc_group_lock()

static void confc_group_lock ( const struct m0_confc confc)
static

Definition at line 1846 of file confc.c.

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

◆ confc_group_unlock()

static void confc_group_unlock ( const struct m0_confc confc)
static

Definition at line 1851 of file confc.c.

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

◆ confc_is_locked()

static bool confc_is_locked ( const struct m0_confc confc)
static

Definition at line 1871 of file confc.c.

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

◆ confc_lock()

static void confc_lock ( struct m0_confc confc)
static

Definition at line 1861 of file confc.c.

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

◆ confc_unlock()

static void confc_unlock ( struct m0_confc confc)
static

Definition at line 1866 of file confc.c.

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

◆ connect_to_confd()

static int connect_to_confd ( struct m0_confc confc,
const char *  confd_addr,
struct m0_rpc_machine rpc_mach 
)
static

Definition at line 1650 of file confc.c.

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

◆ const_mach_to_ctx()

static const struct m0_confc_ctx* const_mach_to_ctx ( const struct m0_sm mach)
static

Definition at line 1060 of file confc.c.

Here is the caller graph for this function:

◆ ctx_invariant()

static bool ctx_invariant ( const struct m0_confc_ctx ctx)
static

Definition at line 430 of file confc.c.

Here is the caller graph for this function:

◆ ctx_state_fail()

static void ctx_state_fail ( struct m0_confc_ctx ctx,
int  rc 
)
static

Posts an AST that will move the state machine to S_FAILURE state.

Definition at line 1540 of file confc.c.

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

◆ ctx_state_set()

static void ctx_state_set ( struct m0_confc_ctx ctx,
enum confc_ctx_state  state 
)
static

Posts an AST that will advance the state machine to given state.

Definition at line 1533 of file confc.c.

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

◆ disconnect_from_confd()

static void disconnect_from_confd ( struct m0_confc confc)
static

Definition at line 1679 of file confc.c.

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

◆ eop()

static bool eop ( const struct m0_fid id)
static

Last path element?

Definition at line 1335 of file confc.c.

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

◆ failure_st_in()

static int failure_st_in ( struct m0_sm mach)
static

Actions to perform on entering S_FAILURE state.

Definition at line 1228 of file confc.c.

Here is the call graph for this function:

◆ failure_st_invariant()

static bool failure_st_invariant ( const struct m0_sm mach)
static

Definition at line 1304 of file confc.c.

Here is the call graph for this function:

◆ grow_cache_st_in()

static int grow_cache_st_in ( struct m0_sm mach)
static

Actions to perform on entering S_GROW_CACHE state.

Definition at line 1191 of file confc.c.

Here is the call graph for this function:

◆ item_to_ctx()

static struct m0_confc_ctx * item_to_ctx ( const struct m0_rpc_item item)
static

Definition at line 1718 of file confc.c.

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

◆ M0_BOB_DEFINE() [1/2]

M0_BOB_DEFINE ( static  ,
confc_bob,
m0_confc   
)

◆ M0_BOB_DEFINE() [2/2]

M0_BOB_DEFINE ( static  ,
ctx_bob,
m0_confc_ctx   
)

◆ m0_confc2conn()

M0_INTERNAL struct m0_rpc_conn* m0_confc2conn ( struct m0_confc confc)

Definition at line 1045 of file confc.c.

Here is the caller graph for this function:

◆ m0_confc2sess()

M0_INTERNAL struct m0_rpc_session* m0_confc2sess ( struct m0_confc confc)

Definition at line 1050 of file confc.c.

Here is the caller graph for this function:

◆ m0_confc__open()

M0_INTERNAL void m0_confc__open ( struct m0_confc_ctx ctx,
struct m0_conf_obj origin,
const struct m0_fid path 
)

Definition at line 850 of file confc.c.

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

◆ m0_confc__open_sync()

M0_INTERNAL int m0_confc__open_sync ( struct m0_conf_obj **  result,
struct m0_conf_obj origin,
const struct m0_fid path 
)

Definition at line 899 of file confc.c.

Here is the call graph for this function:

◆ m0_confc_close()

M0_INTERNAL void m0_confc_close ( struct m0_conf_obj obj)

Closes configuration object opened with m0_confc_open() or m0_confc_open_sync().

m0_confc_close(NULL) is a noop.

Precondition
ergo(obj != NULL, obj->co_nrefs > 0)

Definition at line 921 of file confc.c.

Here is the call graph for this function:

◆ m0_confc_ctx_error()

M0_INTERNAL int32_t m0_confc_ctx_error ( const struct m0_confc_ctx ctx)

Returns error status of asynchronous configuration retrieval operation.

Return values
0The asynchronous configuration request has completed successfully.
-ExxxThe request has completed unsuccessfully.
Precondition
m0_confc_ctx_is_completed(ctx)

Definition at line 759 of file confc.c.

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

◆ m0_confc_ctx_error_lock()

M0_INTERNAL int32_t m0_confc_ctx_error_lock ( const struct m0_confc_ctx ctx)

Definition at line 765 of file confc.c.

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

◆ m0_confc_ctx_fini()

M0_INTERNAL void m0_confc_ctx_fini ( struct m0_confc_ctx ctx)

Definition at line 716 of file confc.c.

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

◆ m0_confc_ctx_fini_locked()

M0_INTERNAL void m0_confc_ctx_fini_locked ( struct m0_confc_ctx ctx)

Same as m0_confc_ctx_fini, but doesn't take sm group lock internally. Lock is needed to finalise ctx->fc_mach.

Definition at line 680 of file confc.c.

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

◆ m0_confc_ctx_init()

M0_INTERNAL int m0_confc_ctx_init ( struct m0_confc_ctx ctx,
struct m0_confc confc 
)

Initialises configuration retrieval context.

Precondition
confc is initialised
Note
m0_confc_ctx_init() may block at confc->cc_gops->go_check() call. It will unblock when rconfc acquires read lock or fails to do so.

This call may block.

See also
rconfc_gate_check()

Definition at line 643 of file confc.c.

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

◆ m0_confc_ctx_is_completed()

M0_INTERNAL bool m0_confc_ctx_is_completed ( const struct m0_confc_ctx ctx)

Returns true iff ctx->fc_mach has terminated or failed.

m0_confc_ctx_is_completed() can be used to filter out intermediate state transitions, signaled on ctx->fc_mach.sm_chan channel.

See also

Definition at line 742 of file confc.c.

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

◆ m0_confc_ctx_is_completed_lock()

M0_INTERNAL bool m0_confc_ctx_is_completed_lock ( const struct m0_confc_ctx ctx)

Definition at line 749 of file confc.c.

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

◆ m0_confc_ctx_result()

M0_INTERNAL struct m0_conf_obj* m0_confc_ctx_result ( struct m0_confc_ctx ctx)

Retrieves the resulting object of a configuration request.

m0_confc_ctx_result() should only be called once, after ctx->fc_mach.sm_chan is signaled and m0_confc_ctx_error() returns 0.

m0_confc_ctx_result() sets ctx->fc_result to NULL and returns the original value.

Precondition
ctx->fc_mach.sm_state == S_TERMINAL
ctx->fc_result != NULL
Postcondition
ctx->fc_result == NULL

Definition at line 771 of file confc.c.

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

◆ m0_confc_fini()

M0_INTERNAL void m0_confc_fini ( struct m0_confc confc)

Finalises configuration client. Destroys configuration cache, freeing allocated memory.

Precondition
confc->cc_nr_ctx == 0
There are no opened (pinned) configuration objects.

Definition at line 570 of file confc.c.

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

◆ m0_confc_from_obj()

M0_INTERNAL struct m0_confc* m0_confc_from_obj ( const struct m0_conf_obj obj)

Obtains the address of m0_confc that owns given configuration object.

Definition at line 592 of file confc.c.

Here is the caller graph for this function:

◆ m0_confc_gate_ops_set()

M0_INTERNAL void m0_confc_gate_ops_set ( struct m0_confc confc,
struct m0_confc_gate_ops gops 
)

Definition at line 597 of file confc.c.

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

◆ m0_confc_init()

M0_INTERNAL int m0_confc_init ( struct m0_confc confc,
struct m0_sm_group sm_group,
const char *  confd_addr,
struct m0_rpc_machine rpc_mach,
const char *  local_conf 
)

Equivalent to m0_confc_init_wait() with timeout_ns = M0_TIME_NEVER.

Definition at line 560 of file confc.c.

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

◆ m0_confc_init_wait()

M0_INTERNAL int m0_confc_init_wait ( struct m0_confc confc,
struct m0_sm_group sm_group,
const char *  confd_addr,
struct m0_rpc_machine rpc_mach,
const char *  local_conf,
uint64_t  timeout_ns 
)

Initialises configuration client.

Parameters
confcA confc instance to be initialised.
sm_groupState machine group to be associated with this confc.
confd_addrEnd point address of configuration server (confd).
rpc_machRPC machine that will process configuration RPC items.
local_confConfiguration string — ASCII description of configuration data to pre-load the cache with (see Pre-Loading of Configuration Cache).
timeout_nsConfd connection timeout, nanoseconds.
Precondition
not_empty(confd_addr) || not_empty(local_conf)
ergo(not_empty(confd_addr), rpc_mach != NULL)

Definition at line 512 of file confc.c.

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

◆ m0_confc_invariant()

M0_INTERNAL bool m0_confc_invariant ( const struct m0_confc confc)

Definition at line 425 of file confc.c.

Here is the caller graph for this function:

◆ m0_confc_is_inited()

M0_INTERNAL bool m0_confc_is_inited ( const struct m0_confc confc)

Definition at line 448 of file confc.c.

Here is the caller graph for this function:

◆ m0_confc_is_online()

M0_INTERNAL bool m0_confc_is_online ( const struct m0_confc confc)

Definition at line 453 of file confc.c.

Here is the caller graph for this function:

◆ m0_confc_open_by_fid()

M0_INTERNAL void m0_confc_open_by_fid ( struct m0_confc_ctx ctx,
const struct m0_fid fid 
)

Opens configuration object by its fid.

The operation is asynchronous. If object fid is known, it is often easier to use m0_confc_open_by_fid() instead of traversing the DAG of conf objects.

Definition at line 930 of file confc.c.

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

◆ m0_confc_open_by_fid_sync()

M0_INTERNAL int m0_confc_open_by_fid_sync ( struct m0_confc confc,
const struct m0_fid fid,
struct m0_conf_obj **  result 
)

Synchronous version of m0_confc_open_by_fid().

Definition at line 943 of file confc.c.

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

◆ m0_confc_readdir()

M0_INTERNAL int m0_confc_readdir ( struct m0_confc_ctx ctx,
struct m0_conf_obj dir,
struct m0_conf_obj **  pptr 
)

Requests asynchronous retrieval of the next directory entry.

Parameters
ctxFetch context.
dirDirectory.
[in]pptr"Current" entry.
[out]pptr"Next" entry.

Entries of a directory are usually present in the configuration cache. In this common case m0_confc_readdir() can fulfill the request immediately. Return values M0_CONF_DIREND and M0_CONF_DIRNEXT inform the caller that it may proceed without waiting for ctx->fc_mach.sm_chan channel to be signaled.

Return values
M0_CONF_DIRMISSAsynchronous retrieval of configuration has been initiated. The caller should wait.
M0_CONF_DIRNEXT*pptr now points to the next directory entry. No waiting is needed.
M0_CONF_DIRENDEnd of directory is reached. No waiting is needed.
-ExxxError.

m0_confc_readdir() puts (m0_conf_obj_put()) the configuration object referred to via ‘pptr’ input parameter.

m0_confc_readdir() pins (m0_conf_obj_get()) the resulting object in case of M0_CONF_DIRNEXT.

m0_confc_readdir() does not touch ‘ctx’ argument if the returned value is M0_CONF_DIRNEXT or M0_CONF_DIREND. ‘ctx’ can be re-used in this case.

See also
confc-fspec-recipe2
Precondition
ctx->fc_mach.sm_state == S_INITIAL
m0_conf_obj_type(dir) == &M0_CONF_DIR_TYPE && dir->co_cache == &ctx->fc_confc->cc_cache
Postcondition
ergo(M0_IN(retval, (M0_CONF_DIRNEXT, M0_CONF_DIREND)), ctx->fc_mach.sm_state == S_INITIAL)

Definition at line 990 of file confc.c.

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

◆ m0_confc_readdir_sync()

M0_INTERNAL int m0_confc_readdir_sync ( struct m0_conf_obj dir,
struct m0_conf_obj **  pptr 
)

Gets next directory entry synchronously.

Parameters
dirDirectory.
[in]pptr"Current" entry.
[out]pptr"Next" entry.
Return values
M0_CONF_DIRNEXT*pptr now points to the next directory entry.
M0_CONF_DIRENDEnd of directory is reached.
-ExxxError.

m0_confc_readdir_sync() puts and pins configuration objects similarly to m0_confc_readdir().

See also
m0_confc_readdir()

Example:

struct m0_conf_obj *entry;
for (entry = NULL; (rc = m0_confc_readdir_sync(dir, &entry)) > 0; )
use(entry);

Definition at line 1020 of file confc.c.

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

◆ m0_confc_reconnect()

M0_INTERNAL int m0_confc_reconnect ( struct m0_confc confc,
struct m0_rpc_machine rpc_mach,
const char *  confd_addr 
)

Lets rconfc to switch to another confd address on the fly without touching any confc internals including cache. Timely cache invalidation is a responsibility of rconfc internal routines.

Relies on internal confc locking.

Definition at line 484 of file confc.c.

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

◆ mach_to_ctx()

static struct m0_confc_ctx* mach_to_ctx ( struct m0_sm mach)
static

Definition at line 1055 of file confc.c.

Here is the caller graph for this function:

◆ not_empty()

static bool not_empty ( const char *  s)
static

Definition at line 458 of file confc.c.

Here is the caller graph for this function:

◆ object_enrich()

static int object_enrich ( struct m0_conf_obj dest,
const struct m0_confx_obj src,
struct m0_confc confc 
)
static

Definition at line 1550 of file confc.c.

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

◆ on_object_updated()

static bool on_object_updated ( struct m0_clink link)
static

Handles ‘object loading completed’ and ‘object unpinned’ events.

Definition at line 1282 of file confc.c.

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

◆ on_replied()

static void on_replied ( struct m0_rpc_item item)
static

Handles ‘RPC replied’ event (i.e. response arrival or an error).

Definition at line 1251 of file confc.c.

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

◆ path_copy()

static int path_copy ( const struct m0_fid src,
struct m0_fid dest,
size_t  dest_sz 
)
static

Copies path from ‘src’ to ‘dest’.

Return values
0Success.
-E2BIG‘src’ path is too long.

Definition at line 970 of file confc.c.

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

◆ path_walk()

static int path_walk ( struct m0_confc_ctx ctx)
static

Follows the path, checking statuses of met objects.

Return values
M0_CS_READYPath target is reachable.
M0_CS_MISSINGOne of the intermediate objects or the target itself is M0_CS_MISSING. path_walk_complete(), which is called from path_walk(), changes status of this object to M0_CS_LOADING and fills ctx->fc_req.
M0_CS_LOADINGNeither path target nor missing objects can be reached because of M0_CS_LOADING object blocking the path. If ctx->fc_mach is in S_FAILURE state, path_walk_complete() reverts status of this object to M0_CS_MISSING and signals object's channel. Otherwise path_walk_complete() registers ctx->fc_clink with the channel of loading object.
-ENOENTctx->fc_path refers to a nonexistent object.
-ENOMEMRequest allocation failed.
See also
State Specification

Definition at line 1365 of file confc.c.

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

◆ path_walk_complete()

static int path_walk_complete ( struct m0_confc_ctx ctx,
struct m0_conf_obj obj,
size_t  ri 
)
static

Applies the results of path walking.

Returns
original status of the reached configuration object.
Parameters
ctxConfiguration retrieval context.
objThe object reached by a path walk.
riThe position in ctx->fc_path[] where the remaining (not visited) path components start.

Definition at line 1406 of file confc.c.

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

◆ request_check()

static bool request_check ( const struct m0_confc_ctx ctx)
static

Definition at line 1823 of file confc.c.

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

◆ request_create()

static int request_create ( struct m0_confc_ctx ctx,
const struct m0_conf_obj orig,
size_t  ri 
)
static

Allocates and fills configuration fetch request fop.

Upon success, confc_fop_alloc() sets m0_confc_ctx::fc_rpc_item field.

Parameters
ctxConfiguration retrieval context.
origOrigin of the path being sent to confd.
riStarting position (in ctx->fc_path[]) of the path to be sent to confd.
Precondition
m0_confc_is_online(ctx->fc_confc)

Definition at line 1787 of file confc.c.

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

◆ retry_confd_st_in()

static int retry_confd_st_in ( struct m0_sm mach)
static

Actions to perform on entering S_RETRY_CONFD state.

Definition at line 1147 of file confc.c.

Here is the call graph for this function:

◆ skip_confd_st_in()

static int skip_confd_st_in ( struct m0_sm mach)
static

Actions to perform on entering S_SKIP_CONFD state.

Definition at line 1166 of file confc.c.

Here is the call graph for this function:

◆ sm__filter()

static bool sm__filter ( struct m0_clink link)
static

Filters out intermediate state transitions of m0_confc_ctx::fc_mach.

Definition at line 796 of file confc.c.

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

◆ sm_waiter_fini()

static void sm_waiter_fini ( struct sm_waiter w)
static

Definition at line 814 of file confc.c.

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

◆ sm_waiter_init()

static int sm_waiter_init ( struct sm_waiter w,
struct m0_confc confc 
)
static

Definition at line 802 of file confc.c.

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

◆ sm_waiter_wait()

static int sm_waiter_wait ( struct sm_waiter w,
struct m0_conf_obj **  result 
)
static

Definition at line 821 of file confc.c.

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

◆ terminal_st_invariant()

static bool terminal_st_invariant ( const struct m0_sm mach)
static

Definition at line 1310 of file confc.c.

◆ wait_reply_st_in()

static int wait_reply_st_in ( struct m0_sm mach)
static

Actions to perform on entering S_WAIT_REPLY state.

Definition at line 1111 of file confc.c.

Here is the call graph for this function:

Variable Documentation

◆ confc_bob

const struct m0_bob_type confc_bob
static
Initial value:
= {
.bt_name = "m0_confc",
.bt_magix_offset = M0_MAGIX_OFFSET(struct m0_confc, cc_magic),
.bt_magix = M0_CONFC_MAGIC,
.bt_check = _confc_check
}
static bool _confc_check(const void *bob)
Definition: confc.c:610
#define M0_MAGIX_OFFSET(type, field)
Definition: misc.h:356

Definition at line 409 of file confc.c.

◆ confc_ctx_states

struct m0_sm_state_descr confc_ctx_states[S_NR]
static

Definition at line 319 of file confc.c.

◆ confc_ctx_states_conf

const struct m0_sm_conf confc_ctx_states_conf
static
Initial value:
= {
.scf_name = "states of m0_confc_ctx::fc_mach",
.scf_nr_states = S_NR,
.scf_state = confc_ctx_states
}
static struct m0_sm_state_descr confc_ctx_states[S_NR]
Definition: confc.c:319
Definition: confc.c:316

Definition at line 396 of file confc.c.

◆ confc_item_ops

const struct m0_rpc_item_ops confc_item_ops
static
Initial value:
= {
.rio_replied = on_replied,
}
static void on_replied(struct m0_rpc_item *item)
Definition: confc.c:1251

Definition at line 1770 of file confc.c.

◆ ctx_bob

const struct m0_bob_type ctx_bob
static
Initial value:
= {
.bt_name = "m0_confc_ctx",
.bt_magix_offset = M0_MAGIX_OFFSET(struct m0_confc_ctx, fc_magic),
.bt_magix = M0_CONFC_CTX_MAGIC,
.bt_check = _ctx_check
}
static bool _ctx_check(const void *bob)
Definition: confc.c:727
#define M0_MAGIX_OFFSET(type, field)
Definition: misc.h:356

Definition at line 417 of file confc.c.