Difference between revisions of "Table iterator"

From Net-SNMP Wiki
Jump to: navigation, search
m
Line 1: Line 1:
 +
coletolico
 
== Table Iterator Helper ==
 
== Table Iterator Helper ==
  

Revision as of 16:52, 26 September 2007

coletolico

Table Iterator Helper

Overview

This handler calls user specified functions to iterate over a (generally unsorted) set of data, looking for the data to satisfy an incoming request.

Pros and Cons

The iterator helper will iterate through all the rows for each individual request which isn't very efficient.

If you're looking for better efficiency, you might want to consider using table_tdata or MfD instead.

Tips and Tricks

Transient Data

If you are concerned that the data you are iterating over will change or vanish between the time the iterator functions are called and the time the handler is called to process a request, but you don't want to cache all your data, then there is an itermediate option.

If you provide a make_data_context function when you register the table, that function will be called with the loop_context for a row each time the agent determines that the current row is the best match. When the agent is done with the row, the free_data_context function will be called to release the data.