From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp43.i.mail.ru (smtp43.i.mail.ru [94.100.177.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id B0576469710 for ; Sun, 3 May 2020 21:42:55 +0300 (MSK) References: <20200428161137.20536-1-gorcunov@gmail.com> <20200428161137.20536-3-gorcunov@gmail.com> From: Vladislav Shpilevoy Message-ID: <15ec7d64-b76a-4f7e-b1b0-80e59bf74f36@tarantool.org> Date: Sun, 3 May 2020 20:42:53 +0200 MIME-Version: 1.0 In-Reply-To: <20200428161137.20536-3-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 02/17] recovery: convert WalSubscription class to structure List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov , tml Thanks for the patch! See 3 comments below. > diff --git a/src/box/recovery.cc b/src/box/recovery.cc > index 1d0e80057..76b771a91 100644 > --- a/src/box/recovery.cc > +++ b/src/box/recovery.cc > @@ -375,83 +375,92 @@ recovery_finalize(struct recovery *r) > * file triggers a wakeup. The WAL dir path is set in the > * constructor. XLOG file path is set with set_log_path(). 1. Maybe it is worth changing set_log_path() to wal_subscr_set_log_path(). > */ > -class WalSubscription { > -public: > - struct fiber *f; > - unsigned events; > - struct ev_stat dir_stat; > - struct ev_stat file_stat; > - char dir_path[PATH_MAX]; > - char file_path[PATH_MAX]; > - > - static void dir_stat_cb(struct ev_loop *, struct ev_stat *stat, int) > - { > - ((WalSubscription *)stat->data)->wakeup(WAL_EVENT_ROTATE); > - } > - > - static void file_stat_cb(struct ev_loop *, struct ev_stat *stat, int) > - { > - ((WalSubscription *)stat->data)->wakeup(WAL_EVENT_WRITE); > - } > +struct wal_subscr { 2. Lets better not truncate the name. 'subscr' looks ugly. 'wal_subscription' is a fine name, not too long. If you are strictly against 'subscription', 'wal_sub' would be better too, IMO. At least it is pronounceable. > + struct fiber *f; > + unsigned int events; > + struct ev_stat dir_stat; > + struct ev_stat file_stat; > + char dir_path[PATH_MAX]; > + char file_path[PATH_MAX]; 3. Please, don't align struct members. That is not our code style and creates problems, when a new member is added with a too long type name.