From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [tarantool-patches] Re: [PATCH v4 4/4] box: introduce functional indexes References: <20190724210731.GA11790@atlas> From: Kirill Shcherbatov Message-ID: Date: Thu, 25 Jul 2019 11:27:27 +0300 MIME-Version: 1.0 In-Reply-To: <20190724210731.GA11790@atlas> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: tarantool-patches@freelists.org, Konstantin Osipov Cc: Vladimir Davydov List-ID: > I don't understand why you force the user of this module to first > create a temporary buffer, then iterate over this buffer to create > hint objects. Why can't this function return an iterator right > away, and the iterator itself could return hint_t objects already, > not individual keys? E.g. in :replace/delete part we don't need a persistent memory chunk: we need to evaluate function and iterate over the returned keys to perform a deletion. =========================================== key_list = key_list_create(old_tuple, cmp_def->func_index_func, &key_list_end, &key_cnt); if (key_list == NULL) goto end; struct memtx_tree_data data, deleted_data; data.tuple = old_tuple; key_list_iterator_create(&it, key_list, key_list_end, cmp_def, true); const char *key; uint32_t key_sz; while (key_list_iterator_next(&it, &key, &key_sz) == 0 && key != NULL) { data.hint = (hint_t) key; /* Raw data. */ deleted_data.tuple = NULL; memtx_tree_delete_value(&index->tree, data, &deleted_data); .....