[asterisk-dev] [Code Review] 2672: Split caching out from the stasis_caching_topic

David Lee reviewboard at asterisk.org
Mon Jul 29 17:30:40 CDT 2013



> On July 29, 2013, 4:09 p.m., opticron wrote:
> > /trunk/include/asterisk/stasis_endpoints.h, line 161
> > <https://reviewboard.asterisk.org/r/2672/diff/3/?file=42613#file42613line161>
> >
> >     Should this be marked internal?

Yes. It needs to be public to be shared between endpoints.c and
stasis_endpoints.c, but I don't intend on anyone else using it. I'll
update the comment to clarify.


- David


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2672/#review9239
-----------------------------------------------------------


On July 29, 2013, 5:24 p.m., David Lee wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2672/
> -----------------------------------------------------------
> 
> (Updated July 29, 2013, 5:24 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-22002
>     https://issues.asterisk.org/jira/browse/ASTERISK-22002
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> In working with res_stasis, I discovered a significant limitation to
> the current structure of stasis_caching_topics: you cannot subscribe
> to cache updates for a single channel/bridge/endpoint/etc.
> 
> To address this, this patch splits the cache away from the
> stasis_caching_topic, making it a first class object. The stasis_cache
> object is shared amongst individual stasis_caching_topics that are
> created per channel/endpoint/etc. These are still forwarded to global
> whatever_all_cached topics, so their use from most of the code does
> not change.
> 
> In making these changes, I noticed that we frequently used a similar
> pattern for bridges, endpoints and channels:
> 
>      single_topic  ---------------->  all_topic
>            ^
>            |
>      single_topic_cached  ----+---->  all_topic_cached
>                               |
>                               +---->  cache
> 
> This pattern was extracted as the 'Stasis Caching Pattern', defined in
> stasis_caching_pattern.h. This avoids a lot of duplicate code between
> the different domain objects.
> 
> Since the cache is now disassociated from its upstream caching topics,
> this also necessitated a change to how the 'guaranteed' flag worked
> for retrieving from a cache. The code for handling the caching
> guarantee was extracted into a 'stasis_topic_wait' function, which
> works for any stasis_topic.
> 
> 
> Diffs
> -----
> 
>   /trunk/apps/app_meetme.c 395718 
>   /trunk/apps/app_voicemail.c 395718 
>   /trunk/apps/confbridge/confbridge_manager.c 395718 
>   /trunk/channels/chan_dahdi.c 395718 
>   /trunk/channels/chan_gulp.c 395718 
>   /trunk/channels/chan_iax2.c 395718 
>   /trunk/channels/chan_mgcp.c 395718 
>   /trunk/channels/chan_sip.c 395718 
>   /trunk/channels/chan_unistim.c 395718 
>   /trunk/channels/sig_pri.c 395718 
>   /trunk/include/asterisk/app.h 395718 
>   /trunk/include/asterisk/bridge.h 395718 
>   /trunk/include/asterisk/channel.h 395718 
>   /trunk/include/asterisk/channel_internal.h 395718 
>   /trunk/include/asterisk/devicestate.h 395718 
>   /trunk/include/asterisk/presencestate.h 395718 
>   /trunk/include/asterisk/stasis.h 395718 
>   /trunk/include/asterisk/stasis_bridges.h 395718 
>   /trunk/include/asterisk/stasis_cache_pattern.h PRE-CREATION 
>   /trunk/include/asterisk/stasis_channels.h 395718 
>   /trunk/include/asterisk/stasis_endpoints.h 395718 
>   /trunk/main/app.c 395718 
>   /trunk/main/bridge.c 395718 
>   /trunk/main/cdr.c 395718 
>   /trunk/main/cel.c 395718 
>   /trunk/main/channel_internal_api.c 395718 
>   /trunk/main/cli.c 395718 
>   /trunk/main/devicestate.c 395718 
>   /trunk/main/endpoints.c 395718 
>   /trunk/main/manager.c 395718 
>   /trunk/main/manager_bridges.c 395718 
>   /trunk/main/manager_channels.c 395718 
>   /trunk/main/manager_endpoints.c 395718 
>   /trunk/main/pbx.c 395718 
>   /trunk/main/presencestate.c 395718 
>   /trunk/main/stasis.c 395718 
>   /trunk/main/stasis_bridges.c 395718 
>   /trunk/main/stasis_cache.c 395718 
>   /trunk/main/stasis_cache_pattern.c PRE-CREATION 
>   /trunk/main/stasis_channels.c 395718 
>   /trunk/main/stasis_endpoints.c 395718 
>   /trunk/main/stasis_wait.c PRE-CREATION 
>   /trunk/res/ari/resource_bridges.c 395718 
>   /trunk/res/ari/resource_channels.c 395718 
>   /trunk/res/ari/resource_endpoints.c 395718 
>   /trunk/res/res_agi.c 395718 
>   /trunk/res/res_chan_stats.c 395718 
>   /trunk/res/res_jabber.c 395718 
>   /trunk/res/res_sip_mwi.c 395718 
>   /trunk/res/res_stasis.c 395718 
>   /trunk/res/res_xmpp.c 395718 
>   /trunk/res/stasis/control.c 395718 
>   /trunk/tests/test_cel.c 395718 
>   /trunk/tests/test_devicestate.c 395718 
>   /trunk/tests/test_stasis.c 395718 
>   /trunk/tests/test_stasis_endpoints.c 395718 
> 
> Diff: https://reviewboard.asterisk.org/r/2672/diff/
> 
> 
> Testing
> -------
> 
> Tests pass.
> 
> 
> Thanks,
> 
> David Lee
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130729/5d06c829/attachment.htm>


More information about the asterisk-dev mailing list