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 A43726EC56; Fri, 23 Jul 2021 14:10:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A43726EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627038603; bh=v7xY/XW96Q4E3wrhJAkpArWMrNbyVgE6oQ02wPuYTmY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=SVGmafag9Iu86HI9E96s8UzDG36LSlhk57subOSsYye6gOGGp98icYONkRpKcumqa qtIABa++ffk0GbfJQA1pj74igDO4LFJAuwEXz8+r7ma2nPbMtKV+rls9S4m+LLDMx/ 7PHhOEm+uIwdFnrdos3paR1pb/aBLxFsLYZj3qkU= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 1F46E6EC6E for ; Fri, 23 Jul 2021 14:07:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1F46E6EC6E Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1m6t1h-0004dl-Mi; Fri, 23 Jul 2021 14:07:34 +0300 To: tarantool-patches@dev.tarantool.org Date: Fri, 23 Jul 2021 14:07:15 +0300 Message-Id: <230d9a74f3c145d7b51608c17ca2f6fba8011d0b.1627024646.git.vdavydov@tarantool.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-174C08C4: 5188C02AEC42908C481ED7ADC579193296BBA28369E3F2D2713F3D5F7D406D31BCF678C7329BA986 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C3038391AAE5FBFA76FBCFDED1455B43CD182A05F538085040037A768A843C2CF09411E43CAF414ED985733125DA68C7B7E29E601F09ECC82C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BA0D57D3459E5640EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637ED2BA022FBF94AB68638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8713925CCC48A28F1CE9753B3E0F9A507117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAE9A1BBD95851C5BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751F618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6753C3A5E0A5AB5B7089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 8BD88D57C5CADBC8B2710865C3867510D915B5B670273ACBA3B1A56EE2B804F6B226C914C996894645FD9D8A29397D6EFF55FE49A3C2BFCFC8C84E951CD0BE2F296C473AB1E14218EA052B563B0B06C67866D6147AF826D8713925CCC48A28F1CE9753B3E0F9A507F972CCD2F8FE1EF1CFC4036BBF6A4EA9A607E00B4D674F02CB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34697E0FA301E282158B4A258764EFD0914986ED503216886C69E6CB1AFD3BF0214BD5F2F29E62CF9F1D7E09C32AA3244CDB17D3F77884A892845244F6FB6D93F939C99C45E8D137E9729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXiEX0g4jkpDtaamCgGMVd3R X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D44D548C67A68F009FB59625796543E90274CEFED1673C562683ABF942079399BFB559BB5D741EB966A65DFF43FF7BE03240331F90058701C67EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 05/20] net.box: use decode_tuple instead of decode_get 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" The only difference between the two is that the latter ensures that the response body has no more than one tuple. There's no point in this check, because get/min/max never return more than one tuple in Tarantool. Note, since decode_get was the only method returning an error, we don't need to set request.errno after calling a decoder anymore. --- src/box/lua/net_box.lua | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua index 9cb573f659b3..40bbf993a49a 100644 --- a/src/box/lua/net_box.lua +++ b/src/box/lua/net_box.lua @@ -73,13 +73,6 @@ local function decode_tuple(raw_data, raw_data_end, format) -- luacheck: no unus local response, raw_end = internal.decode_select(raw_data, nil, format) return response[1], raw_end end -local function decode_get(raw_data, raw_data_end, format) -- luacheck: no unused args - local body, raw_end = internal.decode_select(raw_data, nil, format) - if body[2] then - return nil, raw_end, box.error.MORE_THAN_ONE_TUPLE - end - return body[1], raw_end -end local function decode_count(raw_data) local response, raw_end = decode(raw_data) return response[IPROTO_DATA_KEY][1], raw_end @@ -137,9 +130,9 @@ local method_decoder = { execute = internal.decode_execute, prepare = internal.decode_prepare, unprepare = decode_nil, - get = decode_get, - min = decode_get, - max = decode_get, + get = decode_tuple, + min = decode_tuple, + max = decode_tuple, count = decode_count, inject = decode_data, } @@ -654,7 +647,7 @@ local function create_transport(host, port, user, password, callback, local real_end -- Decode xrow.body[DATA] to Lua objects if status == IPROTO_OK_KEY then - request.response, real_end, request.errno = + request.response, real_end = method_decoder[request.method](body_rpos, body_end, request.ctx) assert(real_end == body_end, "invalid body length") requests[id] = nil -- 2.25.1