[tarantool-patches] Re: [PATCH 2/2] On ctl event trigger

Konstantin Osipov kostja at tarantool.org
Thu Aug 30 15:50:23 MSK 2018


* Georgy Kirichenko <georgy at tarantool.org> [18/08/28 19:20]:
> +		struct on_ctl_event event;
> +		event.type = CTL_SPACE;
> +		event.space.action = CTL_SPACE_CREATE;
> +		event.space.space_id = old_id;
> +		trigger_run(&on_ctl_trigger, &event);

event.type and event.action confuses me. Why do we need both? I
assume because you associate a context to a type, and events of
the same "event type" have the same context. But it seems the
context is defined fully by trigger invocation context, no? 

Please keep in mind that we have been solving the same problem
with audit events. Looks like we need to pull and open source some
of the infrastructure code, such as struct event declaration, so
that we can reuse it for all kinds of events, huh...

>  	if (is_box_configured) {
> +		struct on_ctl_event ctl_event;
> +		ctl_event.type = CTL_SHUTDOWN;
> +		trigger_run(&on_ctl_trigger, &ctl_event);

I don't understand why we call it 'ctl event'. Why not call it
'shutdown_trigger_ctx'? 

Simply put, we begin invoking more triggers, at more places. The
context of the trigger is defined, well, but the context of the
place it is invoked from, not by event type.

ctl_event.h/c seem to be missing?

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov




More information about the Tarantool-patches mailing list