From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 9281429D97 for ; Thu, 30 Aug 2018 08:50:26 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0IU4oLjOE1MV for ; Thu, 30 Aug 2018 08:50:26 -0400 (EDT) Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 501FE29D7B for ; Thu, 30 Aug 2018 08:50:26 -0400 (EDT) Date: Thu, 30 Aug 2018 15:50:23 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH 2/2] On ctl event trigger Message-ID: <20180830125023.GC30997@chai> References: <7d9ccb894ef2915181454db39ead93497f9ff9aa.1535472838.git.georgy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7d9ccb894ef2915181454db39ead93497f9ff9aa.1535472838.git.georgy@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Georgy Kirichenko * Georgy Kirichenko [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