On Tue, 6 Jul 2010 19:13:37 +0300 xor wrote:
XE> I think i understand most of the generated code and filled the parts that
XE> make my own module to stuff.
XE> But some parts of the template are not clear to me :
XE> 
XE> 1) I have filled the xxx_container_load(netsnmp_container *container)
XE> function with my indexes as it says because
XE> other data is expensive to fill here. I was expecting that function to be
XE> called somewhere in my code when my
XE> table module was initializing but there was no place that was used. So i
XE> added it into generated xxx_interface.c in
XE> _xxx_initialize_interface function ,is it the right behaviour to put it here
XE> ?

I think the generated code is missing the calls to load/free the container
when the cache helper isn't used. If your indexes don't change (rows aren't
added removed), then calling the load function once in initialize is fine. If
external influences add/remove rows, then the container needs to be updated
once in a while. The cache helper does that for you.

XE> 2) The second part that confuses me is the part that finds the row with
XE> queried index. I was expecting to get
XE> the incoming index, search the container and if i have it , to call the
XE> xxx_row_prep to fill the found row with my data.
XE> But as i see the function that calls xxx_row_prep [...]
XE> and founds my rowreq_ctx magically.

Yes, the underlying table helper finds the right row based on the incoming
request and the indexes that are added to the container in container load.

XE> Also getting row like that and filling it after that doesnt seem to me very
XE> efficient what happens
XE> if i have 100000 rows all they stay in memory ? What is the best approach
XE> here ?

Looking at the code, I think you are correct that rows will stay in memory
when the cache helper is not used. Most often the cache helper is used, and
the entire container is dumped periodically, thus releasing the memory.

But I think you could work around this by storing the row contexts in the user
context. The user context is passed to the post_request function, and you
could release the memory used for the rows there.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to