Merge "sorcery: Add support for object staleness"

This commit is contained in:
Matt Jordan
2015-07-11 10:46:52 -05:00
committed by Gerrit Code Review
3 changed files with 156 additions and 0 deletions

View File

@@ -312,6 +312,9 @@ struct ast_sorcery_wizard {
/*! \brief Callback for closing a wizard */
void (*close)(void *data);
/* \brief Callback for whether or not the wizard believes the object is stale */
int (*is_stale)(const struct ast_sorcery *sorcery, void *data, void *object);
};
/*! \brief Interface for a sorcery object type observer */
@@ -1201,6 +1204,20 @@ int ast_sorcery_update(const struct ast_sorcery *sorcery, void *object);
*/
int ast_sorcery_delete(const struct ast_sorcery *sorcery, void *object);
/*!
* \brief Determine if a sorcery object is stale with respect to its backing datastore
* \since 14.0.0
*
* This function will query the wizard(s) backing the particular sorcery object to
* determine if the in-memory object is now stale. No action is taken to update
* the object. Callers of this function may use one of the ast_sorcery_retrieve
* functions to obtain a new instance of the object if desired.
*
* \retval 0 the object is not stale
* \retval 1 the object is stale
*/
int ast_sorcery_is_stale(const struct ast_sorcery *sorcery, void *object);
/*!
* \brief Decrease the reference count of a sorcery structure
*
@@ -1217,6 +1234,16 @@ void ast_sorcery_unref(struct ast_sorcery *sorcery);
*/
const char *ast_sorcery_object_get_id(const void *object);
/*!
* \since 14.0.0
* \brief Get when the socery object was created
*
* \param object Pointer to a sorcery object
*
* \retval The time when the object was created
*/
const struct timeval ast_sorcery_object_get_created(const void *object);
/*!
* \brief Get the type of a sorcery object
*