[PATCH 2/5] lua: port console yaml formatting to C

v.shpilevoy at tarantool.org v.shpilevoy at tarantool.org
Wed Mar 21 12:30:51 MSK 2018


>>> 
>>>> diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua
>>>> @@ -395,4 +375,6 @@ package.loaded['console'] = {
>>>>    on_start = on_start;
>>>>    on_client_disconnect = on_client_disconnect;
>>>>    completion_handler = internal.completion_handler;
>>>> +    formatter = internal.formatter;
>>> 
>>> I don't like that we export the serializer to Lua, but never use it in
>>> Lua code, only in C. Can't we create a serializer in C and pass it to
>>> the encoder function explicitly?
>> 
>> The problem of Lua formatter is that it is Lua table, not cdata. And
>> to fully port it on C it is necessary to rewrite luaL_serializer and
>> l_dump in lyaml.cc <http://lyaml.cc/>, that seems to be too
>> complicated for a single propose - format push message. But if you
>> insist, I can do full port.
> 
> I'm not sure... Obviously, I don't want you to rewrite the yaml encode.
> I just want to understand if there are alternatives to exporting the
> yaml encoder to the Lua console module, just to use it in C. Please take
> a look at how src/lua/msgpack.c is implemented - may be, we could borrow
> some ideas from it.

Ok, I will investigate.





More information about the Tarantool-patches mailing list