[kea-dev] Another hook suggestion: configurable periodic timers

Marcin Siodelski marcin at isc.org
Mon Nov 24 16:59:26 UTC 2014


Hi Nicolas,

Can you please describe some of the use cases you have in mind here?

Typically, hooks require access to the contextual data. For example, a
pkt4_receive hook requires pkt4 object be passed to it by the server.
Depending on the purpose, the "timer hook" could also require access to
some data contexts (e.g. a hook which offers periodic statistics
gathering needs to access some statistical data counters) but the type
of the contextual data can't be known upfront when implementing a hook
and this seems to limit the usability of such a hooks to only those
situations when the context is not needed or when the library maintains
its own context. Then, when the library is unloaded the context is lost.

If the "timer hook" is meant to just perform some periodic operations
which don't depend on any data contexts it is worth to consider whether
the same can be achieved with a cron job?

I don't want it to sound that I am not opposed to this idea. I try to
understand the use cases so as we rather provide some generic mechanism,
rather than something of a limited usability.

Marcin

On 11/19/14 17:50, Chaigneau, Nicolas wrote:
> Hello again,
> 
> 
> 
> Another need I have is to perform periodic actions within a hook library.
> 
> A hacky way to do so is, for instance, on a trigger "pkt4_receive":
> Check if it's time to perform the periodic action, then rearm the timer afterwards (ie, set the future timestamp at which the action should be handled again).
> The drawback is that it depends on traffic being sent to the server. And it's not a terribly clean way to handle this...
> 
> (Still, it works. So the following proposal is not of high priority or anything; I'm just opening the discussion.)
> 
> I think of the following:
> 
> 
> Allow to define in configuration a list of timers, each of which would be composed of a period and identifier.
> For instance, with a timer of 5 min and one of 1H:
> 
> 	"periodic-timers": [
> 		{
> 			"id": "timer-monitor"
> 			"period": 300,
> 		},
> 		{
> 			"id": "timer-1H"
> 			"period": 3600,
> 		}
> 	]
> 
> Kea would trigger a new hook "periodic timer" each time the period of one of the timers is reached.
> The hook library would receive both "id" and "period" arguments, which would allow to decide what to do (or do nothing).
> 
> 
> 
> (apologies for overloading the mailing list; this will be my last one for today, I promise !)
> 
> 
> Regards,
> Nicolas.
> 
> This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
> 
> _______________________________________________
> kea-dev mailing list
> kea-dev at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-dev
> 


More information about the kea-dev mailing list