Motr
M0
|
Detailed Functional Specification. More...
Data Structures | |
struct | m0_confc_update_state |
struct | m0_confc |
struct | m0_confc_gate_ops |
struct | m0_confc_ctx |
Macros | |
#define | m0_confc_open(ctx, origin, ...) |
#define | m0_confc_open_sync(result, origin, ...) |
Enumerations | |
enum | m0_confc_state { M0_CC_READY, M0_CC_REVOKED, M0_CC_GETTING_READY, M0_CC_FAILED } |
Functions | |
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) |
M0_INTERNAL int | m0_confc_ctx_init (struct m0_confc_ctx *ctx, struct m0_confc *confc) |
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_reconnect (struct m0_confc *confc, struct m0_rpc_machine *rpc_mach, const char *confd_addr) |
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) |
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 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 struct m0_rpc_conn * | m0_confc2conn (struct m0_confc *confc) |
M0_INTERNAL struct m0_rpc_session * | m0_confc2sess (struct m0_confc *confc) |
Detailed Functional Specification.
#define m0_confc_open | ( | ctx, | |
origin, | |||
... | |||
) |
Requests an asynchronous opening of configuration object.
ctx | Fetch context. |
origin | Path origin (NULL = root configuration object). |
... | Path to the requested object. Variable arguments – path components – are m0_fid initialisers (M0_FID_TINIT()); use M0_FID0 for empty path. The number of path components should not exceed M0_CONF_PATH_MAX. |
#define m0_confc_open_sync | ( | result, | |
origin, | |||
... | |||
) |
Opens configuration object synchronously.
If the call succeeds, *result will point to the requested object.
result | struct m0_conf_obj ** |
origin | Path origin (not NULL). |
... | Path to the requested object. See m0_confc_open(). |
Example:
enum m0_confc_state |
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.