Asterisk - The Open Source Telephony Project
18.5.0
|
Sorcery Memory Cache Object Wizard. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/sorcery.h"
#include "asterisk/astobj2.h"
#include "asterisk/sched.h"
#include "asterisk/test.h"
#include "asterisk/heap.h"
#include "asterisk/cli.h"
#include "asterisk/manager.h"
Go to the source code of this file.
Data Structures | |
struct | backend_data |
Backend data that the mock sorcery wizard uses to create objects. More... | |
struct | print_object_details |
Structure used to pass data for printing cached object information. More... | |
struct | sorcery_memory_cache |
Structure for storing a memory cache. More... | |
struct | sorcery_memory_cache_fields_cmp_params |
Structure used for fields comparison. More... | |
struct | sorcery_memory_cached_object |
Structure for stored a cached object. More... | |
struct | stale_cache_update_task_data |
struct | stale_update_task_data |
struct | test_data |
Sorcery object created based on backend data. More... | |
struct | test_sorcery_object |
Dummy sorcery object. More... | |
Macros | |
#define | CACHE_CONTAINER_BUCKET_SIZE 53 |
The default bucket size for the container of objects in the cache. More... | |
#define | CACHE_HEAP_INIT_HEIGHT 5 |
Height of heap for cache object heap. Allows 31 initial objects. More... | |
#define | CACHES_CONTAINER_BUCKET_SIZE 53 |
The bucket size for the container of caches. More... | |
#define | FORMAT "%-25.25s %-15u %-15u \n" |
#define | FORMAT "%-25.25s %-15.15s %-15.15s \n" |
#define | PASSTHRU_UPDATE_THREAD_ID 0x5EED1E55 |
Functions | |
static void | __init_passthru_update_id_storage (void) |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | add_to_cache (struct sorcery_memory_cache *cache, struct sorcery_memory_cached_object *cached_object) |
static int | age_cmp (void *a, void *b) |
static struct ast_sorcery * | alloc_and_initialize_sorcery (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (open_with_valid_options) | |
AST_TEST_DEFINE (open_with_invalid_options) | |
AST_TEST_DEFINE (create_and_retrieve) | |
AST_TEST_DEFINE (update) | |
AST_TEST_DEFINE (delete) | |
AST_TEST_DEFINE (maximum_objects) | |
AST_TEST_DEFINE (expiration) | |
AST_TEST_DEFINE (stale) | |
AST_TEST_DEFINE (full_backend_cache_expiration) | |
AST_TEST_DEFINE (full_backend_cache_stale) | |
static int | check_cache_content (struct ast_test *test, struct ast_sorcery *sorcery, struct sorcery_memory_cache *cache, const char **in_cache, size_t num_in_cache, const char **not_in_cache, size_t num_not_in_cache) |
static int | configuration_parse_unsigned_integer (const char *value, unsigned int *result) |
static void | end_passthru_update (void) |
static int | expire_objects_from_cache (const void *data) |
static int | is_passthru_update (void) |
static int | load_module (void) |
static void | mark_all_as_stale_in_cache (struct sorcery_memory_cache *cache) |
static int | mark_object_as_stale_in_cache (struct sorcery_memory_cache *cache, const char *id) |
static void | memory_cache_full_update (const struct ast_sorcery *sorcery, const char *type, struct sorcery_memory_cache *cache) |
static void | memory_cache_populate (const struct ast_sorcery *sorcery, const char *type, struct sorcery_memory_cache *cache) |
static void | memory_cache_stale_check (const struct ast_sorcery *sorcery, struct sorcery_memory_cache *cache) |
static void | memory_cache_stale_check_object (const struct ast_sorcery *sorcery, struct sorcery_memory_cache *cache, struct sorcery_memory_cached_object *cached) |
static void | memory_cache_stale_update_full (const struct ast_sorcery *sorcery, struct sorcery_memory_cache *cache, const char *type) |
static void | memory_cache_stale_update_object (const struct ast_sorcery *sorcery, struct sorcery_memory_cache *cache, struct sorcery_memory_cached_object *cached) |
static void * | mock_retrieve_id (const struct ast_sorcery *sorcery, void *data, const char *type, const char *id) |
Callback for retrieving sorcery object by ID. More... | |
static void | mock_retrieve_multiple (const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const struct ast_variable *fields) |
Callback for retrieving multiple sorcery objects. More... | |
static int | object_add_to_cache_callback (void *obj, void *arg, void *data, int flags) |
static int | object_stale_callback (void *obj, void *arg, int flags) |
static void | remove_all_from_cache (struct sorcery_memory_cache *cache) |
static int | remove_from_cache (struct sorcery_memory_cache *cache, const char *id, int reschedule) |
static int | remove_oldest_from_cache (struct sorcery_memory_cache *cache) |
static int | schedule_cache_expiration (struct sorcery_memory_cache *cache) |
static void | set_passthru_update (uint32_t value) |
static int | sorcery_memory_cache_ami_expire (struct mansession *s, const struct message *m) |
static int | sorcery_memory_cache_ami_expire_object (struct mansession *s, const struct message *m) |
static int | sorcery_memory_cache_ami_populate (struct mansession *s, const struct message *m) |
static int | sorcery_memory_cache_ami_stale (struct mansession *s, const struct message *m) |
static int | sorcery_memory_cache_ami_stale_object (struct mansession *s, const struct message *m) |
static void | sorcery_memory_cache_close (void *data) |
static int | sorcery_memory_cache_cmp (void *obj, void *arg, int flags) |
static char * | sorcery_memory_cache_complete_name (const char *word, int state) |
static char * | sorcery_memory_cache_complete_object_name (const char *cache_name, const char *word, int state) |
static int | sorcery_memory_cache_create (const struct ast_sorcery *sorcery, void *data, void *object) |
static int | sorcery_memory_cache_delete (const struct ast_sorcery *sorcery, void *data, void *object) |
static void | sorcery_memory_cache_destructor (void *obj) |
static char * | sorcery_memory_cache_dump (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | sorcery_memory_cache_expire (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | sorcery_memory_cache_fields_cmp (void *obj, void *arg, int flags) |
static int | sorcery_memory_cache_hash (const void *obj, int flags) |
static void | sorcery_memory_cache_load (void *data, const struct ast_sorcery *sorcery, const char *type) |
static void * | sorcery_memory_cache_open (const char *data) |
static char * | sorcery_memory_cache_populate (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | sorcery_memory_cache_print_object (void *obj, void *arg, int flags) |
static void | sorcery_memory_cache_reload (void *data, const struct ast_sorcery *sorcery, const char *type) |
static void * | sorcery_memory_cache_retrieve_fields (const struct ast_sorcery *sorcery, void *data, const char *type, const struct ast_variable *fields) |
static void * | sorcery_memory_cache_retrieve_id (const struct ast_sorcery *sorcery, void *data, const char *type, const char *id) |
static void | sorcery_memory_cache_retrieve_multiple (const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const struct ast_variable *fields) |
static void | sorcery_memory_cache_retrieve_prefix (const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const char *prefix, const size_t prefix_len) |
static void | sorcery_memory_cache_retrieve_regex (const struct ast_sorcery *sorcery, void *data, const char *type, struct ao2_container *objects, const char *regex) |
static char * | sorcery_memory_cache_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | sorcery_memory_cache_stale (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static struct sorcery_memory_cached_object * | sorcery_memory_cached_object_alloc (const struct ast_sorcery *sorcery, const struct sorcery_memory_cache *cache, void *object) |
static int | sorcery_memory_cached_object_cmp (void *obj, void *arg, int flags) |
static void | sorcery_memory_cached_object_destructor (void *obj) |
static int | sorcery_memory_cached_object_hash (const void *obj, int flags) |
static int | stale_cache_update (const void *data) |
static struct stale_cache_update_task_data * | stale_cache_update_task_data_alloc (struct ast_sorcery *sorcery, struct sorcery_memory_cache *cache, const char *type) |
static void | stale_cache_update_task_data_destructor (void *obj) |
static int | stale_item_update (const void *data) |
static struct stale_update_task_data * | stale_update_task_data_alloc (struct ast_sorcery *sorcery, struct sorcery_memory_cache *cache, const char *type, void *object) |
static void | stale_update_task_data_destructor (void *obj) |
static void | start_passthru_update (void) |
static void * | test_data_alloc (const char *id) |
Allocation callback for test_data sorcery object. More... | |
static void * | test_sorcery_object_alloc (const char *id) |
static int | unload_module (void) |
static int | wait_for_cache_update (const struct ast_sorcery *sorcery, void *previous_object, struct test_data **new_object) |
Wait for the cache to be updated after a stale object is retrieved. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Sorcery Memory Cache Object Wizard" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_REALTIME_DRIVER, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ao2_container * | caches |
Container of created caches. More... | |
static struct ast_cli_entry | cli_memory_cache [] |
static struct ast_sorcery_wizard | memory_cache_object_wizard |
static struct ast_sorcery_wizard | mock_wizard |
A mock sorcery wizard used for the stale test. More... | |
static struct ast_threadstorage | passthru_update_id_storage = { .once = PTHREAD_ONCE_INIT , .key_init = __init_passthru_update_id_storage , .custom_init = NULL , } |
static struct backend_data * | real_backend_data |
static struct ast_sched_context * | sched |
Scheduler for cache management. More... | |
Sorcery Memory Cache Object Wizard.
Definition in file res_sorcery_memory_cache.c.
#define CACHE_CONTAINER_BUCKET_SIZE 53 |
The default bucket size for the container of objects in the cache.
Definition at line 235 of file res_sorcery_memory_cache.c.
Referenced by sorcery_memory_cache_open().
#define CACHE_HEAP_INIT_HEIGHT 5 |
Height of heap for cache object heap. Allows 31 initial objects.
Definition at line 238 of file res_sorcery_memory_cache.c.
Referenced by sorcery_memory_cache_open().
#define CACHES_CONTAINER_BUCKET_SIZE 53 |
The bucket size for the container of caches.
Definition at line 232 of file res_sorcery_memory_cache.c.
Referenced by load_module().
#define FORMAT "%-25.25s %-15u %-15u \n" |
Referenced by sorcery_memory_cache_dump(), and sorcery_memory_cache_print_object().
#define FORMAT "%-25.25s %-15.15s %-15.15s \n" |
#define PASSTHRU_UPDATE_THREAD_ID 0x5EED1E55 |
Definition at line 246 of file res_sorcery_memory_cache.c.
Referenced by is_passthru_update(), and start_passthru_update().
|
static |
Definition at line 247 of file res_sorcery_memory_cache.c.
|
static |
Definition at line 3603 of file res_sorcery_memory_cache.c.
|
static |
Definition at line 3603 of file res_sorcery_memory_cache.c.
|
static |
Definition at line 728 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_link_flags, ast_heap_peek(), ast_heap_push, sorcery_memory_cached_object::created, sorcery_memory_cache::expire_id, sorcery_memory_cache::full_backend_cache, OBJ_NODATA, OBJ_NOLOCK, OBJ_SEARCH_OBJECT, OBJ_UNLINK, sorcery_memory_cache::object_heap, sorcery_memory_cache::objects, and schedule_cache_expiration().
Referenced by object_add_to_cache_callback(), and sorcery_memory_cache_create().
|
static |
Definition at line 1493 of file res_sorcery_memory_cache.c.
References ast_tvcmp().
Referenced by sorcery_memory_cache_open().
|
static |
Definition at line 2300 of file res_sorcery_memory_cache.c.
References ast_sorcery_apply_default, AST_SORCERY_APPLY_SUCCESS, ast_sorcery_internal_object_register, ast_sorcery_open, ast_sorcery_unref, NULL, sorcery_memory_cache::sorcery, and test_sorcery_object_alloc().
Referenced by AST_TEST_DEFINE().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 3603 of file res_sorcery_memory_cache.c.
AST_TEST_DEFINE | ( | open_with_valid_options | ) |
Definition at line 2317 of file res_sorcery_memory_cache.c.
References AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, cache, sip_to_pjsip::info(), sorcery_memory_cache::maximum_objects, sorcery_memory_cache::object_lifetime_maximum, sorcery_memory_cache::object_lifetime_stale, sorcery_memory_cache_close(), sorcery_memory_cache_open(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | open_with_invalid_options | ) |
Definition at line 2385 of file res_sorcery_memory_cache.c.
References AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, cache, sip_to_pjsip::info(), sorcery_memory_cache_close(), sorcery_memory_cache_open(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | create_and_retrieve | ) |
Definition at line 2467 of file res_sorcery_memory_cache.c.
References alloc_and_initialize_sorcery(), ao2_cleanup, ao2_container_count(), ast_sorcery_alloc(), ast_sorcery_unref, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, cleanup(), sip_to_pjsip::info(), NULL, sorcery_memory_cache::objects, RAII_VAR, sorcery_memory_cache::sorcery, sorcery_memory_cache_close(), sorcery_memory_cache_create(), sorcery_memory_cache_open(), sorcery_memory_cache_retrieve_id(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | update | ) |
Definition at line 2545 of file res_sorcery_memory_cache.c.
References alloc_and_initialize_sorcery(), ao2_cleanup, ao2_container_count(), ast_sorcery_alloc(), ast_sorcery_unref, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, cleanup(), sip_to_pjsip::info(), NULL, sorcery_memory_cache::objects, RAII_VAR, sorcery_memory_cache::sorcery, sorcery_memory_cache_close(), sorcery_memory_cache_create(), sorcery_memory_cache_open(), sorcery_memory_cache_retrieve_id(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | delete | ) |
Definition at line 2639 of file res_sorcery_memory_cache.c.
References alloc_and_initialize_sorcery(), ao2_cleanup, ao2_container_count(), ao2_ref, ast_sorcery_alloc(), ast_sorcery_unref, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, cleanup(), sip_to_pjsip::info(), NULL, sorcery_memory_cache::objects, RAII_VAR, sorcery_memory_cache::sorcery, sorcery_memory_cache_close(), sorcery_memory_cache_create(), sorcery_memory_cache_delete(), sorcery_memory_cache_open(), sorcery_memory_cache_retrieve_id(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | maximum_objects | ) |
Definition at line 2755 of file res_sorcery_memory_cache.c.
References alloc_and_initialize_sorcery(), ao2_cleanup, ao2_container_count(), ast_sorcery_alloc(), ast_sorcery_unref, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, check_cache_content(), cleanup(), sip_to_pjsip::info(), NULL, sorcery_memory_cache::objects, RAII_VAR, sorcery_memory_cache::sorcery, sorcery_memory_cache_close(), sorcery_memory_cache_create(), sorcery_memory_cache_delete(), sorcery_memory_cache_open(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | expiration | ) |
Definition at line 2882 of file res_sorcery_memory_cache.c.
References alloc_and_initialize_sorcery(), ao2_container_count(), ao2_ref, ast_cond_destroy, ast_cond_init, ast_cond_timedwait, ast_mutex_destroy, ast_mutex_init, ast_mutex_lock, ast_mutex_unlock, ast_sorcery_alloc(), ast_sorcery_unref, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), ast_uuid_generate_str(), AST_UUID_STR_LEN, sorcery_memory_cache::cache_completed, sorcery_memory_cache::cache_notify, cleanup(), sorcery_memory_cache::cond, sip_to_pjsip::info(), sorcery_memory_cache::lock, NULL, sorcery_memory_cache::objects, sorcery_memory_cache::sorcery, sorcery_memory_cache_close(), sorcery_memory_cache_create(), sorcery_memory_cache_open(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | stale | ) |
Definition at line 3118 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ao2_ref, ARRAY_LEN, ast_sorcery_apply_wizard_mapping, ast_sorcery_internal_object_register, ast_sorcery_open, ast_sorcery_retrieve_by_id(), ast_sorcery_unref, ast_sorcery_wizard_register, ast_sorcery_wizard_unregister(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, cleanup(), exists(), sip_to_pjsip::info(), NULL, backend_data::pepper, RAII_VAR, real_backend_data, backend_data::salt, sorcery_memory_cache::sorcery, test_data_alloc(), TEST_EXECUTE, TEST_INIT, and wait_for_cache_update().
AST_TEST_DEFINE | ( | full_backend_cache_expiration | ) |
Definition at line 3245 of file res_sorcery_memory_cache.c.
References ao2_container_count(), ao2_ref, ast_cond_destroy, ast_cond_init, ast_cond_timedwait, ast_mutex_destroy, ast_mutex_init, ast_mutex_lock, ast_mutex_unlock, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_apply_wizard_mapping, ast_sorcery_internal_object_register, ast_sorcery_object_field_register_nodoc, ast_sorcery_open, ast_sorcery_retrieve_by_fields(), ast_sorcery_unref, ast_sorcery_wizard_register, ast_sorcery_wizard_unregister(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), cleanup(), sorcery_memory_cache::cond, backend_data::exists, FLDSET, sip_to_pjsip::info(), sorcery_memory_cache::lock, NULL, sorcery_memory_cache::objects, OPT_UINT_T, real_backend_data, backend_data::salt, sorcery_memory_cache::sorcery, test_data_alloc(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | full_backend_cache_stale | ) |
Definition at line 3363 of file res_sorcery_memory_cache.c.
References ao2_container_count(), ao2_ref, ast_cond_destroy, ast_cond_init, ast_cond_timedwait, ast_mutex_destroy, ast_mutex_init, ast_mutex_lock, ast_mutex_unlock, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_apply_wizard_mapping, ast_sorcery_internal_object_register, ast_sorcery_object_field_register_nodoc, ast_sorcery_open, ast_sorcery_retrieve_by_fields(), ast_sorcery_unref, ast_sorcery_wizard_register, ast_sorcery_wizard_unregister(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_tvnow(), cleanup(), sorcery_memory_cache::cond, backend_data::exists, FLDSET, sip_to_pjsip::info(), sorcery_memory_cache::lock, NULL, sorcery_memory_cache::objects, OPT_UINT_T, real_backend_data, backend_data::salt, sorcery_memory_cache::sorcery, test_data_alloc(), TEST_EXECUTE, and TEST_INIT.
|
static |
Definition at line 2725 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ao2_ref, ast_test_status_update, NULL, RAII_VAR, and sorcery_memory_cache_retrieve_id().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 1484 of file res_sorcery_memory_cache.c.
References ast_strlen_zero.
Referenced by sorcery_memory_cache_open().
|
static |
Definition at line 281 of file res_sorcery_memory_cache.c.
References set_passthru_update().
Referenced by memory_cache_populate(), stale_cache_update(), and stale_item_update().
|
static |
Definition at line 498 of file res_sorcery_memory_cache.c.
References ao2_ref, ao2_trywrlock, ao2_unlock, ast_heap_peek(), ast_samp2tv(), ast_sorcery_object_get_id(), ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), sorcery_memory_cached_object::created, sorcery_memory_cache::del_expire, sorcery_memory_cache::expire_id, sorcery_memory_cached_object::object, sorcery_memory_cache::object_heap, sorcery_memory_cache::object_lifetime_maximum, sorcery_memory_cache::objects, remove_from_cache(), and schedule_cache_expiration().
Referenced by schedule_cache_expiration().
|
static |
Definition at line 249 of file res_sorcery_memory_cache.c.
References ast_threadstorage_get(), passthru_update_id_storage, and PASSTHRU_UPDATE_THREAD_ID.
Referenced by sorcery_memory_cache_retrieve_fields(), sorcery_memory_cache_retrieve_id(), sorcery_memory_cache_retrieve_multiple(), sorcery_memory_cache_retrieve_prefix(), and sorcery_memory_cache_retrieve_regex().
|
static |
Definition at line 3538 of file res_sorcery_memory_cache.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_manager_register_xml, AST_MODFLAG_GLOBAL_SYMBOLS, AST_MODFLAG_LOAD_ORDER, AST_MODPRI_REALTIME_DRIVER, AST_MODULE_INFO(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_MODULE_SUPPORT_CORE, ast_sched_context_create(), ast_sched_start_thread(), ast_sorcery_wizard_register, AST_TEST_REGISTER, ASTERISK_GPL_KEY, CACHES_CONTAINER_BUCKET_SIZE, EVENT_FLAG_SYSTEM, LOG_ERROR, sorcery_memory_cache::maximum_objects, NULL, sorcery_memory_cache_ami_expire(), sorcery_memory_cache_ami_expire_object(), sorcery_memory_cache_ami_populate(), sorcery_memory_cache_ami_stale(), sorcery_memory_cache_ami_stale_object(), sorcery_memory_cache_cmp(), sorcery_memory_cache_hash(), unload_module(), and update().
|
static |
Definition at line 632 of file res_sorcery_memory_cache.c.
References ao2_callback, OBJ_MULTIPLE, OBJ_NODATA, OBJ_NOLOCK, object_stale_callback(), and sorcery_memory_cache::objects.
Referenced by sorcery_memory_cache_ami_stale(), and sorcery_memory_cache_stale().
|
static |
Definition at line 605 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_ref, ast_assert, ast_sorcery_object_get_id(), OBJ_NOLOCK, OBJ_SEARCH_KEY, sorcery_memory_cached_object::object, object_stale_callback(), and sorcery_memory_cache::objects.
Referenced by sorcery_memory_cache_ami_stale_object(), and sorcery_memory_cache_stale().
|
static |
Definition at line 1077 of file res_sorcery_memory_cache.c.
References ao2_container_count(), ao2_unlock, ao2_wrlock, sorcery_memory_cache::full_backend_cache, memory_cache_populate(), and sorcery_memory_cache::objects.
Referenced by sorcery_memory_cache_retrieve_id(), sorcery_memory_cache_retrieve_multiple(), sorcery_memory_cache_retrieve_prefix(), and sorcery_memory_cache_retrieve_regex().
|
static |
Definition at line 1034 of file res_sorcery_memory_cache.c.
References ao2_callback_data, ao2_container_count(), ao2_ref, ast_log, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), end_passthru_update(), LOG_ERROR, LOG_WARNING, sorcery_memory_cache::maximum_objects, sorcery_memory_cache::name, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_NOLOCK, object_add_to_cache_callback(), sorcery_memory_cache::objects, remove_all_from_cache(), and start_passthru_update().
Referenced by memory_cache_full_update(), sorcery_memory_cache_ami_populate(), and sorcery_memory_cache_populate().
|
static |
Definition at line 1191 of file res_sorcery_memory_cache.c.
References ao2_bump, ao2_rdlock, ao2_ref, ao2_unlock, ast_heap_peek(), memory_cache_stale_check_object(), sorcery_memory_cache::object_heap, and sorcery_memory_cache::objects.
Referenced by sorcery_memory_cache_retrieve_multiple(), sorcery_memory_cache_retrieve_prefix(), and sorcery_memory_cache_retrieve_regex().
|
static |
Definition at line 1158 of file res_sorcery_memory_cache.c.
References ast_sorcery_object_get_type(), ast_tvnow(), ast_tvsub(), sorcery_memory_cached_object::created, sorcery_memory_cache::full_backend_cache, memory_cache_stale_update_full(), memory_cache_stale_update_object(), sorcery_memory_cached_object::object, and sorcery_memory_cache::object_lifetime_stale.
Referenced by memory_cache_stale_check(), sorcery_memory_cache_retrieve_fields(), and sorcery_memory_cache_retrieve_id().
|
static |
Definition at line 1098 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ao2_unlock, ao2_wrlock, ast_sched_add(), sorcery_memory_cache::objects, stale_cache_update(), stale_cache_update_task_data_alloc(), and sorcery_memory_cache::stale_update_sched_id.
Referenced by memory_cache_stale_check_object().
|
static |
Definition at line 1126 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_debug, ast_log, ast_sched_add(), ast_sorcery_object_get_id(), ast_sorcery_object_get_type(), LOG_ERROR, sorcery_memory_cached_object::object, stale_item_update(), sorcery_memory_cached_object::stale_update_sched_id, and stale_update_task_data_alloc().
Referenced by memory_cache_stale_check_object(), sorcery_memory_cache_ami_stale_object(), and sorcery_memory_cache_stale().
|
static |
Callback for retrieving sorcery object by ID.
The mock wizard uses the real_backend_data in order to construct objects. If the backend data is "nonexisent" then no object is returned. Otherwise, an object is created that has the backend data's salt and pepper values copied.
sorcery | The sorcery instance |
data | Unused |
type | The object type. Will always be "test". |
id | The object id. Will always be "test". |
NULL | Backend data does not exist |
non-NULL | An object representing the backend data |
Definition at line 3017 of file res_sorcery_memory_cache.c.
References ast_sorcery_alloc(), backend_data::exists, NULL, backend_data::pepper, test_data::pepper, real_backend_data, backend_data::salt, and test_data::salt.
|
static |
Callback for retrieving multiple sorcery objects.
The mock wizard uses the real_backend_data in order to construct objects. If the backend data is "nonexisent" then no object is returned. Otherwise, the number of objects matching the exists value will be returned.
sorcery | The sorcery instance |
data | Unused |
type | The object type. Will always be "test". |
objects | Container to place objects into. |
fields | Fields to search for. |
Definition at line 3049 of file res_sorcery_memory_cache.c.
References ao2_link, ao2_ref, ast_sorcery_alloc(), ast_uuid_generate_str(), AST_UUID_STR_LEN, backend_data::exists, backend_data::pepper, test_data::pepper, real_backend_data, backend_data::salt, and test_data::salt.
|
static |
Definition at line 855 of file res_sorcery_memory_cache.c.
References add_to_cache(), ao2_ref, CMP_STOP, and sorcery_memory_cached_object_alloc().
Referenced by memory_cache_populate(), and stale_cache_update().
|
static |
Definition at line 577 of file res_sorcery_memory_cache.c.
References ast_samp2tv(), ast_tvsub(), CMP_MATCH, sorcery_memory_cached_object::created, and sorcery_memory_cache::object_lifetime_stale.
Referenced by mark_all_as_stale_in_cache(), and mark_object_as_stale_in_cache().
|
static |
Definition at line 554 of file res_sorcery_memory_cache.c.
References ao2_callback, ao2_ref, ast_heap_pop(), AST_SCHED_DEL_UNREF, sorcery_memory_cache::del_expire, sorcery_memory_cache::expire_id, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_NOLOCK, OBJ_UNLINK, sorcery_memory_cache::object_heap, and sorcery_memory_cache::objects.
Referenced by memory_cache_populate(), sorcery_memory_cache_ami_expire(), sorcery_memory_cache_ami_populate(), sorcery_memory_cache_close(), sorcery_memory_cache_expire(), sorcery_memory_cache_populate(), sorcery_memory_cache_reload(), and stale_cache_update().
|
static |
Definition at line 465 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_ref, ast_assert, ast_heap_peek(), ast_heap_remove(), ast_sorcery_object_get_id(), OBJ_NOLOCK, OBJ_SEARCH_KEY, OBJ_UNLINK, sorcery_memory_cached_object::object, sorcery_memory_cache::object_heap, sorcery_memory_cache::objects, and schedule_cache_expiration().
Referenced by expire_objects_from_cache(), sorcery_memory_cache_ami_expire_object(), sorcery_memory_cache_create(), sorcery_memory_cache_delete(), and sorcery_memory_cache_expire().
|
static |
Definition at line 695 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_ref, ast_assert, ast_heap_pop(), OBJ_NOLOCK, OBJ_SEARCH_OBJECT, OBJ_UNLINK, sorcery_memory_cache::object_heap, sorcery_memory_cache::objects, and schedule_cache_expiration().
Referenced by sorcery_memory_cache_create().
|
static |
Definition at line 648 of file res_sorcery_memory_cache.c.
References ao2_bump, ao2_ref, ast_cond_signal, ast_heap_peek(), ast_mutex_lock, ast_mutex_unlock, ast_samp2tv(), ast_sched_add(), AST_SCHED_DEL_UNREF, ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), sorcery_memory_cache::cache_completed, sorcery_memory_cache::cond, sorcery_memory_cached_object::created, sorcery_memory_cache::del_expire, sorcery_memory_cache::expire_id, expire_objects_from_cache(), sorcery_memory_cache::lock, MAX, sorcery_memory_cache::object_heap, and sorcery_memory_cache::object_lifetime_maximum.
Referenced by add_to_cache(), expire_objects_from_cache(), remove_from_cache(), remove_oldest_from_cache(), and sorcery_memory_cached_object_destructor().
|
static |
Definition at line 262 of file res_sorcery_memory_cache.c.
References ast_log, ast_threadstorage_get(), LOG_ERROR, passthru_update_id_storage, and value.
Referenced by end_passthru_update(), and start_passthru_update().
|
static |
Definition at line 2115 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_ref, ao2_unlock, ao2_wrlock, ast_strlen_zero, astman_get_header(), astman_send_ack(), astman_send_error(), cache, OBJ_SEARCH_KEY, sorcery_memory_cache::objects, and remove_all_from_cache().
Referenced by load_module().
|
static |
Definition at line 2069 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_ref, ao2_unlock, ao2_wrlock, ast_strlen_zero, astman_get_header(), astman_send_ack(), astman_send_error(), cache, sorcery_memory_cache::full_backend_cache, OBJ_SEARCH_KEY, sorcery_memory_cache::objects, and remove_from_cache().
Referenced by load_module().
|
static |
Definition at line 2230 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_ref, ao2_unlock, ao2_wrlock, ast_strlen_zero, astman_get_header(), astman_send_ack(), astman_send_error(), cache, sorcery_memory_cache::full_backend_cache, memory_cache_populate(), OBJ_SEARCH_KEY, sorcery_memory_cache::object_type, sorcery_memory_cache::objects, remove_all_from_cache(), and sorcery_memory_cache::sorcery.
Referenced by load_module().
|
static |
Definition at line 2199 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_rdlock, ao2_ref, ao2_unlock, ast_strlen_zero, astman_get_header(), astman_send_ack(), astman_send_error(), cache, mark_all_as_stale_in_cache(), OBJ_SEARCH_KEY, and sorcery_memory_cache::objects.
Referenced by load_module().
|
static |
Definition at line 2146 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_rdlock, ao2_ref, ao2_unlock, ast_strlen_zero, ast_true(), astman_get_header(), astman_send_ack(), astman_send_error(), cache, mark_object_as_stale_in_cache(), memory_cache_stale_update_object(), OBJ_NOLOCK, OBJ_SEARCH_KEY, sorcery_memory_cache::objects, reload(), and sorcery_memory_cache::sorcery.
Referenced by load_module().
|
static |
Definition at line 1620 of file res_sorcery_memory_cache.c.
References ao2_ref, ao2_unlink, ao2_unlock, ao2_wrlock, ast_strlen_zero, sorcery_memory_cache::full_backend_cache, sorcery_memory_cache::name, NULL, sorcery_memory_cache::object_lifetime_maximum, sorcery_memory_cache::objects, remove_all_from_cache(), and sorcery_memory_cache::sorcery.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 329 of file res_sorcery_memory_cache.c.
References CMP_MATCH, sorcery_memory_cache::name, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by load_module().
|
static |
Definition at line 1652 of file res_sorcery_memory_cache.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_strdup, cache, sorcery_memory_cache::name, NULL, and result.
Referenced by sorcery_memory_cache_dump(), sorcery_memory_cache_expire(), sorcery_memory_cache_populate(), sorcery_memory_cache_show(), and sorcery_memory_cache_stale().
|
static |
Definition at line 1825 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_sorcery_object_get_id(), ast_strdup, cache, NULL, OBJ_SEARCH_KEY, sorcery_memory_cached_object::object, sorcery_memory_cache::objects, and result.
Referenced by sorcery_memory_cache_expire(), and sorcery_memory_cache_stale().
|
static |
Definition at line 805 of file res_sorcery_memory_cache.c.
References add_to_cache(), ao2_container_count(), ao2_ref, ao2_unlock, ao2_wrlock, ast_assert, ast_log, ast_sorcery_object_get_id(), LOG_ERROR, sorcery_memory_cache::maximum_objects, sorcery_memory_cache::objects, remove_from_cache(), remove_oldest_from_cache(), and sorcery_memory_cached_object_alloc().
Referenced by AST_TEST_DEFINE(), and stale_item_update().
|
static |
Definition at line 1598 of file res_sorcery_memory_cache.c.
References ao2_unlock, ao2_wrlock, ast_debug, ast_sorcery_object_get_id(), sorcery_memory_cache::objects, and remove_from_cache().
Referenced by AST_TEST_DEFINE(), and stale_item_update().
|
static |
Definition at line 422 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ast_free, ast_heap_destroy(), cache, sorcery_memory_cache::name, sorcery_memory_cache::object_heap, sorcery_memory_cache::object_type, and sorcery_memory_cache::objects.
Referenced by sorcery_memory_cache_open().
|
static |
Definition at line 1768 of file res_sorcery_memory_cache.c.
References print_object_details::a, a, ao2_callback, ao2_container_count(), ao2_find, ao2_ref, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), cache, print_object_details::cache, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, FORMAT, ast_cli_args::n, sorcery_memory_cache::name, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_SEARCH_KEY, sorcery_memory_cache::object_lifetime_maximum, sorcery_memory_cache::object_lifetime_stale, sorcery_memory_cache::objects, ast_cli_args::pos, sorcery_memory_cache_complete_name(), sorcery_memory_cache_print_object(), ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 1861 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_ref, ao2_unlock, ao2_wrlock, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), cache, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, sorcery_memory_cache::full_backend_cache, ast_cli_args::n, NULL, OBJ_SEARCH_KEY, sorcery_memory_cache::objects, ast_cli_args::pos, remove_all_from_cache(), remove_from_cache(), sorcery_memory_cache_complete_name(), sorcery_memory_cache_complete_object_name(), ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 1254 of file res_sorcery_memory_cache.c.
References ao2_link, ast_sorcery_object_get_id(), ast_variable_lists_match(), ast_variables_destroy(), CMP_MATCH, CMP_STOP, sorcery_memory_cache_fields_cmp_params::container, sorcery_memory_cache_fields_cmp_params::fields, NULL, sorcery_memory_cached_object::object, sorcery_memory_cached_object::objectset, sorcery_memory_cache_fields_cmp_params::prefix, sorcery_memory_cache_fields_cmp_params::prefix_len, RAII_VAR, and sorcery_memory_cache_fields_cmp_params::regex.
Referenced by sorcery_memory_cache_retrieve_fields(), sorcery_memory_cache_retrieve_multiple(), sorcery_memory_cache_retrieve_prefix(), and sorcery_memory_cache_retrieve_regex().
|
static |
Definition at line 295 of file res_sorcery_memory_cache.c.
References ast_assert, ast_str_hash(), cache, sorcery_memory_cache::name, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by load_module().
|
static |
Definition at line 1436 of file res_sorcery_memory_cache.c.
References ao2_link, ast_asprintf, ast_debug, ast_sorcery_get_module(), ast_strdup, ast_strlen_zero, sorcery_memory_cache::name, sorcery_memory_cache::object_type, and sorcery_memory_cache::sorcery.
|
static |
Definition at line 1508 of file res_sorcery_memory_cache.c.
References age_cmp(), AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_alloc_options, ao2_bump, ao2_cleanup, ao2_container_alloc_hash, ast_free, ast_heap_create, ast_log, ast_strdup, ast_strlen_zero, ast_true(), CACHE_CONTAINER_BUCKET_SIZE, CACHE_HEAP_INIT_HEIGHT, configuration_parse_unsigned_integer(), sorcery_memory_cache::expire_id, sorcery_memory_cache::expire_on_reload, sorcery_memory_cache::full_backend_cache, LOG_ERROR, sorcery_memory_cache::maximum_objects, sorcery_memory_cache::name, NULL, sorcery_memory_cache::object_heap, sorcery_memory_cache::object_lifetime_maximum, sorcery_memory_cache::object_lifetime_stale, sorcery_memory_cache::objects, options, RAII_VAR, sorcery_memory_cache_destructor(), sorcery_memory_cached_object_cmp(), sorcery_memory_cached_object_hash(), sorcery_memory_cache::stale_update_sched_id, strsep(), and value.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 2001 of file res_sorcery_memory_cache.c.
References ao2_container_count(), ao2_find, ao2_ref, ao2_unlock, ao2_wrlock, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), cache, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, sorcery_memory_cache::full_backend_cache, memory_cache_populate(), ast_cli_args::n, NULL, OBJ_SEARCH_KEY, sorcery_memory_cache::object_type, sorcery_memory_cache::objects, ast_cli_args::pos, remove_all_from_cache(), sorcery_memory_cache::sorcery, sorcery_memory_cache_complete_name(), ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 1744 of file res_sorcery_memory_cache.c.
References print_object_details::a, ast_cli(), ast_samp2tv(), ast_sorcery_object_get_id(), ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), print_object_details::cache, CMP_MATCH, sorcery_memory_cached_object::created, ast_cli_args::fd, FORMAT, MAX, sorcery_memory_cached_object::object, sorcery_memory_cache::object_lifetime_maximum, and sorcery_memory_cache::object_lifetime_stale.
Referenced by sorcery_memory_cache_dump().
|
static |
Definition at line 1461 of file res_sorcery_memory_cache.c.
References ao2_unlock, ao2_wrlock, sorcery_memory_cache::expire_on_reload, sorcery_memory_cache::objects, and remove_all_from_cache().
|
static |
Definition at line 1299 of file res_sorcery_memory_cache.c.
References ao2_bump, ao2_callback, ao2_ref, cache, sorcery_memory_cache_fields_cmp_params::fields, sorcery_memory_cache::full_backend_cache, is_passthru_update(), memory_cache_stale_check_object(), NULL, sorcery_memory_cached_object::object, sorcery_memory_cache::objects, sorcery_memory_cache::sorcery, sorcery_memory_cache_fields_cmp_params::sorcery, and sorcery_memory_cache_fields_cmp().
|
static |
Definition at line 1219 of file res_sorcery_memory_cache.c.
References ao2_bump, ao2_find, ao2_ref, ast_assert, ast_sorcery_object_get_id(), is_passthru_update(), memory_cache_full_update(), memory_cache_stale_check_object(), NULL, OBJ_SEARCH_KEY, sorcery_memory_cached_object::object, and sorcery_memory_cache::objects.
Referenced by AST_TEST_DEFINE(), and check_cache_content().
|
static |
Definition at line 1336 of file res_sorcery_memory_cache.c.
References ao2_callback, ao2_container_count(), cache, sorcery_memory_cache_fields_cmp_params::fields, sorcery_memory_cache::full_backend_cache, is_passthru_update(), memory_cache_full_update(), memory_cache_stale_check(), sorcery_memory_cache::objects, sorcery_memory_cache::sorcery, sorcery_memory_cache_fields_cmp_params::sorcery, and sorcery_memory_cache_fields_cmp().
|
static |
Definition at line 1404 of file res_sorcery_memory_cache.c.
References ao2_callback, ao2_container_count(), cache, sorcery_memory_cache::full_backend_cache, is_passthru_update(), memory_cache_full_update(), memory_cache_stale_check(), sorcery_memory_cache::objects, prefix, sorcery_memory_cache_fields_cmp_params::prefix_len, sorcery_memory_cache::sorcery, sorcery_memory_cache_fields_cmp_params::sorcery, and sorcery_memory_cache_fields_cmp().
|
static |
Definition at line 1369 of file res_sorcery_memory_cache.c.
References ao2_callback, ao2_container_count(), cache, sorcery_memory_cache::full_backend_cache, is_passthru_update(), memory_cache_full_update(), memory_cache_stale_check(), sorcery_memory_cache::objects, sorcery_memory_cache::sorcery, sorcery_memory_cache_fields_cmp_params::sorcery, and sorcery_memory_cache_fields_cmp().
|
static |
Definition at line 1679 of file res_sorcery_memory_cache.c.
References ao2_container_count(), ao2_find, ao2_ref, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), AST_CLI_ONOFF, cache, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, sorcery_memory_cache::expire_on_reload, ast_cli_args::fd, sorcery_memory_cache::maximum_objects, ast_cli_args::n, sorcery_memory_cache::name, NULL, OBJ_SEARCH_KEY, sorcery_memory_cache::object_lifetime_maximum, sorcery_memory_cache::object_lifetime_stale, sorcery_memory_cache::objects, ast_cli_args::pos, sorcery_memory_cache_complete_name(), ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 1917 of file res_sorcery_memory_cache.c.
References ao2_find, ao2_rdlock, ao2_ref, ao2_unlock, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_cli_complete(), cache, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, mark_all_as_stale_in_cache(), mark_object_as_stale_in_cache(), memory_cache_stale_update_object(), ast_cli_args::n, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, sorcery_memory_cache::object_lifetime_stale, sorcery_memory_cache::objects, ast_cli_args::pos, reload(), sorcery_memory_cache::sorcery, sorcery_memory_cache_complete_name(), sorcery_memory_cache_complete_object_name(), ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 766 of file res_sorcery_memory_cache.c.
References ao2_alloc, ao2_bump, ao2_ref, ast_sorcery_objectset_create, ast_tvnow(), sorcery_memory_cached_object::created, sorcery_memory_cache::full_backend_cache, NULL, sorcery_memory_cached_object::object, sorcery_memory_cached_object::objectset, sorcery_memory_cached_object_destructor(), and sorcery_memory_cached_object::stale_update_sched_id.
Referenced by object_add_to_cache_callback(), and sorcery_memory_cache_create().
|
static |
Definition at line 394 of file res_sorcery_memory_cache.c.
References ast_sorcery_object_get_id(), CMP_MATCH, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, OBJ_SEARCH_PARTIAL_KEY, and sorcery_memory_cached_object::object.
Referenced by sorcery_memory_cache_open().
|
static |
Definition at line 440 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ast_variables_destroy(), cache, sorcery_memory_cached_object::object, sorcery_memory_cached_object::objectset, and schedule_cache_expiration().
Referenced by sorcery_memory_cached_object_alloc().
|
static |
Definition at line 360 of file res_sorcery_memory_cache.c.
References ast_assert, ast_sorcery_object_get_id(), ast_str_hash(), sorcery_memory_cache::name, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, OBJ_SEARCH_PARTIAL_KEY, and sorcery_memory_cached_object::object.
Referenced by sorcery_memory_cache_open().
|
static |
Definition at line 908 of file res_sorcery_memory_cache.c.
References ao2_callback_data, ao2_container_count(), ao2_ref, ao2_unlock, ao2_wrlock, ast_log, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), stale_cache_update_task_data::cache, end_passthru_update(), LOG_ERROR, LOG_WARNING, sorcery_memory_cache::maximum_objects, sorcery_memory_cache::name, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_NOLOCK, object_add_to_cache_callback(), sorcery_memory_cache::objects, remove_all_from_cache(), stale_cache_update_task_data::sorcery, sorcery_memory_cache::stale_update_sched_id, start_passthru_update(), and stale_cache_update_task_data::type.
Referenced by memory_cache_stale_update_full().
|
static |
Definition at line 886 of file res_sorcery_memory_cache.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, ao2_ref, ast_strdup, stale_cache_update_task_data::cache, NULL, stale_cache_update_task_data::sorcery, stale_cache_update_task_data_destructor(), and stale_cache_update_task_data::type.
Referenced by memory_cache_stale_update_full().
|
static |
Definition at line 877 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ast_free, ast_sorcery_unref, stale_cache_update_task_data::cache, stale_cache_update_task_data::sorcery, and stale_cache_update_task_data::type.
Referenced by stale_cache_update_task_data_alloc().
|
static |
Definition at line 989 of file res_sorcery_memory_cache.c.
References ao2_ref, ast_debug, ast_sorcery_object_get_id(), ast_sorcery_object_get_type(), ast_sorcery_retrieve_by_id(), ast_test_suite_event_notify, stale_update_task_data::cache, end_passthru_update(), sorcery_memory_cache::name, stale_update_task_data::object, stale_update_task_data::sorcery, sorcery_memory_cache_create(), sorcery_memory_cache_delete(), and start_passthru_update().
Referenced by memory_cache_stale_update_object().
|
static |
Definition at line 971 of file res_sorcery_memory_cache.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, stale_update_task_data::cache, NULL, stale_update_task_data::object, stale_update_task_data::sorcery, and stale_update_task_data_destructor().
Referenced by memory_cache_stale_update_object().
|
static |
Definition at line 962 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ast_sorcery_unref, stale_update_task_data::cache, stale_update_task_data::object, and stale_update_task_data::sorcery.
Referenced by stale_update_task_data_alloc().
|
static |
Definition at line 276 of file res_sorcery_memory_cache.c.
References PASSTHRU_UPDATE_THREAD_ID, and set_passthru_update().
Referenced by memory_cache_populate(), stale_cache_update(), and stale_item_update().
|
static |
Allocation callback for test_data sorcery object.
Definition at line 2997 of file res_sorcery_memory_cache.c.
References ast_sorcery_generic_alloc(), and NULL.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 2288 of file res_sorcery_memory_cache.c.
References ast_sorcery_generic_alloc(), and NULL.
Referenced by alloc_and_initialize_sorcery().
|
static |
Definition at line 3500 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ARRAY_LEN, ast_cli_unregister_multiple(), ast_manager_unregister(), ast_sched_context_destroy(), ast_sorcery_wizard_unregister(), AST_TEST_UNREGISTER, sorcery_memory_cache::maximum_objects, NULL, and update().
Referenced by load_module().
|
static |
Wait for the cache to be updated after a stale object is retrieved.
Since the cache does not know what type of objects it is dealing with, and since we do not have the internals of the cache, the only way to make this determination is to continuously retrieve an object from the cache until we retrieve a different object than we had previously retrieved.
sorcery | The sorcery instance | |
previous_object | The object we had previously retrieved from the cache | |
[out] | new_object | The new object we retrieve from the cache |
0 | Successfully retrieved a new object from the cache |
non-zero | Failed to retrieve a new object from the cache |
Definition at line 3099 of file res_sorcery_memory_cache.c.
References ao2_cleanup, ast_remaining_ms(), ast_sorcery_retrieve_by_id(), and ast_tvnow().
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 3603 of file res_sorcery_memory_cache.c.
|
static |
Definition at line 3603 of file res_sorcery_memory_cache.c.
|
static |
Container of created caches.
Definition at line 241 of file res_sorcery_memory_cache.c.
|
static |
Definition at line 2057 of file res_sorcery_memory_cache.c.
|
static |
Definition at line 215 of file res_sorcery_memory_cache.c.
|
static |
A mock sorcery wizard used for the stale test.
Definition at line 3078 of file res_sorcery_memory_cache.c.
|
static |
Definition at line 247 of file res_sorcery_memory_cache.c.
Referenced by is_passthru_update(), and set_passthru_update().
|
static |
Referenced by AST_TEST_DEFINE(), mock_retrieve_id(), and mock_retrieve_multiple().
|
static |
Scheduler for cache management.
Definition at line 244 of file res_sorcery_memory_cache.c.