34#ifndef _ASTERISK_BUCKET_H
35#define _ASTERISK_BUCKET_H
37#if defined(__cplusplus) || defined(c_plusplus)
137#define ast_bucket_scheme_register(name, bucket, file, create_cb, destroy_cb) __ast_bucket_scheme_register(name, bucket, file, create_cb, destroy_cb, AST_MODULE_SELF)
473#if defined(__cplusplus) || defined(c_plusplus)
int() ao2_callback_fn(void *obj, void *arg, int flags)
Type of a generic callback function.
struct ast_bucket * ast_bucket_alloc(const char *uri)
Allocate a new bucket.
struct ast_bucket_file * ast_bucket_file_clone(struct ast_bucket_file *file)
Clone a bucket file.
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.
struct ast_bucket_file * ast_bucket_file_alloc(const char *uri)
Allocate a new bucket file.
void ast_bucket_file_observer_remove(const struct ast_sorcery_observer *callbacks)
Remove an observer from bucket file creation and deletion.
int ast_bucket_file_temporary_create(struct ast_bucket_file *file)
Common file snapshot creation callback for creating a temporary file.
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.
int ast_bucket_create(struct ast_bucket *bucket)
Create a new bucket in backend storage.
int ast_bucket_file_create(struct ast_bucket_file *file)
Create a new bucket file in backend storage.
void(* bucket_file_destroy_cb)(struct ast_bucket_file *file)
A callback function invoked when destroying a file snapshot.
int ast_bucket_file_metadata_unset(struct ast_bucket_file *file, const char *name)
Unset a specific metadata attribute on a file.
int ast_bucket_file_update(struct ast_bucket_file *file)
Update an existing bucket file in backend storage.
struct ast_bucket_metadata * ast_bucket_file_metadata_get(struct ast_bucket_file *file, const char *name)
Retrieve a metadata attribute from a file.
int ast_bucket_file_observer_add(const struct ast_sorcery_observer *callbacks)
Add an observer for bucket file creation and deletion operations.
struct ast_bucket_file * ast_bucket_file_copy(struct ast_bucket_file *file, const char *uri)
Copy a bucket file to a new URI.
int ast_bucket_is_stale(struct ast_bucket *bucket)
Retrieve whether or not the backing datastore views the bucket as stale.
struct ast_bucket_file * ast_bucket_file_retrieve(const char *uri)
Retrieve a bucket file.
void ast_bucket_observer_remove(const struct ast_sorcery_observer *callbacks)
Remove an observer from bucket creation and deletion.
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.
struct ast_bucket * ast_bucket_retrieve(const char *uri)
Retrieve information about a bucket.
int ast_bucket_file_delete(struct ast_bucket_file *file)
Delete a bucket file from backend storage.
struct ast_json * ast_bucket_json(const struct ast_bucket *bucket)
Get a JSON representation of a bucket.
struct ast_json * ast_bucket_file_json(const struct ast_bucket_file *file)
Get a JSON representation of a bucket file.
struct ast_bucket * ast_bucket_clone(struct ast_bucket *bucket)
Clone a bucket.
void ast_bucket_file_temporary_destroy(struct ast_bucket_file *file)
Common file snapshot destruction callback for deleting a temporary file.
int ast_bucket_observer_add(const struct ast_sorcery_observer *callbacks)
Add an observer for bucket creation and deletion operations.
int ast_bucket_init(void)
Initialize bucket support.
int(* bucket_file_create_cb)(struct ast_bucket_file *file)
A callback function invoked when creating a file snapshot.
int ast_bucket_file_is_stale(struct ast_bucket_file *file)
Retrieve whether or not the backing datastore views the bucket file as stale.
int ast_bucket_delete(struct ast_bucket *bucket)
Delete a bucket from backend storage.
Sorcery Data Access Layer API.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
Bucket file structure, contains reference to file and information about it.
SORCERY_OBJECT(details)
Sorcery object information.
struct timeval modified
When this file was last modified.
struct timeval created
When this file was created.
const ast_string_field scheme
struct ao2_container * metadata
Container of metadata attributes about file.
char path[PATH_MAX]
Local path to this file.
struct ast_bucket_scheme * scheme_impl
Scheme implementation in use.
Structure for available schemes.
Bucket structure, contains other buckets and files.
struct ao2_container * buckets
Container of string URIs of buckets within this bucket.
SORCERY_OBJECT(details)
Sorcery object information.
struct timeval modified
When this bucket was last modified.
struct timeval created
When this bucket was created.
struct ao2_container * files
Container of string URIs of files within this bucket.
const ast_string_field scheme
struct ast_bucket_scheme * scheme_impl
Scheme implementation in use.
Abstract JSON element (object, array, string, int, ...).
Interface for a sorcery object type observer.
Interface for a sorcery wizard.