Motr  M0
Configuration Cache (lspec)

Functions

 M0_TL_DESCR_DEFINE (m0_conf_cache, "registered m0_conf_obj-s",, struct m0_conf_obj, co_cache_link, co_gen_magic, M0_CONF_OBJ_MAGIC, M0_CONF_CACHE_MAGIC)
 
 M0_TL_DEFINE (m0_conf_cache, M0_INTERNAL, struct m0_conf_obj)
 
M0_INTERNAL void m0_conf_cache_lock (struct m0_conf_cache *cache)
 
M0_INTERNAL void m0_conf_cache_unlock (struct m0_conf_cache *cache)
 
M0_INTERNAL bool m0_conf_cache_is_locked (const struct m0_conf_cache *cache)
 
M0_INTERNAL void m0_conf_cache_init (struct m0_conf_cache *cache, struct m0_mutex *lock)
 
M0_INTERNAL int m0_conf_cache_add (struct m0_conf_cache *cache, struct m0_conf_obj *obj)
 
M0_INTERNAL bool m0_conf_cache_contains (struct m0_conf_cache *cache, const struct m0_fid *fid)
 
M0_INTERNAL struct m0_conf_objm0_conf_cache_lookup (const struct m0_conf_cache *cache, const struct m0_fid *id)
 
static void _obj_del (struct m0_conf_obj *obj)
 
M0_INTERNAL void m0_conf_cache_del (const struct m0_conf_cache *cache, struct m0_conf_obj *obj)
 
static void conf_cache_clean (struct m0_conf_cache *cache, const struct m0_conf_obj_type *type, bool gc)
 
M0_INTERNAL void m0_conf_cache_clean (struct m0_conf_cache *cache, const struct m0_conf_obj_type *type)
 
M0_INTERNAL void m0_conf_cache_gc (struct m0_conf_cache *cache)
 
M0_INTERNAL void m0_conf_cache_fini (struct m0_conf_cache *cache)
 
static int conf_encode (struct m0_confx *enc, const struct m0_conf_obj *obj, bool debug)
 
static int conf_cache_encode (const struct m0_conf_cache *cache, struct m0_confx *dest, bool debug)
 
M0_INTERNAL int m0_conf_cache_to_string (struct m0_conf_cache *cache, char **str, bool debug)
 
M0_INTERNAL int m0_conf_cache_from_string (struct m0_conf_cache *cache, const char *str)
 
M0_INTERNAL int m0_conf_version (struct m0_conf_cache *cache)
 
M0_INTERNAL struct m0_conf_objm0_conf_cache_pinned (const struct m0_conf_cache *cache)
 

Detailed Description

The implementation of m0_conf_cache::ca_registry is based on linked list data structure.

See also
DLD of configuration caching, Logical Specification

Function Documentation

◆ _obj_del()

static void _obj_del ( struct m0_conf_obj obj)
static

Definition at line 113 of file cache.c.

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

◆ conf_cache_clean()

static void conf_cache_clean ( struct m0_conf_cache cache,
const struct m0_conf_obj_type type,
bool  gc 
)
static

Definition at line 135 of file cache.c.

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

◆ conf_cache_encode()

static int conf_cache_encode ( const struct m0_conf_cache cache,
struct m0_confx dest,
bool  debug 
)
static

Definition at line 209 of file cache.c.

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

◆ conf_encode()

static int conf_encode ( struct m0_confx enc,
const struct m0_conf_obj obj,
bool  debug 
)
static

Definition at line 196 of file cache.c.

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

◆ m0_conf_cache_add()

M0_INTERNAL int m0_conf_cache_add ( struct m0_conf_cache cache,
struct m0_conf_obj obj 
)

Adds configuration object to the cache.

Precondition
m0_conf_cache_is_locked(cache)
!m0_conf_cache_tlink_is_in(obj)

Definition at line 79 of file cache.c.

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

◆ m0_conf_cache_clean()

M0_INTERNAL void m0_conf_cache_clean ( struct m0_conf_cache cache,
const struct m0_conf_obj_type type 
)

Deletes registered objects of specific type or, if ‘type’ is NULL, all registered configuration objects.

Note that m0_conf_cache_clean(cache, NULL) does not finalise configuration cache.

Precondition
m0_conf_cache_is_locked(cache)
See also
m0_conf_cache_fini(), m0_conf_obj_delete()

Definition at line 168 of file cache.c.

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

