mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
main/bucket: Add a callback function for ast_bucket_file objects
This patch adds a new function to the bucket API for ast_bucket_file objects, ast_bucket_file_metadata_callback. It will call ao2_callback on the ast_bucket_file's ao2_container of metadata, calling the provided ao2_callback_fn callback on each piece of metadata associated with the file. This is particularly useful when a bucket backend has added metadata, and a higher level API wants to be aware of/access said metadata, without knowing for sure what the key is. Change-Id: I96f6757717f47b650df91a437f7df16406227466
This commit is contained in:
@@ -362,6 +362,12 @@ struct ast_bucket_metadata *ast_bucket_file_metadata_get(struct ast_bucket_file
|
||||
return ao2_find(file->metadata, name, OBJ_KEY);
|
||||
}
|
||||
|
||||
void ast_bucket_file_metadata_callback(struct ast_bucket_file *file, ao2_callback_fn cb, void *arg)
|
||||
{
|
||||
ao2_callback(file->metadata, 0, cb, arg);
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Destructor for buckets */
|
||||
static void bucket_destroy(void *obj)
|
||||
{
|
||||
|
Reference in New Issue
Block a user