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 11AF56EC5C; Fri, 23 Jul 2021 14:14:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 11AF56EC5C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627038874; bh=YR7g3uZBOsw2m4dBJFprngrZgzIAJQvs7QkUoc7G4o0=; 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=FfkwpHhAhP9//rQgnsuNHAqXGUe7rmqs/McxGyz/1C1R4C1eW2DCmb0C41Gqf8D69 N4Y1CpF7krQNhEJwA+MnlglEmtXhZsfo+3hNSszuJRg1XqOyhx1W8SsMBiPU0blC/b y3JSPT6Qd2DogfwG1R/l+FZV6Rrn3wGMEVrAZ2lY= 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 79A4E6F3F1 for ; Fri, 23 Jul 2021 14:07:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 79A4E6F3F1 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1m6t1y-0004dl-1Q; Fri, 23 Jul 2021 14:07:50 +0300 To: tarantool-patches@dev.tarantool.org Date: Fri, 23 Jul 2021 14:07:24 +0300 Message-Id: <05054979c18e3ca6360277eb415f612131dc569e.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-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD941C43E597735A9C36A98DBA789EBB6AEFB5A483DCE5E7579182A05F5380850407CFFCECD9FF802138A7E6865B4109861B07B465023398E2EC4BAE2802260691D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE764C944B6AA401A18EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637B8CD1D12629438CE8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8EC41D802C90E9F5B0BA9D4BE2559B597117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6045A9A90E9EED90B089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C16CF367659D795C0E0901DDA04F3DE69DFBEFDE95F98642A9C2B6934AE262D3EE7EAB7254005DCED2A499C60874B75F11E0A4E2319210D9B64D260DF9561598F01A9E91200F654B02CB9166B85A600698E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3483E1FCD56FEA62E64EC7EE04EC97A75FC96042C46A0FB0F0818BBD3AD85AF03B28BD99918A9986FA1D7E09C32AA3244CDA97C06F9698B055B3E589067F7D825E3FD9C8CA1B0515E0729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXiEX0g4jkpDtSgfNgSP1cQU X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DBD28E1BBF1AD3B02326855564C355BD0274CEFED1673C562683ABF942079399BFB559BB5D741EB966A65DFF43FF7BE03240331F90058701C67EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 14/20] net.box: rename netbox_{prepare, encode}_request to {begin, end} 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" netbox_encode_request is a confusing name - the function doesn't encode a request, it just writes the actual request size to the fix header. Let's rename the two functions to netbox_begin_request and netbox_end_request to emphasize that they are used to start and finish request encoding. Another reason to do that now is that in the following patches we will be moving the request table implementation from Lua to C so having a "request" in the function names would be confusing. --- src/box/lua/net_box.c | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/box/lua/net_box.c b/src/box/lua/net_box.c index 12d82738a050..122d69e9219e 100644 --- a/src/box/lua/net_box.c +++ b/src/box/lua/net_box.c @@ -77,10 +77,10 @@ enum netbox_method { }; static inline size_t -netbox_prepare_request(struct mpstream *stream, uint64_t sync, - enum iproto_type type) +netbox_begin_encode(struct mpstream *stream, uint64_t sync, + enum iproto_type type) { - /* Remember initial size of ibuf (see netbox_encode_request()) */ + /* Remember initial size of ibuf (see netbox_end_encode()) */ struct ibuf *ibuf = (struct ibuf *) stream->ctx; size_t used = ibuf_used(ibuf); @@ -103,7 +103,7 @@ netbox_prepare_request(struct mpstream *stream, uint64_t sync, } static inline void -netbox_encode_request(struct mpstream *stream, size_t initial_size) +netbox_end_encode(struct mpstream *stream, size_t initial_size) { mpstream_flush(stream); @@ -135,8 +135,8 @@ netbox_encode_ping(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, IPROTO_PING); - netbox_encode_request(&stream, svp); + size_t svp = netbox_begin_encode(&stream, sync, IPROTO_PING); + netbox_end_encode(&stream, svp); } static int @@ -152,7 +152,7 @@ netbox_encode_auth(lua_State *L) struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, IPROTO_AUTH); + size_t svp = netbox_begin_encode(&stream, sync, IPROTO_AUTH); size_t user_len; const char *user = lua_tolstring(L, 3, &user_len); @@ -176,7 +176,7 @@ netbox_encode_auth(lua_State *L) mpstream_encode_strn(&stream, scramble, SCRAMBLE_SIZE); } - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); return 0; } @@ -188,7 +188,7 @@ netbox_encode_call_impl(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync, struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, type); + size_t svp = netbox_begin_encode(&stream, sync, type); mpstream_encode_map(&stream, 2); @@ -202,7 +202,7 @@ netbox_encode_call_impl(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync, mpstream_encode_uint(&stream, IPROTO_TUPLE); luamp_encode_tuple(L, cfg, &stream, idx + 1); - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); } static void @@ -224,7 +224,7 @@ netbox_encode_eval(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, IPROTO_EVAL); + size_t svp = netbox_begin_encode(&stream, sync, IPROTO_EVAL); mpstream_encode_map(&stream, 2); @@ -238,7 +238,7 @@ netbox_encode_eval(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) mpstream_encode_uint(&stream, IPROTO_TUPLE); luamp_encode_tuple(L, cfg, &stream, idx + 1); - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); } static void @@ -248,7 +248,7 @@ netbox_encode_select(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, IPROTO_SELECT); + size_t svp = netbox_begin_encode(&stream, sync, IPROTO_SELECT); mpstream_encode_map(&stream, 6); @@ -282,7 +282,7 @@ netbox_encode_select(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) mpstream_encode_uint(&stream, IPROTO_KEY); luamp_convert_key(L, cfg, &stream, idx + 5); - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); } static void @@ -293,7 +293,7 @@ netbox_encode_insert_or_replace(lua_State *L, int idx, struct ibuf *ibuf, struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, type); + size_t svp = netbox_begin_encode(&stream, sync, type); mpstream_encode_map(&stream, 2); @@ -306,7 +306,7 @@ netbox_encode_insert_or_replace(lua_State *L, int idx, struct ibuf *ibuf, mpstream_encode_uint(&stream, IPROTO_TUPLE); luamp_encode_tuple(L, cfg, &stream, idx + 1); - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); } static void @@ -328,7 +328,7 @@ netbox_encode_delete(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, IPROTO_DELETE); + size_t svp = netbox_begin_encode(&stream, sync, IPROTO_DELETE); mpstream_encode_map(&stream, 3); @@ -346,7 +346,7 @@ netbox_encode_delete(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) mpstream_encode_uint(&stream, IPROTO_KEY); luamp_convert_key(L, cfg, &stream, idx + 2); - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); } static void @@ -356,7 +356,7 @@ netbox_encode_update(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, IPROTO_UPDATE); + size_t svp = netbox_begin_encode(&stream, sync, IPROTO_UPDATE); mpstream_encode_map(&stream, 5); @@ -382,7 +382,7 @@ netbox_encode_update(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) mpstream_encode_uint(&stream, IPROTO_TUPLE); luamp_encode_tuple(L, cfg, &stream, idx + 3); - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); } static void @@ -392,7 +392,7 @@ netbox_encode_upsert(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, IPROTO_UPSERT); + size_t svp = netbox_begin_encode(&stream, sync, IPROTO_UPSERT); mpstream_encode_map(&stream, 4); @@ -413,7 +413,7 @@ netbox_encode_upsert(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) mpstream_encode_uint(&stream, IPROTO_OPS); luamp_encode_tuple(L, cfg, &stream, idx + 2); - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); } static int @@ -631,7 +631,7 @@ netbox_encode_execute(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, IPROTO_EXECUTE); + size_t svp = netbox_begin_encode(&stream, sync, IPROTO_EXECUTE); mpstream_encode_map(&stream, 3); @@ -652,7 +652,7 @@ netbox_encode_execute(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) mpstream_encode_uint(&stream, IPROTO_OPTIONS); luamp_encode_tuple(L, cfg, &stream, idx + 2); - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); } static void @@ -662,7 +662,7 @@ netbox_encode_prepare(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) struct mpstream stream; mpstream_init(&stream, ibuf, ibuf_reserve_cb, ibuf_alloc_cb, luamp_error, L); - size_t svp = netbox_prepare_request(&stream, sync, IPROTO_PREPARE); + size_t svp = netbox_begin_encode(&stream, sync, IPROTO_PREPARE); mpstream_encode_map(&stream, 1); @@ -677,7 +677,7 @@ netbox_encode_prepare(lua_State *L, int idx, struct ibuf *ibuf, uint64_t sync) mpstream_encode_strn(&stream, query, len); }; - netbox_encode_request(&stream, svp); + netbox_end_encode(&stream, svp); } static void -- 2.25.1