◆ m0_conf_cache_contains()

M0_INTERNAL bool m0_conf_cache_contains ( struct m0_conf_cache cache,
const struct m0_fid fid 
)

Checks if an object with given fid exists in conf cache.

Definition at line 94 of file cache.c.

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

◆ m0_conf_cache_del()

M0_INTERNAL void m0_conf_cache_del ( const struct m0_conf_cache cache,
struct m0_conf_obj obj 
)

Unregisters and m0_conf_obj_delete()s configuration object.

Precondition
m0_conf_cache_is_locked(cache)
m0_conf_cache_tlist_contains(&cache->ca_registry, obj)

Definition at line 124 of file cache.c.

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

◆ m0_conf_cache_fini()

M0_INTERNAL void m0_conf_cache_fini ( struct m0_conf_cache cache)

Finalises configuration cache.

m0_conf_obj_delete()s every registered configuration object.

Definition at line 183 of file cache.c.

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

◆ m0_conf_cache_from_string()

M0_INTERNAL int m0_conf_cache_from_string ( struct m0_conf_cache cache,
const char *  str 
)

Loads conf cache from a string.

Precondition
str != NULL
m0_conf_cache_is_locked(cache)
See also
m0_conf_cache_to_string()

Definition at line 278 of file cache.c.

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

◆ m0_conf_cache_gc()

M0_INTERNAL void m0_conf_cache_gc ( struct m0_conf_cache cache)

Deletes registered objects with m0_conf_cache::co_deleted flag set.

Precondition
m0_conf_cache_is_locked(cache)

Definition at line 176 of file cache.c.

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

◆ m0_conf_cache_init()

M0_INTERNAL void m0_conf_cache_init ( struct m0_conf_cache cache,
struct m0_mutex lock 
)

Initialises configuration cache.

Definition at line 66 of file cache.c.

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

◆ m0_conf_cache_is_locked()

M0_INTERNAL bool m0_conf_cache_is_locked ( const struct m0_conf_cache cache)

Definition at line 60 of file cache.c.

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

◆ m0_conf_cache_lock()

M0_INTERNAL void m0_conf_cache_lock ( struct m0_conf_cache cache)

Definition at line 50 of file cache.c.

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

◆ m0_conf_cache_lookup()

M0_INTERNAL struct m0_conf_obj* m0_conf_cache_lookup ( const struct m0_conf_cache cache,
const struct m0_fid id 
)

Searches for a configuration object given its identity (type & id).

Returns NULL if there is no such object in the cache.

Definition at line 106 of file cache.c.

Here is the call graph for this function:

◆ m0_conf_cache_pinned()

M0_INTERNAL struct m0_conf_obj* m0_conf_cache_pinned ( const struct m0_conf_cache cache)

Searches the configuration cache for a pinned object. Returns NULL if none is found.

Precondition
m0_conf_cache_is_locked(cache)

Definition at line 320 of file cache.c.

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

◆ m0_conf_cache_to_string()

M0_INTERNAL int m0_conf_cache_to_string ( struct m0_conf_cache cache,
char **  str,
bool  debug 
)

Creates conf string representation of all objects in the cache, except m0_conf_dir objects.

If ‘debug’ is true, the checking of conf objects' invariants will be skipped.

Note
If the call succeeds, the user is responsible for freeing allocated memory with m0_confx_string_free(*str).
See also
m0_conf_cache_from_string()

Definition at line 257 of file cache.c.

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

◆ m0_conf_cache_unlock()

M0_INTERNAL void m0_conf_cache_unlock ( struct m0_conf_cache cache)

Definition at line 55 of file cache.c.

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

◆ m0_conf_version()

M0_INTERNAL int m0_conf_version ( struct m0_conf_cache cache)

Returns m0_conf_root::rt_verno of the root object.

Definition at line 304 of file cache.c.

Here is the call graph for this function:

◆ M0_TL_DEFINE()

M0_TL_DEFINE ( m0_conf_cache  ,
M0_INTERNAL  ,
struct m0_conf_obj   
)

◆ M0_TL_DESCR_DEFINE()

M0_TL_DESCR_DEFINE ( m0_conf_cache  ,
"registered m0_conf_obj-s ,
struct m0_conf_obj  ,
co_cache_link  ,
co_gen_magic  ,
M0_CONF_OBJ_MAGIC  ,
M0_CONF_CACHE_MAGIC   
)