Motr  M0
Configuration Cache

Detailed Functional Specification. More...

Data Structures

struct  m0_conf_cache
 

Enumerations

enum  m0_conf_version { M0_CONF_VER_UNKNOWN = 0, M0_CONF_VER_TEMP = ~0 }
 
enum  { M0_CONF_PATH_MAX = 15 }
 

Functions

M0_INTERNAL void m0_conf_cache_init (struct m0_conf_cache *cache, struct m0_mutex *lock)
 
M0_INTERNAL void m0_conf_cache_fini (struct m0_conf_cache *cache)
 
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_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 int m0_conf_cache_add (struct m0_conf_cache *cache, struct m0_conf_obj *obj)
 
M0_INTERNAL void m0_conf_cache_del (const 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)
 
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

Detailed Functional Specification.

See also
DLD of configuration caching, Functional Specification

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Maximum number of path components.

Path is a sequence of m0_fids, used for conf DAG traversal.

Enumerator
M0_CONF_PATH_MAX 

Definition at line 225 of file cache.h.

◆ m0_conf_version

Enumerator
M0_CONF_VER_UNKNOWN 

Reserved version number indicating that version election has never been carried out, or has failed.

See also
m0_rconfc
M0_CONF_VER_TEMP 

Reserved version number indicating that m0_conf_root::rt_verno is not set yet, i. e. Spiel transaction was opened but not committed yet.

See also
m0_spiel_tx_open()
m0_spiel_tx_commit()

Definition at line 75 of file cache.h.

Function Documentation

◆ 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: