[asterisk-commits] dlee: branch dlee/stasis-cache-split r393889 - in /team/dlee/stasis-cache-spl...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 9 12:10:53 CDT 2013
Author: dlee
Date: Tue Jul 9 12:10:50 2013
New Revision: 393889
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393889
Log:
Incremental checkin
Modified:
team/dlee/stasis-cache-split/apps/app_meetme.c
team/dlee/stasis-cache-split/apps/app_voicemail.c
team/dlee/stasis-cache-split/apps/confbridge/confbridge_manager.c
team/dlee/stasis-cache-split/channels/chan_dahdi.c
team/dlee/stasis-cache-split/channels/chan_gulp.c
team/dlee/stasis-cache-split/channels/chan_iax2.c
team/dlee/stasis-cache-split/channels/chan_mgcp.c
team/dlee/stasis-cache-split/channels/chan_sip.c
team/dlee/stasis-cache-split/channels/chan_unistim.c
team/dlee/stasis-cache-split/channels/sig_pri.c
team/dlee/stasis-cache-split/include/asterisk/app.h
team/dlee/stasis-cache-split/include/asterisk/stasis_bridging.h
team/dlee/stasis-cache-split/include/asterisk/stasis_channels.h
team/dlee/stasis-cache-split/include/asterisk/stasis_endpoints.h
team/dlee/stasis-cache-split/main/app.c
team/dlee/stasis-cache-split/main/cdr.c
team/dlee/stasis-cache-split/main/cel.c
team/dlee/stasis-cache-split/main/manager_channels.c
team/dlee/stasis-cache-split/main/manager_endpoints.c
team/dlee/stasis-cache-split/main/stasis_endpoints.c
team/dlee/stasis-cache-split/res/res_agi.c
team/dlee/stasis-cache-split/res/res_chan_stats.c
team/dlee/stasis-cache-split/res/res_sip_mwi.c
team/dlee/stasis-cache-split/res/res_stasis.c
team/dlee/stasis-cache-split/res/stasis/control.c
team/dlee/stasis-cache-split/res/stasis_http/resource_bridges.c
team/dlee/stasis-cache-split/res/stasis_http/resource_channels.c
team/dlee/stasis-cache-split/res/stasis_http/resource_endpoints.c
team/dlee/stasis-cache-split/tests/test_cel.c
team/dlee/stasis-cache-split/tests/test_stasis.c
team/dlee/stasis-cache-split/tests/test_stasis_endpoints.c
Modified: team/dlee/stasis-cache-split/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/apps/app_meetme.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/apps/app_meetme.c (original)
+++ team/dlee/stasis-cache-split/apps/app_meetme.c Tue Jul 9 12:10:50 2013
@@ -1156,7 +1156,7 @@
STASIS_MESSAGE_TYPE_INIT(meetme_talk_request_type);
meetme_event_message_router = stasis_message_router_create(
- stasis_caching_get_topic(ast_channel_topic_all_cached()));
+ ast_channel_cache());
if (!meetme_event_message_router) {
meetme_stasis_cleanup();
Modified: team/dlee/stasis-cache-split/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/apps/app_voicemail.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/apps/app_voicemail.c (original)
+++ team/dlee/stasis-cache-split/apps/app_voicemail.c Tue Jul 9 12:10:50 2013
@@ -12640,7 +12640,7 @@
mwi_sub_sub = stasis_subscribe(ast_mwi_topic_all(), mwi_event_cb, NULL);
if (mwi_sub_sub) {
- struct ao2_container *cached = stasis_cache_dump(ast_mwi_topic_cached(), stasis_subscription_change_type());
+ struct ao2_container *cached = stasis_cache_dump(ast_mwi_state_cache(), stasis_subscription_change_type());
if (cached) {
ao2_callback(cached, OBJ_MULTIPLE | OBJ_NODATA, dump_cache, NULL);
}
Modified: team/dlee/stasis-cache-split/apps/confbridge/confbridge_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/apps/confbridge/confbridge_manager.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/apps/confbridge/confbridge_manager.c (original)
+++ team/dlee/stasis-cache-split/apps/confbridge/confbridge_manager.c Tue Jul 9 12:10:50 2013
@@ -341,7 +341,7 @@
STASIS_MESSAGE_TYPE_INIT(confbridge_talking_type);
bridge_state_router = stasis_message_router_create(
- stasis_caching_get_topic(ast_bridge_topic_all_cached()));
+ ast_bridge_topic_all_cached());
if (!bridge_state_router) {
return -1;
@@ -412,7 +412,7 @@
}
channel_state_router = stasis_message_router_create(
- stasis_caching_get_topic(ast_channel_topic_all_cached()));
+ ast_channel_topic_all_cached());
if (!channel_state_router) {
manager_confbridge_shutdown();
Modified: team/dlee/stasis-cache-split/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/channels/chan_dahdi.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/channels/chan_dahdi.c (original)
+++ team/dlee/stasis-cache-split/channels/chan_dahdi.c Tue Jul 9 12:10:50 2013
@@ -5559,7 +5559,7 @@
}
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- mwi_message = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
+ mwi_message = stasis_cache_get(ast_mwi_state_cache(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (mwi_message) {
struct ast_mwi_state *mwi_state = stasis_message_data(mwi_message);
Modified: team/dlee/stasis-cache-split/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/channels/chan_gulp.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/channels/chan_gulp.c (original)
+++ team/dlee/stasis-cache-split/channels/chan_gulp.c Tue Jul 9 12:10:50 2013
@@ -790,7 +790,7 @@
RAII_VAR(struct ast_sip_endpoint *, endpoint, ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", data), ao2_cleanup);
enum ast_device_state state = AST_DEVICE_UNKNOWN;
RAII_VAR(struct ast_endpoint_snapshot *, endpoint_snapshot, NULL, ao2_cleanup);
- RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_cache *, cache, NULL, ao2_cleanup);
struct ast_devstate_aggregate aggregate;
int num, inuse = 0;
@@ -807,16 +807,16 @@
state = AST_DEVICE_NOT_INUSE;
}
- if (!endpoint_snapshot->num_channels || !(caching_topic = ast_channel_topic_all_cached())) {
+ if (!endpoint_snapshot->num_channels || !(cache = ast_channel_cache())) {
return state;
}
ast_devstate_aggregate_init(&aggregate);
- ao2_ref(caching_topic, +1);
+ ao2_ref(cache, +1);
for (num = 0; num < endpoint_snapshot->num_channels; num++) {
- RAII_VAR(struct stasis_message *, msg, stasis_cache_get_extended(caching_topic, ast_channel_snapshot_type(),
+ RAII_VAR(struct stasis_message *, msg, stasis_cache_get_extended(cache, ast_channel_snapshot_type(),
endpoint_snapshot->channel_ids[num], 1), ao2_cleanup);
struct ast_channel_snapshot *snapshot;
Modified: team/dlee/stasis-cache-split/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/channels/chan_iax2.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/channels/chan_iax2.c (original)
+++ team/dlee/stasis-cache-split/channels/chan_iax2.c Tue Jul 9 12:10:50 2013
@@ -8803,7 +8803,7 @@
}
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_state_cache(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (msg) {
struct ast_mwi_state *mwi_state = stasis_message_data(msg);
Modified: team/dlee/stasis-cache-split/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/channels/chan_mgcp.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/channels/chan_mgcp.c (original)
+++ team/dlee/stasis-cache-split/channels/chan_mgcp.c Tue Jul 9 12:10:50 2013
@@ -508,7 +508,7 @@
ast_str_set(&uniqueid, 0, "%s@%s", mbox, cntx);
- msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_state_cache(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (msg) {
struct ast_mwi_state *mwi_state = stasis_message_data(msg);
Modified: team/dlee/stasis-cache-split/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/channels/chan_sip.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/channels/chan_sip.c (original)
+++ team/dlee/stasis-cache-split/channels/chan_sip.c Tue Jul 9 12:10:50 2013
@@ -28371,7 +28371,7 @@
ast_str_reset(uniqueid);
ast_str_set(&uniqueid, 0, "%s@%s", mailbox->mailbox, S_OR(mailbox->context, "default"));
- msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_state_cache(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (!msg) {
continue;
}
Modified: team/dlee/stasis-cache-split/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/channels/chan_unistim.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/channels/chan_unistim.c (original)
+++ team/dlee/stasis-cache-split/channels/chan_unistim.c Tue Jul 9 12:10:50 2013
@@ -5502,7 +5502,7 @@
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_state_cache(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (msg) {
struct ast_mwi_state *mwi_state = stasis_message_data(msg);
Modified: team/dlee/stasis-cache-split/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/channels/sig_pri.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/channels/sig_pri.c (original)
+++ team/dlee/stasis-cache-split/channels/sig_pri.c Tue Jul 9 12:10:50 2013
@@ -8956,7 +8956,7 @@
ast_str_reset(uniqueid);
ast_str_set(&uniqueid, 0, "%s@%s", pri->mbox[idx].number, pri->mbox[idx].context);
- msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_state_cache(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (!msg) {
/* No cached event for this mailbox. */
continue;
Modified: team/dlee/stasis-cache-split/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/include/asterisk/app.h?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/include/asterisk/app.h (original)
+++ team/dlee/stasis-cache-split/include/asterisk/app.h Tue Jul 9 12:10:50 2013
@@ -1251,7 +1251,13 @@
* \retval NULL if it has not been allocated
* \since 12
*/
-struct stasis_caching_topic *ast_mwi_topic_cached(void);
+struct stasis_topic *ast_mwi_topic_cached(void);
+
+/*!
+ * \brief Backend cache for ast_mwi_topic_cached().
+ * \retval Cache of \ref ast_mwi_state.
+ */
+struct stasis_cache *ast_mwi_state_cache(void);
/*!
* \brief Get the \ref stasis message type for MWI messages
Modified: team/dlee/stasis-cache-split/include/asterisk/stasis_bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/include/asterisk/stasis_bridging.h?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/include/asterisk/stasis_bridging.h (original)
+++ team/dlee/stasis-cache-split/include/asterisk/stasis_bridging.h Tue Jul 9 12:10:50 2013
@@ -103,7 +103,14 @@
*
* \retval Caching topic for all bridge events.
*/
-struct stasis_caching_topic *ast_bridge_topic_all_cached(void);
+struct stasis_topic *ast_bridge_topic_all_cached(void);
+
+/*!
+ * \since 12
+ * \brief Backend cache for ast_bridge_topic_all_cached().
+ * \retval Cache of \ref ast_bridge_snapshot.
+ */
+struct stasis_cache *ast_bridge_cache(void);
/*!
* \since 12
Modified: team/dlee/stasis-cache-split/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/include/asterisk/stasis_channels.h?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/include/asterisk/stasis_channels.h (original)
+++ team/dlee/stasis-cache-split/include/asterisk/stasis_channels.h Tue Jul 9 12:10:50 2013
@@ -119,16 +119,23 @@
*
* \retval Topic for all channel events.
*/
-struct stasis_caching_topic *ast_channel_topic_all_cached(void);
-
-/*!
- * \since 12
- * \brief A caching topic which caches \ref ast_channel_snapshot messages from
- * ast_channel_events_all(void) and indexes them by name.
- *
- * \retval Topic for all channel events.
- */
-struct stasis_caching_topic *ast_channel_topic_all_cached_by_name(void);
+struct stasis_topic *ast_channel_topic_all_cached(void);
+
+/*!
+ * \since 12
+ * \brief Primary channel cache, indexed by Uniqueid.
+ *
+ * \retval Cache of \ref ast_channel_snapshot.
+ */
+struct stasis_cache *ast_channel_cache(void);
+
+/*!
+ * \since 12
+ * \brief Secondary channel cache, indexed by name.
+ *
+ * \retval Cache of \ref ast_channel_snapshot.
+ */
+struct stasis_cache *ast_channel_cache_by_name(void);
/*!
* \since 12
Modified: team/dlee/stasis-cache-split/include/asterisk/stasis_endpoints.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/include/asterisk/stasis_endpoints.h?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/include/asterisk/stasis_endpoints.h (original)
+++ team/dlee/stasis-cache-split/include/asterisk/stasis_endpoints.h Tue Jul 9 12:10:50 2013
@@ -153,7 +153,14 @@
* \brief Cached topic for all endpoint related messages.
* \since 12
*/
-struct stasis_caching_topic *ast_endpoint_topic_all_cached(void);
+struct stasis_topic *ast_endpoint_topic_all_cached(void);
+
+/*!
+ * \brief Backend cache for ast_endpoint_topic_all_cached().
+ * \return Cache of \ref ast_endpoint_snapshot.
+ * \since 12
+ */
+struct stasis_cache *ast_endpoint_cache(void);
/*!
* \brief Retrieve the most recent snapshot for the endpoint with the given
Modified: team/dlee/stasis-cache-split/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/app.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/main/app.c (original)
+++ team/dlee/stasis-cache-split/main/app.c Tue Jul 9 12:10:50 2013
@@ -2696,9 +2696,9 @@
return mwi_topic_all;
}
-struct stasis_caching_topic *ast_mwi_topic_cached(void)
-{
- return mwi_topic_cached;
+struct stasis_topic *ast_mwi_topic_cached(void)
+{
+ return stasis_caching_get_topic(mwi_topic_cached);
}
struct stasis_topic *ast_mwi_topic(const char *uniqueid)
Modified: team/dlee/stasis-cache-split/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/cdr.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/main/cdr.c (original)
+++ team/dlee/stasis-cache-split/main/cdr.c Tue Jul 9 12:10:50 2013
@@ -4026,7 +4026,7 @@
return -1;
}
- channel_subscription = stasis_forward_all(stasis_caching_get_topic(ast_channel_topic_all_cached()), cdr_topic);
+ channel_subscription = stasis_forward_all(ast_channel_cache(), cdr_topic);
if (!channel_subscription) {
return -1;
}
Modified: team/dlee/stasis-cache-split/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/cel.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/main/cel.c (original)
+++ team/dlee/stasis-cache-split/main/cel.c Tue Jul 9 12:10:50 2013
@@ -1463,7 +1463,7 @@
}
cel_channel_forwarder = stasis_forward_all(
- stasis_caching_get_topic(ast_channel_topic_all_cached()),
+ ast_channel_cache(),
cel_aggregation_topic);
if (!cel_channel_forwarder) {
return -1;
Modified: team/dlee/stasis-cache-split/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/manager_channels.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/main/manager_channels.c (original)
+++ team/dlee/stasis-cache-split/main/manager_channels.c Tue Jul 9 12:10:50 2013
@@ -1259,7 +1259,7 @@
if (!message_router) {
return -1;
}
- channel_topic = stasis_caching_get_topic(ast_channel_topic_all_cached());
+ channel_topic = ast_channel_cache();
if (!channel_topic) {
return -1;
}
Modified: team/dlee/stasis-cache-split/main/manager_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/manager_endpoints.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/main/manager_endpoints.c (original)
+++ team/dlee/stasis-cache-split/main/manager_endpoints.c Tue Jul 9 12:10:50 2013
@@ -49,7 +49,11 @@
struct stasis_topic *topic,
struct stasis_message *message)
{
- stasis_forward_message(ast_manager_get_topic(), stasis_caching_get_topic(ast_endpoint_topic_all_cached()), message);
+ /* XXX This looks wrong. Nothing should post or forward to a caching
+ * topic directly. Maybe ast_endpoint_topic() would be correct? I'd have
+ * to dig to make sure I don't break anything, though.
+ */
+ stasis_forward_message(ast_manager_get_topic(), ast_endpoint_topic_all_cached), message);
}
int manager_endpoints_init(void)
@@ -64,7 +68,7 @@
ast_register_atexit(manager_endpoints_shutdown);
- endpoint_topic = stasis_caching_get_topic(ast_endpoint_topic_all_cached());
+ endpoint_topic = ast_endpoint_topic_all_cached();
if (!endpoint_topic) {
return -1;
}
Modified: team/dlee/stasis-cache-split/main/stasis_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/stasis_endpoints.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/main/stasis_endpoints.c (original)
+++ team/dlee/stasis-cache-split/main/stasis_endpoints.c Tue Jul 9 12:10:50 2013
@@ -80,10 +80,6 @@
.to_ami = peerstatus_to_ami,
);
-static struct stasis_topic *endpoint_topic_all;
-
-static struct stasis_caching_topic *endpoint_topic_all_cached;
-
static struct ast_manager_event_blob *peerstatus_to_ami(struct stasis_message *msg)
{
struct ast_endpoint_blob *obj = stasis_message_data(msg);
@@ -168,16 +164,6 @@
}
}
-struct stasis_topic *ast_endpoint_topic_all(void)
-{
- return endpoint_topic_all;
-}
-
-struct stasis_caching_topic *ast_endpoint_topic_all_cached(void)
-{
- return endpoint_topic_all_cached;
-}
-
struct ast_endpoint_snapshot *ast_endpoint_latest_snapshot(const char *tech,
const char *name, unsigned int guaranteed)
{
@@ -190,7 +176,7 @@
return NULL;
}
- msg = stasis_cache_get_extended(ast_endpoint_topic_all_cached(),
+ msg = stasis_cache_get_extended(ast_endpoint_cache(),
ast_endpoint_snapshot_type(), id, guaranteed);
if (!msg) {
return NULL;
Modified: team/dlee/stasis-cache-split/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/res_agi.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/res/res_agi.c (original)
+++ team/dlee/stasis-cache-split/res/res_agi.c Tue Jul 9 12:10:50 2013
@@ -2761,7 +2761,7 @@
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
/* one argument: look for info on the specified channel */
- if ((msg = stasis_cache_get(ast_channel_topic_all_cached_by_name(), ast_channel_snapshot_type(), argv[2]))) {
+ if ((msg = stasis_cache_get(ast_channel_cache_by_name(), ast_channel_snapshot_type(), argv[2]))) {
struct ast_channel_snapshot *snapshot = stasis_message_data(msg);
ast_agi_send(agi->fd, chan, "200 result=%d\n", snapshot->state);
Modified: team/dlee/stasis-cache-split/res/res_chan_stats.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/res_chan_stats.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/res/res_chan_stats.c (original)
+++ team/dlee/stasis-cache-split/res/res_chan_stats.c Tue Jul 9 12:10:50 2013
@@ -154,7 +154,7 @@
{
/* You can create a message router to route messages by type */
router = stasis_message_router_create(
- stasis_caching_get_topic(ast_channel_topic_all_cached()));
+ ast_channel_cache());
if (!router) {
return AST_MODULE_LOAD_FAILURE;
}
Modified: team/dlee/stasis-cache-split/res/res_sip_mwi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/res_sip_mwi.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/res/res_sip_mwi.c (original)
+++ team/dlee/stasis-cache-split/res/res_sip_mwi.c Tue Jul 9 12:10:50 2013
@@ -239,7 +239,7 @@
struct message_accumulator *counter = arg;
struct ast_mwi_state *mwi_state;
- msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), mwi_stasis->mailbox);
+ msg = stasis_cache_get(ast_mwi_state_cache(), ast_mwi_state_type(), mwi_stasis->mailbox);
if (!msg) {
return 0;
}
Modified: team/dlee/stasis-cache-split/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/res_stasis.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/res/res_stasis.c (original)
+++ team/dlee/stasis-cache-split/res/res_stasis.c Tue Jul 9 12:10:50 2013
@@ -940,7 +940,7 @@
return AST_MODULE_LOAD_FAILURE;
}
- channel_router = stasis_message_router_create(stasis_caching_get_topic(ast_channel_topic_all_cached()));
+ channel_router = stasis_message_router_create(ast_channel_topic_all_cached());
if (!channel_router) {
return AST_MODULE_LOAD_FAILURE;
}
@@ -960,7 +960,7 @@
return AST_MODULE_LOAD_FAILURE;
}
- bridge_router = stasis_message_router_create(stasis_caching_get_topic(ast_bridge_topic_all_cached()));
+ bridge_router = stasis_message_router_create(ast_bridge_topic_all_cached());
if (!bridge_router) {
return AST_MODULE_LOAD_FAILURE;
}
Modified: team/dlee/stasis-cache-split/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/stasis/control.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/res/stasis/control.c (original)
+++ team/dlee/stasis-cache-split/res/stasis/control.c Tue Jul 9 12:10:50 2013
@@ -264,13 +264,9 @@
const struct stasis_app_control *control)
{
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
- struct stasis_caching_topic *caching_topic;
struct ast_channel_snapshot *snapshot;
- caching_topic = ast_channel_topic_all_cached();
- ast_assert(caching_topic != NULL);
-
- msg = stasis_cache_get(caching_topic, ast_channel_snapshot_type(),
+ msg = stasis_cache_get(ast_channel_cache(), ast_channel_snapshot_type(),
stasis_app_control_get_channel_id(control));
if (!msg) {
return NULL;
Modified: team/dlee/stasis-cache-split/res/stasis_http/resource_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/stasis_http/resource_bridges.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/res/stasis_http/resource_bridges.c (original)
+++ team/dlee/stasis-cache-split/res/stasis_http/resource_bridges.c Tue Jul 9 12:10:50 2013
@@ -176,22 +176,22 @@
void stasis_http_get_bridges(struct ast_variable *headers, struct ast_get_bridges_args *args, struct stasis_http_response *response)
{
- RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_cache *, cache, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, snapshots, NULL, ao2_cleanup);
RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
struct ao2_iterator i;
void *obj;
- caching_topic = ast_bridge_topic_all_cached();
- if (!caching_topic) {
+ cache = ast_bridge_cache();
+ if (!cache) {
stasis_http_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
}
- ao2_ref(caching_topic, +1);
-
- snapshots = stasis_cache_dump(caching_topic, ast_bridge_snapshot_type());
+ ao2_ref(cache, +1);
+
+ snapshots = stasis_cache_dump(cache, ast_bridge_snapshot_type());
if (!snapshots) {
stasis_http_response_alloc_failed(response);
return;
Modified: team/dlee/stasis-cache-split/res/stasis_http/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/stasis_http/resource_channels.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/res/stasis_http/resource_channels.c (original)
+++ team/dlee/stasis-cache-split/res/stasis_http/resource_channels.c Tue Jul 9 12:10:50 2013
@@ -388,18 +388,18 @@
struct stasis_http_response *response)
{
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
- struct stasis_caching_topic *caching_topic;
+ struct stasis_cache *cache;
struct ast_channel_snapshot *snapshot;
- caching_topic = ast_channel_topic_all_cached();
- if (!caching_topic) {
+ cache = ast_channel_cache();
+ if (!cache) {
stasis_http_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
}
- msg = stasis_cache_get(caching_topic, ast_channel_snapshot_type(),
+ msg = stasis_cache_get(cache, ast_channel_snapshot_type(),
args->channel_id);
if (!msg) {
stasis_http_response_error(
@@ -438,22 +438,22 @@
struct ast_get_channels_args *args,
struct stasis_http_response *response)
{
- RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_cache *, cache, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, snapshots, NULL, ao2_cleanup);
RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
struct ao2_iterator i;
void *obj;
- caching_topic = ast_channel_topic_all_cached();
- if (!caching_topic) {
+ cache = ast_channel_cache();
+ if (!cache) {
stasis_http_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
}
- ao2_ref(caching_topic, +1);
-
- snapshots = stasis_cache_dump(caching_topic, ast_channel_snapshot_type());
+ ao2_ref(cache, +1);
+
+ snapshots = stasis_cache_dump(cache, ast_channel_snapshot_type());
if (!snapshots) {
stasis_http_response_alloc_failed(response);
return;
Modified: team/dlee/stasis-cache-split/res/stasis_http/resource_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/stasis_http/resource_endpoints.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/res/stasis_http/resource_endpoints.c (original)
+++ team/dlee/stasis-cache-split/res/stasis_http/resource_endpoints.c Tue Jul 9 12:10:50 2013
@@ -37,22 +37,22 @@
struct ast_get_endpoints_args *args,
struct stasis_http_response *response)
{
- RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_cache *, cache, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, snapshots, NULL, ao2_cleanup);
RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
struct ao2_iterator i;
void *obj;
- caching_topic = ast_endpoint_topic_all_cached();
- if (!caching_topic) {
+ cache = ast_endpoint_cache();
+ if (!cache) {
stasis_http_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
}
- ao2_ref(caching_topic, +1);
+ ao2_ref(cache, +1);
- snapshots = stasis_cache_dump(caching_topic, ast_endpoint_snapshot_type());
+ snapshots = stasis_cache_dump(cache, ast_endpoint_snapshot_type());
if (!snapshots) {
stasis_http_response_alloc_failed(response);
return;
@@ -83,7 +83,7 @@
struct ast_get_endpoints_by_tech_args *args,
struct stasis_http_response *response)
{
- RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_cache *, cache, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, snapshots, NULL, ao2_cleanup);
RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
struct ao2_iterator i;
@@ -91,16 +91,16 @@
/* TODO - if tech isn't a recognized type of endpoint, it should 404 */
- caching_topic = ast_endpoint_topic_all_cached();
- if (!caching_topic) {
+ cache = ast_endpoint_cache();
+ if (!cache) {
stasis_http_response_error(
response, 500, "Internal Server Error",
"Message bus not initialized");
return;
}
- ao2_ref(caching_topic, +1);
+ ao2_ref(cache, +1);
- snapshots = stasis_cache_dump(caching_topic, ast_endpoint_snapshot_type());
+ snapshots = stasis_cache_dump(cache, ast_endpoint_snapshot_type());
if (!snapshots) {
stasis_http_response_alloc_failed(response);
return;
Modified: team/dlee/stasis-cache-split/tests/test_cel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/tests/test_cel.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/tests/test_cel.c (original)
+++ team/dlee/stasis-cache-split/tests/test_cel.c Tue Jul 9 12:10:50 2013
@@ -145,14 +145,14 @@
if (!ast_hangup((channel))) { \
APPEND_EVENT(channel, AST_CEL_HANGUP, NULL, hangup_extra, NULL); \
APPEND_EVENT(channel, AST_CEL_CHANNEL_END, NULL, NULL, NULL); \
- ao2_cleanup(stasis_cache_get_extended(ast_channel_topic_all_cached(), \
+ ao2_cleanup(stasis_cache_get_extended(ast_channel_cache(), \
ast_channel_snapshot_type(), ast_channel_uniqueid(channel), 1)); \
ao2_cleanup(channel); \
channel = NULL; \
} else { \
APPEND_EVENT(channel, AST_CEL_HANGUP, NULL, hangup_extra, NULL); \
APPEND_EVENT(channel, AST_CEL_CHANNEL_END, NULL, NULL, NULL); \
- ao2_cleanup(stasis_cache_get_extended(ast_channel_topic_all_cached(), \
+ ao2_cleanup(stasis_cache_get_extended(ast_channel_cache(), \
ast_channel_snapshot_type(), ast_channel_uniqueid(channel), 1)); \
ao2_cleanup(channel); \
} \
Modified: team/dlee/stasis-cache-split/tests/test_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/tests/test_stasis.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/tests/test_stasis.c (original)
+++ team/dlee/stasis-cache-split/tests/test_stasis.c Tue Jul 9 12:10:50 2013
@@ -614,6 +614,7 @@
{
RAII_VAR(struct stasis_message_type *, non_cache_type, NULL, ao2_cleanup);
RAII_VAR(struct stasis_topic *, topic, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_cache *, cache, NULL, ao2_cleanup);
RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, stasis_caching_unsubscribe);
RAII_VAR(struct consumer *, consumer, NULL, ao2_cleanup);
RAII_VAR(struct stasis_subscription *, sub, NULL, stasis_unsubscribe);
@@ -636,7 +637,9 @@
ast_test_validate(test, NULL != non_cache_type);
topic = stasis_topic_create("SomeTopic");
ast_test_validate(test, NULL != topic);
- caching_topic = stasis_caching_topic_create(topic, cache_test_data_id);
+ cache = stasis_cache_create(cache_test_data_id);
+ ast_test_validate(test, NULL != cache);
+ caching_topic = stasis_caching_topic_create(topic, cache);
ast_test_validate(test, NULL != caching_topic);
consumer = consumer_create(1);
ast_test_validate(test, NULL != consumer);
@@ -664,6 +667,7 @@
{
RAII_VAR(struct stasis_message_type *, cache_type, NULL, ao2_cleanup);
RAII_VAR(struct stasis_topic *, topic, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_cache *, cache, NULL, ao2_cleanup);
RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, stasis_caching_unsubscribe);
RAII_VAR(struct consumer *, consumer, NULL, ao2_cleanup);
RAII_VAR(struct stasis_subscription *, sub, NULL, stasis_unsubscribe);
@@ -689,7 +693,9 @@
ast_test_validate(test, NULL != cache_type);
topic = stasis_topic_create("SomeTopic");
ast_test_validate(test, NULL != topic);
- caching_topic = stasis_caching_topic_create(topic, cache_test_data_id);
+ cache = stasis_cache_create(cache_test_data_id);
+ ast_test_validate(test, NULL != cache);
+ caching_topic = stasis_caching_topic_create(topic, cache);
ast_test_validate(test, NULL != caching_topic);
consumer = consumer_create(1);
ast_test_validate(test, NULL != consumer);
@@ -714,7 +720,7 @@
ast_test_validate(test, topic == actual_update->topic);
ast_test_validate(test, NULL == actual_update->old_snapshot);
ast_test_validate(test, test_message1_1 == actual_update->new_snapshot);
- ast_test_validate(test, test_message1_1 == stasis_cache_get(caching_topic, cache_type, "1"));
+ ast_test_validate(test, test_message1_1 == stasis_cache_get(cache, cache_type, "1"));
/* stasis_cache_get returned a ref, so unref test_message1_1 */
ao2_ref(test_message1_1, -1);
@@ -723,7 +729,7 @@
ast_test_validate(test, topic == actual_update->topic);
ast_test_validate(test, NULL == actual_update->old_snapshot);
ast_test_validate(test, test_message2_1 == actual_update->new_snapshot);
- ast_test_validate(test, test_message2_1 == stasis_cache_get(caching_topic, cache_type, "2"));
+ ast_test_validate(test, test_message2_1 == stasis_cache_get(cache, cache_type, "2"));
/* stasis_cache_get returned a ref, so unref test_message2_1 */
ao2_ref(test_message2_1, -1);
@@ -739,7 +745,7 @@
ast_test_validate(test, topic == actual_update->topic);
ast_test_validate(test, test_message2_1 == actual_update->old_snapshot);
ast_test_validate(test, test_message2_2 == actual_update->new_snapshot);
- ast_test_validate(test, test_message2_2 == stasis_cache_get(caching_topic, cache_type, "2"));
+ ast_test_validate(test, test_message2_2 == stasis_cache_get(cache, cache_type, "2"));
/* stasis_cache_get returned a ref, so unref test_message2_2 */
ao2_ref(test_message2_2, -1);
@@ -755,7 +761,7 @@
ast_test_validate(test, topic == actual_update->topic);
ast_test_validate(test, test_message1_1 == actual_update->old_snapshot);
ast_test_validate(test, NULL == actual_update->new_snapshot);
- ast_test_validate(test, NULL == stasis_cache_get(caching_topic, cache_type, "1"));
+ ast_test_validate(test, NULL == stasis_cache_get(cache, cache_type, "1"));
return AST_TEST_PASS;
}
@@ -764,6 +770,7 @@
{
RAII_VAR(struct stasis_message_type *, cache_type, NULL, ao2_cleanup);
RAII_VAR(struct stasis_topic *, topic, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_cache *, cache, NULL, ao2_cleanup);
RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, stasis_caching_unsubscribe);
RAII_VAR(struct consumer *, consumer, NULL, ao2_cleanup);
RAII_VAR(struct stasis_subscription *, sub, NULL, stasis_unsubscribe);
@@ -791,7 +798,9 @@
ast_test_validate(test, NULL != cache_type);
topic = stasis_topic_create("SomeTopic");
ast_test_validate(test, NULL != topic);
- caching_topic = stasis_caching_topic_create(topic, cache_test_data_id);
+ cache = stasis_cache_create(cache_test_data_id);
+ ast_test_validate(test, NULL != cache);
+ caching_topic = stasis_caching_topic_create(topic, cache);
ast_test_validate(test, NULL != caching_topic);
consumer = consumer_create(1);
ast_test_validate(test, NULL != consumer);
@@ -811,7 +820,7 @@
ast_test_validate(test, 2 == actual_len);
/* Check the cache */
- cache_dump = stasis_cache_dump(caching_topic, NULL);
+ cache_dump = stasis_cache_dump(cache, NULL);
ast_test_validate(test, NULL != cache_dump);
ast_test_validate(test, 2 == ao2_container_count(cache_dump));
i = ao2_iterator_init(cache_dump, 0);
@@ -829,7 +838,7 @@
ast_test_validate(test, 3 == actual_len);
/* Check the cache */
- cache_dump = stasis_cache_dump(caching_topic, NULL);
+ cache_dump = stasis_cache_dump(cache, NULL);
ast_test_validate(test, NULL != cache_dump);
ast_test_validate(test, 2 == ao2_container_count(cache_dump));
i = ao2_iterator_init(cache_dump, 0);
@@ -847,7 +856,7 @@
ast_test_validate(test, 4 == actual_len);
/* Check the cache */
- cache_dump = stasis_cache_dump(caching_topic, NULL);
+ cache_dump = stasis_cache_dump(cache, NULL);
ast_test_validate(test, NULL != cache_dump);
ast_test_validate(test, 1 == ao2_container_count(cache_dump));
i = ao2_iterator_init(cache_dump, 0);
@@ -858,7 +867,7 @@
/* Dump the cache to ensure that it has no subscription change items in it since those aren't cached */
ao2_cleanup(cache_dump);
- cache_dump = stasis_cache_dump(caching_topic, stasis_subscription_change_type());
+ cache_dump = stasis_cache_dump(cache, stasis_subscription_change_type());
ast_test_validate(test, 0 == ao2_container_count(cache_dump));
return AST_TEST_PASS;
Modified: team/dlee/stasis-cache-split/tests/test_stasis_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/tests/test_stasis_endpoints.c?view=diff&rev=393889&r1=393888&r2=393889
==============================================================================
--- team/dlee/stasis-cache-split/tests/test_stasis_endpoints.c (original)
+++ team/dlee/stasis-cache-split/tests/test_stasis_endpoints.c Tue Jul 9 12:10:50 2013
@@ -160,7 +160,7 @@
ast_test_validate(test, NULL != sink);
sub = stasis_subscribe(
- stasis_caching_get_topic(ast_endpoint_topic_all_cached()),
+ ast_endpoint_topic_all_cached(),
stasis_message_sink_cb(), sink);
ast_test_validate(test, NULL != sub);
More information about the asterisk-commits
mailing list