From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id ACEBA6EC55; Fri, 30 Jul 2021 11:15:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ACEBA6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627632916; bh=4U/efXdfR8VTfofXJZwJH5MW6T/6T3hiiqV1NrJbues=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=FkXJI3KSd7CQQDYyskoOqTAxPJDvIxqgGClKM52GQEqEZDUh+OOXEKwD5H+zu/UcG ZBwzkuOcO39jZD2E2lykJzF7fpsyE5gfL5xq1fDFl6dkVD4pFV5cgwDBB4xguo+iPP lkHBC7ZeO/QmjPlU6g/TM0KXuFXl7lBbNtQ9jKRE= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [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 9EBE46EC55 for ; Fri, 30 Jul 2021 11:15:14 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9EBE46EC55 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1m9Nfl-0004Wv-QQ; Fri, 30 Jul 2021 11:15:14 +0300 Date: Fri, 30 Jul 2021 11:15:09 +0300 To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org Message-ID: <20210730081509.dj4yw46duagusfgp@esperanza> References: <83ad38fd1425a056ea71daab77e1dde18087aed0.1627024646.git.vdavydov@tarantool.org> <20210729105459.g3ixkeh4gqpvt2ig@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C366EE405EC28A2001F8302D8429E0DE58182A05F5380850404D90B4CD2575831DC3283556DACD09F92D32DDA3B39FEAB3A9B62CA3E74F485C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7C579B1C3ABE6C709C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE75210414551E8CD62EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BBCA57AF85F7723F2BD64BC2CDAAB036AC3BEDC46DED6008ECC7F00164DA146DAFE8445B8C89999728AA50765F79006370D9A29B7FD16D1239FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3FB12F4B11BB5604F117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F79006371F24DFF1B2961425731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A5EEF1B9E2F71D345AC7DC6C77146A1EB93406B68F42801CF0D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA751B940EDA0DFB0535410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34753B45383CEFF20474734D966BC40F97762E59CC034816831B8CA0E6E6F6418744C8AE10E40436AB1D7E09C32AA3244C5C8ED0C029910976941B12C6369F1E813FD9C8CA1B0515E0FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojWBddABnKmoIRPrnZ0gLj0w== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D7F815F870C6C7FF3E9CFB78A027EEBB4274CEFED1673C562683ABF942079399BFB559BB5D741EB966A65DFF43FF7BE03240331F90058701C67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 06/20] net.box: rename request.ctx to request.format X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladimir Davydov via Tarantool-patches Reply-To: Vladimir Davydov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Fri, Jul 30, 2021 at 12:39:29AM +0200, Vladislav Shpilevoy wrote: > On 29.07.2021 12:54, Vladimir Davydov wrote: > > On Thu, Jul 29, 2021 at 12:49:39AM +0200, Vladislav Shpilevoy wrote: > >> On 23.07.2021 13:07, Vladimir Davydov via Tarantool-patches wrote: > >>> Request context only stores tuple format or nil, which is used for > >>> decoding a response. Rename it appropriately. > >> > >> The name ctx was chosen intentionally, because when you pass it to > >> method_decoder[request.method](...), you don't know how will it be > >> used and what is stores. It was internal for the request sender and > >> codec. Why do you need to change it? > > > > For one thing, it's always either nil or format. Naming it ctx is > > confusing. > > > > The reason I'm doing this in the scope of this series is that it is > > stored in the request class. Lua isn't a strictly typed language so we > > can store whatever we want there, but in C we need to know the type to > > define the request struct, see netbox_request::format here: > > > > https://github.com/tarantool/tarantool/blob/73cab8402f7e098c8e908af9a2b72695c754c472/src/box/lua/net_box.c#L99 > > > > Turning ctx to format solves this problem. > You could store it as `void *` then. It just looks ugly, for > instance, when you pass `struct tuple_format` into netbox_decode_nil(). > Not all responses consist of tuples or even have a body. If we stored a format in void *, we'd have to cast it on request destruction to decrement its reference counter. To avoid that, we'd need to introduce an abstract class for the decoder context, but since currently the context can only be a tuple format, I don't think we should bother now. > > Up to you. We could change it in the future if need. Let's change that in future, when we need it.