<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/2672/">https://reviewboard.asterisk.org/r/2672/</a>
     </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On July 29th, 2013, 4:09 p.m. CDT, <b>opticron</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://reviewboard.asterisk.org/r/2672/diff/3/?file=42613#file42613line161" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/include/asterisk/stasis_endpoints.h</a>
    <span style="font-weight: normal;">

     (Diff revision 3)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">161</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> * \internal</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Should this be marked internal?</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yes. It needs to be public to be shared between endpoints.c and
stasis_endpoints.c, but I don&#39;t intend on anyone else using it. I&#39;ll
update the comment to clarify.</pre>
<br />




<p>- David</p>


<br />
<p>On July 29th, 2013, 5:24 p.m. CDT, David Lee wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By David Lee.</div>


<p style="color: grey;"><i>Updated July 29, 2013, 5:24 p.m.</i></p>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-22002">ASTERISK-22002</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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  ----------------&gt;  all_topic
           ^
           |
     single_topic_cached  ----+----&gt;  all_topic_cached
                              |
                              +----&gt;  cache

This pattern was extracted as the &#39;Stasis Caching Pattern&#39;, 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 &#39;guaranteed&#39; flag worked
for retrieving from a cache. The code for handling the caching
guarantee was extracted into a &#39;stasis_topic_wait&#39; function, which
works for any stasis_topic.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Tests pass.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/trunk/apps/app_meetme.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/apps/app_voicemail.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/apps/confbridge/confbridge_manager.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/channels/chan_dahdi.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/channels/chan_gulp.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/channels/chan_iax2.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/channels/chan_mgcp.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/channels/chan_sip.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/channels/chan_unistim.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/channels/sig_pri.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/app.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/bridge.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/channel.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/channel_internal.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/devicestate.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/presencestate.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/stasis.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/stasis_bridges.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/stasis_cache_pattern.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/trunk/include/asterisk/stasis_channels.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/include/asterisk/stasis_endpoints.h <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/app.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/bridge.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/cdr.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/cel.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/channel_internal_api.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/cli.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/devicestate.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/endpoints.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/manager.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/manager_bridges.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/manager_channels.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/manager_endpoints.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/pbx.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/presencestate.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/stasis.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/stasis_bridges.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/stasis_cache.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/stasis_cache_pattern.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/trunk/main/stasis_channels.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/stasis_endpoints.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/main/stasis_wait.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/trunk/res/ari/resource_bridges.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/res/ari/resource_channels.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/res/ari/resource_endpoints.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/res/res_agi.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/res/res_chan_stats.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/res/res_jabber.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/res/res_sip_mwi.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/res/res_stasis.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/res/res_xmpp.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/res/stasis/control.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/tests/test_cel.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/tests/test_devicestate.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/tests/test_stasis.c <span style="color: grey">(395718)</span></li>

 <li>/trunk/tests/test_stasis_endpoints.c <span style="color: grey">(395718)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/2672/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>