From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 4320E241EF for ; Tue, 8 May 2018 13:33:29 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 40tP0i5fe9d8 for ; Tue, 8 May 2018 13:33:29 -0400 (EDT) Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E833E241EB for ; Tue, 8 May 2018 13:33:28 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v2 3/3] schema: expose space_mt and index_mt on box.schema table References: <20180402112843.k5szaedwomi4gtl3@esperanza> <8053011f0e2036fdb811dd7ad6097ccc150b76d0.1522774214.git.v.shpilevoy@tarantool.org> <20180508164814.GC20248@atlas> From: Vladislav Shpilevoy Message-ID: Date: Tue, 8 May 2018 20:33:25 +0300 MIME-Version: 1.0 In-Reply-To: <20180508164814.GC20248@atlas> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: Konstantin Osipov Cc: tarantool-patches@freelists.org Hello. Thanks for review! On 08/05/2018 19:48, Konstantin Osipov wrote: > * Vladislav Shpilevoy [18/05/05 23:23]: > > This branch breaks app/luafun.test.lua Sorry, just noticed that my auto test-runner script skips app/ directory. Fixed on the branch. The problem was that luafun expects that space/index metatable contains __ipairs/__pairs metamethods with not proxy via __index. @@ -1449,7 +1449,12 @@ box.schema.space_mt = space_mt -- up at first in self, and only then into the global mt. -- local function wrap_schema_object_mt(name) - local mt = { __index = box.schema[name] } + local global_mt = box.schema[name] + local mt = { + __index = global_mt, + __ipairs = global_mt.__ipairs, + __pairs = global_mt.__pairs + } local mt_mt = {} mt_mt.__newindex = function(t, k, v) mt_mt.__newindex = nil > >> Users requested to be able to extend spaces individually. The >> patch was reworked to allow this. >> >> On 03/04/2018 19:50, Vladislav Shpilevoy wrote: >>> This commit allows userland to extend the space and index >>> metatables with their own functions or even metamethods. Reducing >>> barriers for this kind of experimentation is vital for user >>> contribution toward the improvement of Tarantool's API. >>> >>> There are 4 metatables available for extending: >>> box.schema.space_mt - metatable of all spaces; >>> box.schema.index_mt - base metatable of all indexes - replicated >>> into the vinyl and memtx. See below how. >>> box.schema.vinyl_index_mt - metatable of all vinyl indexes; >>> box.schema.memtx_index_mt - metatable of all memtx indexes. >>> >>> Closes #3204 >