Motr
M0
|
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_confc * | m0_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_obj * | m0_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_conn * | m0_confc2conn (struct m0_confc *confc) |
M0_INTERNAL struct m0_rpc_session * | m0_confc2sess (struct m0_confc *confc) |
static struct m0_confc_ctx * | mach_to_ctx (struct m0_sm *mach) |
static const struct m0_confc_ctx * | const_mach_to_ctx (const struct m0_sm *mach) |
static struct m0_confc_ctx * | ast_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_ctx * | item_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_fop * | confc_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 |
enum 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 |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
M0_BOB_DEFINE | ( | static | , |
& | confc_bob, | ||
m0_confc | |||
) |
M0_BOB_DEFINE | ( | static | , |
& | ctx_bob, | ||
m0_confc_ctx | |||
) |
M0_INTERNAL struct m0_rpc_conn* m0_confc2conn | ( | struct m0_confc * | confc | ) |
M0_INTERNAL struct m0_rpc_session* m0_confc2sess | ( | struct m0_confc * | confc | ) |
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 | ) |
Closes configuration object opened with m0_confc_open() or m0_confc_open_sync().
m0_confc_close(NULL) is a noop.
Definition at line 921 of file confc.c.
M0_INTERNAL int32_t m0_confc_ctx_error | ( | const struct m0_confc_ctx * | ctx | ) |
Returns error status of asynchronous configuration retrieval operation.
0 | The asynchronous configuration request has completed successfully. |
-Exxx | The request has completed unsuccessfully. |
Definition at line 759 of file confc.c.
M0_INTERNAL int32_t m0_confc_ctx_error_lock | ( | const struct m0_confc_ctx * | ctx | ) |
M0_INTERNAL void m0_confc_ctx_fini | ( | struct m0_confc_ctx * | ctx | ) |
M0_INTERNAL void m0_confc_ctx_fini_locked | ( | struct m0_confc_ctx * | ctx | ) |
M0_INTERNAL int m0_confc_ctx_init | ( | struct m0_confc_ctx * | ctx, |
struct m0_confc * | confc | ||
) |
Initialises configuration retrieval context.
This call may block.
Definition at line 643 of file confc.c.
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.
Definition at line 742 of file confc.c.
M0_INTERNAL bool m0_confc_ctx_is_completed_lock | ( | const struct m0_confc_ctx * | ctx | ) |
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.
Definition at line 771 of file confc.c.
M0_INTERNAL void m0_confc_fini | ( | struct m0_confc * | confc | ) |
M0_INTERNAL struct m0_confc* m0_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 | ||
) |
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.
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.
confc | A confc instance to be initialised. |
sm_group | State machine group to be associated with this confc. |
confd_addr | End point address of configuration server (confd). |
rpc_mach | RPC machine that will process configuration RPC items. |
local_conf | Configuration string — ASCII description of configuration data to pre-load the cache with (see Pre-Loading of Configuration Cache). |
timeout_ns | Confd connection timeout, nanoseconds. |
Definition at line 512 of file confc.c.
M0_INTERNAL bool m0_confc_invariant | ( | const struct m0_confc * | confc | ) |
M0_INTERNAL bool m0_confc_is_inited | ( | const struct m0_confc * | confc | ) |
M0_INTERNAL bool m0_confc_is_online | ( | const struct m0_confc * | confc | ) |
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.
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.
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.
ctx | Fetch context. | |
dir | Directory. | |
[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.
M0_CONF_DIRMISS | Asynchronous 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_DIREND | End of directory is reached. No waiting is needed. |
-Exxx | Error. |
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.
Definition at line 990 of file confc.c.
M0_INTERNAL int m0_confc_readdir_sync | ( | struct m0_conf_obj * | dir, |
struct m0_conf_obj ** | pptr | ||
) |
Gets next directory entry synchronously.
dir | Directory. | |
[in] | pptr | "Current" entry. |
[out] | pptr | "Next" entry. |
M0_CONF_DIRNEXT | *pptr now points to the next directory entry. |
M0_CONF_DIREND | End of directory is reached. |
-Exxx | Error. |
m0_confc_readdir_sync() puts and pins configuration objects similarly to m0_confc_readdir().
Example:
Definition at line 1020 of file confc.c.
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.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Follows the path, checking statuses of met objects.
M0_CS_READY | Path target is reachable. |
M0_CS_MISSING | One 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_LOADING | Neither 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. |
-ENOENT | ctx->fc_path refers to a nonexistent object. |
-ENOMEM | Request allocation failed. |
Definition at line 1365 of file confc.c.
|
static |
Applies the results of path walking.
ctx | Configuration retrieval context. |
obj | The object reached by a path walk. |
ri | The position in ctx->fc_path[] where the remaining (not visited) path components start. |
Definition at line 1406 of file confc.c.
|
static |
|
static |
Allocates and fills configuration fetch request fop.
Upon success, confc_fop_alloc() sets m0_confc_ctx::fc_rpc_item field.
ctx | Configuration retrieval context. |
orig | Origin of the path being sent to confd. |
ri | Starting position (in ctx->fc_path[]) of the path to be sent to confd. |
Definition at line 1787 of file confc.c.
|
static |
|
static |
|
static |
Filters out intermediate state transitions of m0_confc_ctx::fc_mach.
Definition at line 796 of file confc.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |