diff options
author | Richard Mudgett <rmudgett@digium.com> | 2014-03-07 20:41:13 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2014-03-07 20:41:13 +0000 |
commit | 4ad1245cb5fd9ea0f54c866448ad5c18bcb84fa5 (patch) | |
tree | cbf0d2bd6a65e63d1d9a37193754d6476770ad54 /main/app.c | |
parent | ecbd0527417115936b06b57be1a07b3607e31a85 (diff) |
stasis cache: Enhance to keep track of an item from different entities.
A stasis cache entry now contains more than a single message/snapshot. It
contains messages/snapshots for the local entity as well as any remote
entities that post to the cached item. In addition callbacks can be
supplied when the cache is created to compute and post the aggregate
message/snapshot representing all entities stored in the cache entry.
* All stasis messages now have an eid to indicate what entity posted it.
* The stasis cache enhancements allow device state to cache and aggregate
the device states from local and remote entities in a single operation.
The cached aggregate device state is available immediately after it is
posted to the stasis bus. This improves performance by eliminating a
cache dump and associated ao2 container traversals to calculate the
aggregate state.
(closes issue ASTERISK-23204)
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/3281/
........
Merged revisions 410184 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/app.c')
-rw-r--r-- | main/app.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/main/app.c b/main/app.c index 6e1a176c6..ce0d16cdd 100644 --- a/main/app.c +++ b/main/app.c @@ -2821,7 +2821,6 @@ struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context) return mwi_state; } - int ast_publish_mwi_state_full( const char *mailbox, const char *context, @@ -2857,10 +2856,19 @@ int ast_publish_mwi_state_full( if (eid) { mwi_state->eid = *eid; } else { - ast_set_default_eid(&mwi_state->eid); + mwi_state->eid = ast_eid_default; } - message = stasis_message_create(ast_mwi_state_type(), mwi_state); + /* + * As far as stasis is concerned, all MWI events are internal. + * + * We may in the future want to make MWI aggregate internal/external + * message counts similar to how device state aggregates state. + */ + message = stasis_message_create_full(ast_mwi_state_type(), mwi_state, &ast_eid_default); + if (!message) { + return -1; + } mailbox_specific_topic = ast_mwi_topic(mwi_state->uniqueid); if (!mailbox_specific_topic) { @@ -2911,6 +2919,7 @@ struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state, ao2_ref(obj->mwi_state, +1); obj->blob = ast_json_ref(blob); + /* This is not a normal MWI event. Only used by the MinivmNotify app. */ msg = stasis_message_create(message_type, obj); if (!msg) { return NULL; |