schema: expose space_mt and index_mt on box.schema table
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. On the other hand local space/index metatables still can be extended individually to save compatibility with existing modules. Routinely space/index metatable is just a proxy for a global mt. When a user attempts to extend a space or index methods via local space/index metatable instead of from box.schema mt, the local metatable is transformed. Its __index metamethod starts looking up at first in self, and only then into the global mt. Closes #3204
Loading
Please register or sign in to comment