[Asterisk-code-review] media index.c: Refactored so it doesn't cache the index (asterisk[16])

George Joseph asteriskteam at digium.com
Mon Jan 28 11:00:51 CST 2019


Hello Friendly Automation, Corey Farrell, 

I'd like you to reexamine a change. Please visit

    https://gerrit.asterisk.org/10923

to look at the new patch set (#2).

Change subject: media_index.c: Refactored so it doesn't cache the index
......................................................................

media_index.c: Refactored so it doesn't cache the index

Testing revealed that the cache added no benefit but that it could
consume excessive memory.

Two new index related functions were created:
ast_sounds_get_index_for_file() and ast_media_index_update_for_file()
which restrict index updating to specific sound files.

The original ast_sounds_get_index() and ast_media_index_update()
calls are still available but since they no longer cache the results
internally, developers should re-use an index they may already have
instead of calling ast_sounds_get_index() repeatedly.  If information
for only a single file is needed, ast_sounds_get_index_for_file()
should be called instead of ast_sounds_get_index().

The media_index directory scan code was elimininated in favor of
using the existing ast_file_read_dirs() function.

Since there's no more cache, ast_sounds_index_init now only
registers the sounds cli commands instead of generating the
initial index and subscribing to stasis format register/unregister
messages.

"sounds" is no longer a valid target for the "module reload"
command.

Both the sounds cli commands and the sounds ari resources were
refactored to only call ast_sounds_get_index() once per invocation
and to use ast_sounds_get_index_for_file() when a specific sound
file is requested.

Change-Id: I1cef327ba1b0648d85d218b70ce469ad07f4aa8d
---
M CHANGES
M UPGRADE.txt
M include/asterisk/media_index.h
M include/asterisk/sounds_index.h
M main/media_index.c
M main/sounds.c
M res/ari/resource_sounds.c
7 files changed, 283 insertions(+), 207 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/23/10923/2
-- 
To view, visit https://gerrit.asterisk.org/10923
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I1cef327ba1b0648d85d218b70ce469ad07f4aa8d
Gerrit-Change-Number: 10923
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Friendly Automation (1000185)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190128/2d482da3/attachment.html>


More information about the asterisk-code-review mailing list