mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 11:32:25 +00:00
stasis: Use an implementation specific channel snapshot cache.
Channels no longer use the Stasis cache for channel snapshots. Instead they are stored in a hash table in stasis_channels which reduces the number of Stasis messages created and allows better storage. As a result the following APIs are no longer available since the stasis cache is no longer used: ast_channel_topic_cached() ast_channel_topic_all_cached() The ast_channel_cache_all() and ast_channel_cache_by_name() functions now return an ao2_container of ast_channel_snapshots rather than a container of stasis_messages therefore you can't (and don't need to) call stasis_cache functions on it. The ast_channel_topic_all() function now returns a normal topic not a cached one so you can't use stasis cache functions on it either. The ast_channel_snapshot_type() stasis message now has the ast_channel_snapshot_update structure as it's data. It contains the last snapshot and the new one. ast_channel_snapshot_get_latest() still returns the latest snapshot. The latest snapshot is now stored on the channel itself to eliminate cache hits when Stasis messages that have the snapshot as a payload are created. ASTERISK-28102 Change-Id: I9334febff60a82d7c39703e49059fa3a68825786
This commit is contained in:
@@ -255,32 +255,18 @@ AST_TEST_DEFINE(channel_messages)
|
||||
ast_hangup(chan);
|
||||
chan = NULL;
|
||||
|
||||
actual_count = stasis_message_sink_wait_for_count(sink, 6,
|
||||
actual_count = stasis_message_sink_wait_for_count(sink, 3,
|
||||
STASIS_SINK_DEFAULT_WAIT);
|
||||
ast_test_validate(test, 6 == actual_count);
|
||||
ast_test_validate(test, 3 == actual_count);
|
||||
|
||||
msg = sink->messages[1];
|
||||
type = stasis_message_type(msg);
|
||||
ast_test_validate(test, stasis_cache_update_type() == type);
|
||||
ast_test_validate(test, ast_channel_snapshot_type() == type);
|
||||
|
||||
msg = sink->messages[2];
|
||||
type = stasis_message_type(msg);
|
||||
ast_test_validate(test, ast_channel_snapshot_type() == type);
|
||||
|
||||
msg = sink->messages[3];
|
||||
type = stasis_message_type(msg);
|
||||
ast_test_validate(test, stasis_cache_update_type() == type);
|
||||
|
||||
/* The ordering of the cache clear and endpoint snapshot are
|
||||
* unspecified */
|
||||
msg = sink->messages[4];
|
||||
if (stasis_message_type(msg) == stasis_cache_clear_type()) {
|
||||
/* Okay; the next message should be the endpoint snapshot */
|
||||
msg = sink->messages[5];
|
||||
}
|
||||
|
||||
type = stasis_message_type(msg);
|
||||
ast_test_validate(test, ast_endpoint_snapshot_type() == type);
|
||||
|
||||
actual_snapshot = stasis_message_data(msg);
|
||||
ast_test_validate(test, 0 == actual_snapshot->num_channels);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user