[asterisk-dev] [Code Review] astobj2 API container enhancements

rmudgett reviewboard at asterisk.org
Fri Aug 17 18:03:19 CDT 2012


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

(Updated Aug. 17, 2012, 6:03 p.m.)


Review request for Asterisk Developers.


Changes
-------

Refactored hash_ao2_link to extract generic container code.


Summary
-------

These are the enhancements proposed by https://reviewboard.asterisk.org/r/1835/

API allows for sorted containers, insertion options, duplicate handling options, and traversal order options.

* Adds the ability for containers to be sorted when they are created.

* Adds container creation options to handle duplicates when they are
inserted.

* Adds container creation option to insert objects at the beginning or end
of the container traversal order.

* Adds OBJ_PARTIAL_KEY to allow searching with a partial key.  The partial
key works similarly to the OBJ_KEY flag.  (The real search spead
improvement with this flag will come when red-black trees are added.)

* Adds container traversal and iteration order options: Ascending and
Descending.

* Adds an AST_DEVMODE compile feature to check the stats and integrity of
registered containers using the CLI "astobj2 container stats <name>" and
"astobj2 container check <name>".  The channels container is normally
registered since it is one of the most important containers in the system.

* Adds ao2_iterator_restart() to allow iteration to be restarted from the
beginning.

* Changes the generic container object to have a v_method table pointer to
support other types of containers.

* Changes the container nodes holding objects to be ref counted.

The ref counted nodes and v_method table pointer changes pave the way to
allow other types of containers.


This addresses bug ASTERISK-19969.
    https://issues.asterisk.org/jira/browse/ASTERISK-19969


Diffs (updated)
-----

  /trunk/include/asterisk/astobj2.h 371505 
  /trunk/main/astobj2.c 371505 
  /trunk/main/channel.c 371505 
  /trunk/tests/test_astobj2.c 371505 

Diff: https://reviewboard.asterisk.org/r/2078/diff


Testing
-------

This patch includes a large astobj2 unit test enhancement that tests the new features.
The unit tests pass.


Thanks,

rmudgett

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120817/7b91e7b2/attachment.htm>


More information about the asterisk-dev mailing list