Asterisk - The Open Source Telephony Project GIT-master-3dee037
|
Bucket File API. More...
#include "asterisk.h"
#include "asterisk/logger.h"
#include "asterisk/sorcery.h"
#include "asterisk/bucket.h"
#include "asterisk/config_options.h"
#include "asterisk/astobj2.h"
#include "asterisk/strings.h"
#include "asterisk/json.h"
#include "asterisk/file.h"
#include "asterisk/module.h"
#include "asterisk/paths.h"
Go to the source code of this file.
Data Structures | |
struct | ast_bucket_scheme |
Structure for available schemes. More... | |
Macros | |
#define | METADATA_BUCKETS 53 |
Number of buckets for the container of metadata in a file. More... | |
#define | SCHEME_BUCKETS 53 |
Number of buckets for the container of schemes. More... | |
Functions | |
int | __ast_bucket_scheme_register (const char *name, struct ast_sorcery_wizard *bucket, struct ast_sorcery_wizard *file, bucket_file_create_cb create_cb, bucket_file_destroy_cb destroy_cb, struct ast_module *module) |
Register support for a specific scheme. More... | |
struct ast_bucket * | ast_bucket_alloc (const char *uri) |
Allocate a new bucket. More... | |
struct ast_bucket * | ast_bucket_clone (struct ast_bucket *bucket) |
Clone a bucket. More... | |
int | ast_bucket_create (struct ast_bucket *bucket) |
Create a new bucket in backend storage. More... | |
int | ast_bucket_delete (struct ast_bucket *bucket) |
Delete a bucket from backend storage. More... | |
struct ast_bucket_file * | ast_bucket_file_alloc (const char *uri) |
Allocate a new bucket file. More... | |
struct ast_bucket_file * | ast_bucket_file_clone (struct ast_bucket_file *file) |
Clone a bucket file. More... | |
struct ast_bucket_file * | ast_bucket_file_copy (struct ast_bucket_file *file, const char *uri) |
Copy a bucket file to a new URI. More... | |
int | ast_bucket_file_create (struct ast_bucket_file *file) |
Create a new bucket file in backend storage. More... | |
int | ast_bucket_file_delete (struct ast_bucket_file *file) |
Delete a bucket file from backend storage. More... | |
int | ast_bucket_file_is_stale (struct ast_bucket_file *file) |
Retrieve whether or not the backing datastore views the bucket file as stale. More... | |
struct ast_json * | ast_bucket_file_json (const struct ast_bucket_file *file) |
Get a JSON representation of a bucket file. More... | |
void | ast_bucket_file_metadata_callback (struct ast_bucket_file *file, ao2_callback_fn cb, void *arg) |
Execute a callback function on the metadata associated with a file. More... | |
struct ast_bucket_metadata * | ast_bucket_file_metadata_get (struct ast_bucket_file *file, const char *name) |
Retrieve a metadata attribute from a file. More... | |
int | ast_bucket_file_metadata_set (struct ast_bucket_file *file, const char *name, const char *value) |
Set a metadata attribute on a file to a specific value. More... | |
int | ast_bucket_file_metadata_unset (struct ast_bucket_file *file, const char *name) |
Unset a specific metadata attribute on a file. More... | |
int | ast_bucket_file_observer_add (const struct ast_sorcery_observer *callbacks) |
Add an observer for bucket file creation and deletion operations. More... | |
void | ast_bucket_file_observer_remove (const struct ast_sorcery_observer *callbacks) |
Remove an observer from bucket file creation and deletion. More... | |
struct ast_bucket_file * | ast_bucket_file_retrieve (const char *uri) |
Retrieve a bucket file. More... | |
int | ast_bucket_file_temporary_create (struct ast_bucket_file *file) |
Common file snapshot creation callback for creating a temporary file. More... | |
void | ast_bucket_file_temporary_destroy (struct ast_bucket_file *file) |
Common file snapshot destruction callback for deleting a temporary file. More... | |
int | ast_bucket_file_update (struct ast_bucket_file *file) |
Update an existing bucket file in backend storage. More... | |
int | ast_bucket_init (void) |
Initialize bucket support. More... | |
int | ast_bucket_is_stale (struct ast_bucket *bucket) |
Retrieve whether or not the backing datastore views the bucket as stale. More... | |
struct ast_json * | ast_bucket_json (const struct ast_bucket *bucket) |
Get a JSON representation of a bucket. More... | |
int | ast_bucket_observer_add (const struct ast_sorcery_observer *callbacks) |
Add an observer for bucket creation and deletion operations. More... | |
void | ast_bucket_observer_remove (const struct ast_sorcery_observer *callbacks) |
Remove an observer from bucket creation and deletion. More... | |
struct ast_bucket * | ast_bucket_retrieve (const char *uri) |
Retrieve information about a bucket. More... | |
static void * | bucket_alloc (const char *name) |
Allocator for buckets. More... | |
static void | bucket_cleanup (void) |
Hashing function for scheme container. More... | |
static int | bucket_copy (const char *infile, const char *outfile) |
Copy a file, shamelessly taken from file.c. More... | |
static int | bucket_copy_handler (const void *src, void *dst) |
static void | bucket_destroy (void *obj) |
Destructor for buckets. More... | |
static void * | bucket_file_alloc (const char *name) |
Allocator for bucket files. More... | |
static int | bucket_file_copy_handler (const void *src, void *dst) |
static void | bucket_file_destroy (void *obj) |
Hashing function for file metadata. More... | |
static int | bucket_file_wizard_create (const struct ast_sorcery *sorcery, void *data, void *object) |
Callback function for creating a bucket file. More... | |
static int | bucket_file_wizard_delete (const struct ast_sorcery *sorcery, void *data, void *object) |
Callback function for deleting a bucket file. More... | |
static int | bucket_file_wizard_is_stale (const struct ast_sorcery *sorcery, void *data, void *object) |
Callback function for determining if a bucket is stale. More... | |
static void * | bucket_file_wizard_retrieve (const struct ast_sorcery *sorcery, void *data, const char *type, const char *id) |
Callback function for retrieving a bucket file. More... | |
static int | bucket_file_wizard_update (const struct ast_sorcery *sorcery, void *data, void *object) |
Callback function for updating a bucket file. More... | |
static struct ast_bucket_metadata * | bucket_metadata_alloc (const char *name, const char *value) |
Allocator for metadata attributes. More... | |
static int | bucket_rbtree_str_sort_cmp (const void *obj_left, const void *obj_right, int flags) |
Sorting function for red black tree string container. More... | |
static int | bucket_wizard_create (const struct ast_sorcery *sorcery, void *data, void *object) |
Callback function for creating a bucket. More... | |
static int | bucket_wizard_delete (const struct ast_sorcery *sorcery, void *data, void *object) |
Callback function for deleting a bucket. More... | |
static int | bucket_wizard_is_stale (const struct ast_sorcery *sorcery, void *data, void *object) |
Callback function for determining if a bucket is stale. More... | |
static void * | bucket_wizard_retrieve (const struct ast_sorcery *sorcery, void *data, const char *type, const char *id) |
Callback function for retrieving a bucket. More... | |
static int | timeval_str2struct (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Custom handler for translating from a string timeval to actual structure. More... | |
static int | timeval_struct2str (const void *obj, const intptr_t *args, char **buf) |
Custom handler for translating from an actual structure timeval to string. More... | |
Variables | |
static struct ast_sorcery_wizard | bucket_file_wizard |
Intermediary file wizard. More... | |
static struct ast_sorcery * | bucket_sorcery |
Sorcery instance for all bucket operations. More... | |
static struct ast_sorcery_wizard | bucket_wizard |
Intermediary bucket wizard. More... | |
static struct ao2_container * | schemes |
Container of registered schemes. More... | |
Bucket File API.
Definition in file bucket.c.
#define METADATA_BUCKETS 53 |
#define SCHEME_BUCKETS 53 |
int __ast_bucket_scheme_register | ( | const char * | name, |
struct ast_sorcery_wizard * | bucket, | ||
struct ast_sorcery_wizard * | file, | ||
bucket_file_create_cb | create_cb, | ||
bucket_file_destroy_cb | destroy_cb, | ||
struct ast_module * | module | ||
) |
Register support for a specific scheme.
name | Name of the scheme, used to find based on scheme in URIs |
bucket | Sorcery wizard used for buckets |
file | Sorcery wizard used for files |
create_cb | Required file snapshot creation callback |
destroy_cb | Optional file snapshot destruction callback |
module | The module which implements this scheme |
0 | success |
-1 | failure |
Definition at line 277 of file bucket.c.
References ao2_alloc, ao2_cleanup, ao2_find, ao2_link_flags, ast_module_shutdown_ref, ast_strlen_zero(), ast_verb, ast_sorcery_wizard::create, ast_sorcery_wizard::delete, make_ari_stubs::file, lock, ast_sorcery_wizard::module, name, NULL, OBJ_KEY, OBJ_NOLOCK, RAII_VAR, ast_sorcery_wizard::retrieve_id, schemes, and SCOPED_AO2WRLOCK.
struct ast_bucket * ast_bucket_alloc | ( | const char * | uri | ) |
Allocate a new bucket.
uri | Complete URI for the bucket |
non-NULL | success |
NULL | failure |
Definition at line 431 of file bucket.c.
References ao2_cleanup, ao2_find, ao2_ref, ast_alloca, ast_copy_string(), ast_sorcery_alloc(), ast_strdupa, ast_string_field_set, ast_strlen_zero(), bucket_sorcery, len(), NULL, OBJ_KEY, RAII_VAR, ast_bucket::scheme, ast_bucket::scheme_impl, schemes, state, and tmp().
Referenced by AST_TEST_DEFINE(), and bucket_test_wizard_retrieve_id().
struct ast_bucket * ast_bucket_clone | ( | struct ast_bucket * | bucket | ) |
Clone a bucket.
This will create a copy of the passed in ast_bucket
structure. While all properties of the ast_bucket
structure are copied, any metadata in the original structure simply has its reference count increased.
bucket | The bucket to clone |
non-NULL | success |
NULL | failure |
ast_bucket
instances are immutable Definition at line 510 of file bucket.c.
References ast_sorcery_copy(), and bucket_sorcery.
Referenced by AST_TEST_DEFINE().
int ast_bucket_create | ( | struct ast_bucket * | bucket | ) |
Create a new bucket in backend storage.
bucket | The bucket |
0 | success |
-1 | failure |
Definition at line 488 of file bucket.c.
References ast_sorcery_create(), and bucket_sorcery.
Referenced by AST_TEST_DEFINE().
int ast_bucket_delete | ( | struct ast_bucket * | bucket | ) |
Delete a bucket from backend storage.
bucket | The bucket |
0 | success |
-1 | failure |
Definition at line 539 of file bucket.c.
References ast_sorcery_delete(), and bucket_sorcery.
Referenced by AST_TEST_DEFINE().
struct ast_bucket_file * ast_bucket_file_alloc | ( | const char * | uri | ) |
Allocate a new bucket file.
uri | Complete URI for the bucket file |
non-NULL | success |
NULL | failure |
Definition at line 663 of file bucket.c.
References ao2_cleanup, ao2_find, ao2_ref, ast_alloca, ast_copy_string(), ast_sorcery_alloc(), ast_strdupa, ast_string_field_set, ast_strlen_zero(), bucket_sorcery, make_ari_stubs::file, len(), NULL, OBJ_KEY, RAII_VAR, ast_bucket_file::scheme, schemes, state, and tmp().
Referenced by ast_bucket_file_copy(), ast_media_cache_create_or_update(), AST_TEST_DEFINE(), bucket_http_test_wizard_retrieve_id(), bucket_http_wizard_retrieve_id(), bucket_test_wizard_retrieve_id(), and media_cache_item_populate_from_astdb().
struct ast_bucket_file * ast_bucket_file_clone | ( | struct ast_bucket_file * | file | ) |
Clone a bucket file.
This will create a copy of the passed in ast_bucket_file
structure. While all properties of the ast_bucket_file
structure are copied, any metadata in the original structure simply has its reference count increased. Note that this copies the structure, not the underlying file.
file | The bucket file to clone |
non-NULL | success |
NULL | failure |
ast_bucket_file
instances are immutable Definition at line 810 of file bucket.c.
References ast_sorcery_copy(), bucket_sorcery, and make_ari_stubs::file.
Referenced by ast_media_cache_create_or_update(), and AST_TEST_DEFINE().
struct ast_bucket_file * ast_bucket_file_copy | ( | struct ast_bucket_file * | file, |
const char * | uri | ||
) |
Copy a bucket file to a new URI.
file | The source bucket file |
uri | The new URI |
non-NULL | success |
NULL | failure |
Definition at line 791 of file bucket.c.
References ao2_cleanup, ao2_container_clone, ao2_ref, ast_bucket_file_alloc(), bucket_copy(), copy(), make_ari_stubs::file, NULL, and RAII_VAR.
Referenced by AST_TEST_DEFINE().
int ast_bucket_file_create | ( | struct ast_bucket_file * | file | ) |
Create a new bucket file in backend storage.
file | The bucket file |
0 | success |
-1 | failure |
Definition at line 725 of file bucket.c.
References ast_sorcery_create(), bucket_sorcery, and make_ari_stubs::file.
Referenced by ast_media_cache_create_or_update(), and AST_TEST_DEFINE().
int ast_bucket_file_delete | ( | struct ast_bucket_file * | file | ) |
Delete a bucket file from backend storage.
file | The bucket file |
0 | success |
-1 | failure |
Definition at line 844 of file bucket.c.
References ast_sorcery_delete(), bucket_sorcery, and make_ari_stubs::file.
Referenced by ast_media_cache_delete(), ast_media_cache_retrieve(), AST_TEST_DEFINE(), and bucket_file_cleanup().
int ast_bucket_file_is_stale | ( | struct ast_bucket_file * | file | ) |
Retrieve whether or not the backing datastore views the bucket file as stale.
This function will ask whatever data storage backs the bucket file's schema type if the current instance of the object is stale. It will not update the bucket file object itself, as said objects are immutable. If the caller of this function would like to update the object, it should perform a retrieve operation.
file | The bucket file object to check |
0 | if file is not stale |
1 | if file is stale |
Definition at line 824 of file bucket.c.
References ast_sorcery_is_stale(), bucket_sorcery, and make_ari_stubs::file.
Referenced by ast_media_cache_retrieve(), and AST_TEST_DEFINE().
struct ast_json * ast_bucket_file_json | ( | const struct ast_bucket_file * | file | ) |
Get a JSON representation of a bucket file.
file | The specific bucket file |
non-NULL | success |
NULL | failure |
Definition at line 849 of file bucket.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_json_object_create(), ast_json_object_set(), ast_json_ref(), ast_json_string_create(), ast_json_unref(), ast_sorcery_object_get_id(), ast_sorcery_objectset_json_create(), bucket_sorcery, make_ari_stubs::file, id, ast_bucket_metadata::name, NULL, RAII_VAR, ast_bucket_metadata::value, and value.
Referenced by AST_TEST_DEFINE().
void ast_bucket_file_metadata_callback | ( | struct ast_bucket_file * | file, |
ao2_callback_fn | cb, | ||
void * | arg | ||
) |
Execute a callback function on the metadata associated with a file.
file | The bucket file |
cb | An ao2 callback function that will be called with each ast_bucket_metadata associated with file |
arg | An optional argument to pass to cb |
Definition at line 364 of file bucket.c.
References ao2_callback, and make_ari_stubs::file.
Referenced by media_cache_item_sync_to_astdb().
struct ast_bucket_metadata * ast_bucket_file_metadata_get | ( | struct ast_bucket_file * | file, |
const char * | name | ||
) |
Retrieve a metadata attribute from a file.
file | The bucket file |
name | Name of the attribute |
non-NULL | if found |
NULL | if not found |
Definition at line 359 of file bucket.c.
References ao2_find, make_ari_stubs::file, name, and OBJ_KEY.
Referenced by AST_TEST_DEFINE(), bucket_file_always_revalidate(), bucket_file_expired(), bucket_file_set_expiration(), bucket_file_update_path(), bucket_http_wizard_is_stale(), and file_extension_from_content_type().
int ast_bucket_file_metadata_set | ( | struct ast_bucket_file * | file, |
const char * | name, | ||
const char * | value | ||
) |
Set a metadata attribute on a file to a specific value.
file | The bucket file |
name | Name of the attribute |
value | Value of the attribute |
0 | success |
-1 | failure |
Definition at line 334 of file bucket.c.
References ao2_cleanup, ao2_find, ao2_link, bucket_metadata_alloc(), make_ari_stubs::file, name, OBJ_KEY, OBJ_NODATA, OBJ_UNLINK, RAII_VAR, and value.
Referenced by ast_media_cache_create_or_update(), AST_TEST_DEFINE(), bucket_file_set_expiration(), bucket_file_set_extension(), curl_header_callback(), and media_cache_item_populate_from_astdb().
int ast_bucket_file_metadata_unset | ( | struct ast_bucket_file * | file, |
const char * | name | ||
) |
Unset a specific metadata attribute on a file.
file | The bucket file |
name | Name of the attribute |
0 | success |
-1 | failure |
Definition at line 348 of file bucket.c.
References ao2_cleanup, ao2_find, make_ari_stubs::file, name, OBJ_KEY, OBJ_UNLINK, and RAII_VAR.
Referenced by AST_TEST_DEFINE().
int ast_bucket_file_observer_add | ( | const struct ast_sorcery_observer * | callbacks | ) |
Add an observer for bucket file creation and deletion operations.
callbacks | Implementation of the sorcery observer interface |
0 | success |
-1 | failure |
Definition at line 829 of file bucket.c.
References ast_sorcery_observer_add(), bucket_sorcery, and callbacks.
void ast_bucket_file_observer_remove | ( | const struct ast_sorcery_observer * | callbacks | ) |
Remove an observer from bucket file creation and deletion.
callbacks | Implementation of the sorcery observer interface |
Definition at line 834 of file bucket.c.
References ast_sorcery_observer_remove(), bucket_sorcery, and callbacks.
struct ast_bucket_file * ast_bucket_file_retrieve | ( | const char * | uri | ) |
Retrieve a bucket file.
uri | Complete URI of the bucket file |
non-NULL | if found |
NULL | if not found |
Definition at line 815 of file bucket.c.
References ast_sorcery_retrieve_by_id(), ast_strlen_zero(), bucket_sorcery, and NULL.
Referenced by ast_media_cache_exists(), ast_media_cache_retrieve(), and AST_TEST_DEFINE().
int ast_bucket_file_temporary_create | ( | struct ast_bucket_file * | file | ) |
Common file snapshot creation callback for creating a temporary file.
file | Pointer to the file snapshot |
0 | success |
-1 | failure |
Definition at line 899 of file bucket.c.
References ast_config_AST_CACHE_DIR, and make_ari_stubs::file.
Referenced by AST_TEST_DEFINE(), bucket_http_test_wizard_retrieve_id(), bucket_http_wizard_retrieve_id(), and load_module().
void ast_bucket_file_temporary_destroy | ( | struct ast_bucket_file * | file | ) |
Common file snapshot destruction callback for deleting a temporary file.
file | Pointer to the file snapshot |
Definition at line 914 of file bucket.c.
References ast_strlen_zero(), and make_ari_stubs::file.
Referenced by load_module().
int ast_bucket_file_update | ( | struct ast_bucket_file * | file | ) |
Update an existing bucket file in backend storage.
file | The bucket file |
0 | success |
-1 | failure |
Definition at line 839 of file bucket.c.
References ast_sorcery_update(), bucket_sorcery, and make_ari_stubs::file.
Referenced by AST_TEST_DEFINE().
int ast_bucket_init | ( | void | ) |
Initialize bucket support.
0 | success |
-1 | failure |
Definition at line 954 of file bucket.c.
References __ast_sorcery_wizard_register(), AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_container_alloc_hash, ast_log, ast_register_cleanup(), ast_sorcery_apply_default, AST_SORCERY_APPLY_FAIL, ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_register, ast_sorcery_object_set_copy_handler(), ast_sorcery_open, bucket_alloc(), bucket_cleanup(), bucket_copy_handler(), bucket_file_alloc(), bucket_file_copy_handler(), bucket_file_wizard, bucket_sorcery, bucket_wizard, FLDSET, LOG_ERROR, NULL, OPT_STRINGFIELD_T, SCHEME_BUCKETS, schemes, STRFLDSET, timeval_str2struct(), and timeval_struct2str().
Referenced by asterisk_daemon().
int ast_bucket_is_stale | ( | struct ast_bucket * | bucket | ) |
Retrieve whether or not the backing datastore views the bucket as stale.
This function will ask whatever data storage backs the bucket's schema type if the current instance of the object is stale. It will not update the bucket object itself, as said objects are immutable. If the caller of this function would like to update the object, it should perform a retrieve operation.
bucket | The bucket object to check |
0 | if bucket is not stale |
1 | if bucket is stale |
Definition at line 524 of file bucket.c.
References ast_sorcery_is_stale(), and bucket_sorcery.
Referenced by AST_TEST_DEFINE().
struct ast_json * ast_bucket_json | ( | const struct ast_bucket * | bucket | ) |
Get a JSON representation of a bucket.
bucket | The specific bucket |
non-NULL | success |
NULL | failure |
Definition at line 544 of file bucket.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_json_array_append(), ast_json_array_create(), ast_json_object_set(), ast_json_ref(), ast_json_string_create(), ast_json_unref(), ast_sorcery_object_get_id(), ast_sorcery_objectset_json_create(), bucket_sorcery, ast_bucket::buckets, ast_bucket::files, id, NULL, and RAII_VAR.
Referenced by AST_TEST_DEFINE().
int ast_bucket_observer_add | ( | const struct ast_sorcery_observer * | callbacks | ) |
Add an observer for bucket creation and deletion operations.
callbacks | Implementation of the sorcery observer interface |
0 | success |
-1 | failure |
Definition at line 529 of file bucket.c.
References ast_sorcery_observer_add(), bucket_sorcery, and callbacks.
void ast_bucket_observer_remove | ( | const struct ast_sorcery_observer * | callbacks | ) |
Remove an observer from bucket creation and deletion.
callbacks | Implementation of the sorcery observer interface |
Definition at line 534 of file bucket.c.
References ast_sorcery_observer_remove(), bucket_sorcery, and callbacks.
struct ast_bucket * ast_bucket_retrieve | ( | const char * | uri | ) |
Retrieve information about a bucket.
uri | Complete URI of the bucket |
non-NULL | if found |
NULL | if not found |
Definition at line 515 of file bucket.c.
References ast_sorcery_retrieve_by_id(), ast_strlen_zero(), bucket_sorcery, and NULL.
Referenced by AST_TEST_DEFINE().
|
static |
Allocator for buckets.
Definition at line 402 of file bucket.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, ao2_container_alloc_rbtree, ao2_ref, ast_sorcery_generic_alloc(), ast_string_field_init, bucket_destroy(), bucket_rbtree_str_sort_cmp(), NULL, and RAII_VAR.
Referenced by ast_bucket_init(), load_module(), and unload_module().
|
static |
Hashing function for scheme container.
Comparison function for scheme container
Cleanup function for graceful shutdowns
Definition at line 928 of file bucket.c.
References ao2_cleanup, ast_sorcery_unref, ast_sorcery_wizard_unregister(), bucket_file_wizard, bucket_sorcery, bucket_wizard, NULL, and schemes.
Referenced by ast_bucket_init().
|
static |
Copy a file, shamelessly taken from file.c.
Definition at line 731 of file bucket.c.
References AST_FILE_MODE, ast_log, buf, errno, len(), and LOG_WARNING.
Referenced by ast_bucket_file_copy().
|
static |
Definition at line 497 of file bucket.c.
References ao2_bump, ast_string_field_set, ast_bucket::created, ast_bucket::modified, ast_bucket::scheme, and ast_bucket::scheme_impl.
Referenced by ast_bucket_init().
|
static |
Destructor for buckets.
Definition at line 371 of file bucket.c.
References ao2_cleanup, ast_string_field_free_memory, ast_bucket::buckets, ast_bucket::files, and ast_bucket::scheme_impl.
Referenced by bucket_alloc().
|
static |
Allocator for bucket files.
Definition at line 640 of file bucket.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_hash, ao2_ref, ast_sorcery_generic_alloc(), ast_string_field_init, bucket_file_destroy(), make_ari_stubs::file, METADATA_BUCKETS, NULL, and RAII_VAR.
Referenced by ast_bucket_init(), load_module(), and unload_module().
|
static |
Definition at line 772 of file bucket.c.
References ao2_bump, ao2_container_clone, ast_string_field_set, ast_bucket_file::created, ast_bucket_file::metadata, ast_bucket_file::modified, ast_bucket_file::path, ast_bucket_file::scheme, and ast_bucket_file::scheme_impl.
Referenced by ast_bucket_init().
|
static |
Hashing function for file metadata.
Comparison function for file metadata
Destructor for bucket files
Definition at line 627 of file bucket.c.
References ao2_cleanup, and make_ari_stubs::file.
Referenced by bucket_file_alloc().
|
static |
Callback function for creating a bucket file.
Definition at line 187 of file bucket.c.
References make_ari_stubs::file, and sorcery.
|
static |
Callback function for deleting a bucket file.
Definition at line 248 of file bucket.c.
References make_ari_stubs::file, and sorcery.
|
static |
Callback function for determining if a bucket is stale.
Definition at line 256 of file bucket.c.
References make_ari_stubs::file, and sorcery.
|
static |
Callback function for retrieving a bucket file.
Definition at line 195 of file bucket.c.
References ao2_cleanup, ao2_find, ast_alloca, ast_copy_string(), ast_strdupa, len(), lock, NULL, OBJ_KEY, OBJ_NOLOCK, RAII_VAR, ast_bucket_file::scheme, schemes, SCOPED_AO2RDLOCK, sorcery, state, tmp(), and type.
|
static |
Callback function for updating a bucket file.
Definition at line 240 of file bucket.c.
References make_ari_stubs::file, and sorcery.
|
static |
Allocator for metadata attributes.
Definition at line 316 of file bucket.c.
References ao2_alloc, ast_bucket_metadata::data, name, ast_bucket_metadata::name, NULL, ast_bucket_metadata::value, and value.
Referenced by ast_bucket_file_metadata_set().
|
static |
Sorting function for red black tree string container.
Definition at line 382 of file bucket.c.
References OBJ_KEY, OBJ_PARTIAL_KEY, and OBJ_POINTER.
Referenced by bucket_alloc().
|
static |
Callback function for creating a bucket.
Definition at line 105 of file bucket.c.
References ast_bucket_scheme::bucket, ast_sorcery_wizard::create, ast_bucket::scheme_impl, and sorcery.
|
static |
Callback function for deleting a bucket.
Definition at line 158 of file bucket.c.
References ast_bucket_scheme::bucket, ast_sorcery_wizard::delete, ast_bucket::scheme_impl, and sorcery.
|
static |
Callback function for determining if a bucket is stale.
Definition at line 166 of file bucket.c.
References ast_bucket_scheme::bucket, ast_sorcery_wizard::is_stale, ast_bucket::scheme_impl, and sorcery.
|
static |
Callback function for retrieving a bucket.
Definition at line 113 of file bucket.c.
References ao2_cleanup, ao2_find, ast_alloca, ast_copy_string(), ast_strdupa, len(), lock, NULL, OBJ_KEY, OBJ_NOLOCK, RAII_VAR, ast_bucket::scheme, schemes, SCOPED_AO2RDLOCK, sorcery, state, tmp(), and type.
|
static |
Custom handler for translating from a string timeval to actual structure.
Definition at line 940 of file bucket.c.
References aco_option_get_argument(), ast_get_timeval(), ast_tv(), NULL, and var.
Referenced by ast_bucket_init().
|
static |
Custom handler for translating from an actual structure timeval to string.
Definition at line 947 of file bucket.c.
References args, ast_asprintf, and buf.
Referenced by ast_bucket_init().
|
static |
Intermediary file wizard.
Definition at line 268 of file bucket.c.
Referenced by ast_bucket_init(), and bucket_cleanup().
|
static |
Sorcery instance for all bucket operations.
Definition at line 85 of file bucket.c.
Referenced by ast_bucket_alloc(), ast_bucket_clone(), ast_bucket_create(), ast_bucket_delete(), ast_bucket_file_alloc(), ast_bucket_file_clone(), ast_bucket_file_create(), ast_bucket_file_delete(), ast_bucket_file_is_stale(), ast_bucket_file_json(), ast_bucket_file_observer_add(), ast_bucket_file_observer_remove(), ast_bucket_file_retrieve(), ast_bucket_file_update(), ast_bucket_init(), ast_bucket_is_stale(), ast_bucket_json(), ast_bucket_observer_add(), ast_bucket_observer_remove(), ast_bucket_retrieve(), and bucket_cleanup().
|
static |
Intermediary bucket wizard.
Definition at line 178 of file bucket.c.
Referenced by ast_bucket_init(), and bucket_cleanup().
|
static |
Container of registered schemes.
Definition at line 88 of file bucket.c.
Referenced by __ast_bucket_scheme_register(), ast_bucket_alloc(), ast_bucket_file_alloc(), ast_bucket_init(), bucket_cleanup(), bucket_file_wizard_retrieve(), and bucket_wizard_retrieve().