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

rmudgett reviewboard at asterisk.org
Thu Aug 23 17:01:00 CDT 2012


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

(Updated Aug. 23, 2012, 5:01 p.m.)


Review request for Asterisk Developers.


Changes
-------

* Addressed mmichelson's comments.

* Made AST_DEVMODE keep track of the number of nodes in the generic
container.  Also keeps track of the maximum number of empty nodes.

* Made the generic container node indicate if it is linked into the
container.

* Made the hash container integrity check validate the bucket list links.


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 371646 
  /trunk/main/astobj2.c 371646 
  /trunk/main/channel.c 371646 
  /trunk/tests/test_astobj2.c 371646 

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/20120823/bd8fcbec/attachment-0001.htm>


More information about the asterisk-dev mailing list