From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 8A707469719 for ; Tue, 29 Sep 2020 01:21:00 +0300 (MSK) References: From: Vladislav Shpilevoy Message-ID: <8f0dfb00-0dbe-6717-1c36-90957a072751@tarantool.org> Date: Tue, 29 Sep 2020 00:20:57 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 2.X 1/7] module api: export box_tuple_validate List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Timur Safin , alexander.turenko@tarantool.org Cc: tarantool-patches@dev.tarantool.org Hi! Thanks for the patch! See 2 comments below. On 24.09.2020 19:00, Timur Safin wrote: > For external merger we need means to valudate tuple data, 1. valudate -> validate. > thus exporting `box_tuple_validate` which is wrapper around > `tuple_validate_raw` without revealing access to tuple > internals. > > diff --git a/src/box/tuple.h b/src/box/tuple.h > index 53ae690cc..ed0501464 100644 > --- a/src/box/tuple.h > +++ b/src/box/tuple.h > @@ -283,6 +283,17 @@ box_tuple_update(box_tuple_t *tuple, const char *expr, const char *expr_end); > box_tuple_t * > box_tuple_upsert(box_tuple_t *tuple, const char *expr, const char *expr_end); > > +/** > + * Check tuple data correspondence to the space format. > + * @param format Format to which the tuple must match. > + * @param tuple Tuple to validate. > + * > + * @retval 0 The tuple is valid. > + * @retval -1 The tuple is invalid. I see you are a doxygen-master, nice. > + */ > +int > +box_tuple_validate(box_tuple_format_t *format, box_tuple_t *tuple); 2. OCD mode on. I would propose either make tuple the first argument, or rename it to box_tuple_format_validate_tuple(). So as to be consistent with our agreement, that if something is a method of , then the argument goes first, and the method name is _. I see we currently have in the public API the functions: box_tuple_validate - your new function, a bit inconsistent. box_tuple_validate_key_parts - this should have been box_key_def_validate_tuple from the beginning, but we can't do anything about it now. box_key_def_validate_key - correct. Key_def goes first, and the name is consistent. So if you will make box_tuple_validate consistent, we will have more correct signatures (2/3) than incorrect, for validation methods at least.