From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 60F2A469719 for ; Fri, 21 Feb 2020 00:21:09 +0300 (MSK) Date: Fri, 21 Feb 2020 00:15:49 +0300 From: Igor Munkin Message-ID: <20200220211549.GG404@tarantool.org> References: <20191114115020.21091-1-maria.khaydich@tarantool.org> <1578917620.195553363@f475.i.mail.ru> <20200113154829.GI31304@tarantool.org> <1579344991.266039392@f319.i.mail.ru> <20200220175124.pwj24lx3jz4w6zcm@tkn_work_nb> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200220175124.pwj24lx3jz4w6zcm@tkn_work_nb> Subject: Re: [Tarantool-patches] [PATCH] box: make box.execute() immutable List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org Sasha, On 20.02.20, Alexander Turenko wrote: > Sorry for the late response. > > See comments below. > > While looking into the patch, experimenting and commenting I made the > patch (it is based on your changes), so I'll paste it at end of the > email for the reference. > > WBR, Alexander Turenko. > > > I considered using of `type(box.cfg) == 'function'` check as in > tarantoolctl, but in fact it is not realiable: if box was not configured > after box.cfg() due to an error (say, after `box.cfg{listen = > 'invalid'}`) the type of box.cfg will be 'table' and reload_cfg() will > work on the next box.cfg() call. So we should use box_is_configured C > function: > Nice. I overlooked it, but you found such a great solution here. > | local ffi = require('ffi') > | > | ffi.cdef([[ > | bool > | box_is_configured(void); > | ]]) > | > | local function box_is_configured() > | return ffi.C.box_is_configured() > | end > -- Best regards, IM