[PATCH 0/2] schema: expose space_mt and index_mt on table

Vladimir Davydov vdavydov.dev at gmail.com
Thu Mar 29 13:54:46 MSK 2018


On Fri, Mar 23, 2018 at 04:07:07PM +0300, Vladislav Shpilevoy wrote:
> Branch: http://github.com/tarantool/tarantool/tree/pr-3204-expose-space-index-mt
> Issue: https://github.com/tarantool/tarantool/issues/3204
> 
> Some of users want to extend space and index methods with their
> own, but do not want to do it for each space, because a metatable
> are created individually for a space.

I don't understand why anyone would do that. If one wants to
implement some extra methods, they can always create a wrapper
in Lua. Overwriting a metatable for this looks like a dirty hack.

Anyway, the patch is nearly impossible to review, because it is
basically a 100% diff. If you still think it's useful and really
want it to get reviewed, please split it properly: first move
index_mt and space_mt definitions from box.schema.space.bless
without introducing any functional changes, then export them.

> 
> Move these metatables to box.schema, and lookup into them, when
> a method was not found in an original metatable.
> 
> Vladislav Shpilevoy (1):
>   schema: review fixes for box.schema.space/index metatables
> 
> aleclarson (1):
>   schema: expose space_mt and index_mt on `box.schema` table
> 
>  src/box/lua/schema.lua          | 631 ++++++++++++++++++++--------------------
>  test/box-tap/schema_mt.test.lua |  79 +++++
>  2 files changed, 391 insertions(+), 319 deletions(-)
>  create mode 100755 test/box-tap/schema_mt.test.lua



More information about the Tarantool-patches mailing list