You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All we know a problem - netbox:call converts tuples to simple Lua tables.
And it's OK. In general I don't know source space and structure of received tuples.
But if I receive data from the space I know it will be great to have an interface
to convert result of my call directly to tuples with format.
Currently it looks like
netbox=require('net.box')
netboxlib=require('net.box.lib')
buffer=require('buffer')
msgpackffi=require('msgpackffi')
msgpack=require('msgpack')
ffi=require('ffi')
-- Introbox.cfg{listen=3301}
box.schema.user.passwd('admin', 'test')
s=box.schema.space.create('test')
s:format({{name='id', type='string'}, {name='value', type='string'}})
s:create_index('pk')
s:replace({'key', 'value'})
c=netbox.connect('admin:test@localhost:3301')
functionget()
returns:select()
end-- Byte jugglingcall_buffer=buffer.ibuf()
c:call('get', {}, {buffer=call_buffer, skip_header=true})
-- After that I have a buffer-- And I want to have an interface to directly deserialize this buffer-- to tuples.-- But I should wrap it with [IPROTO_DATA] header into map.len, call_buffer.rpos=msgpack.decode_array_header(call_buffer.rpos, call_buffer:size())
buf=buffer.ibuf()
encode_fix=msgpackffi.internal.encode_fixencode_r=msgpackffi.internal.encode_rencode_fix(buf, 0x80, 1)
encode_r(buf, 0x30, 1)
wpos=buf:alloc(call_buffer:size())
ffi.copy(wpos, call_buffer.rpos, call_buffer:size())
tarantool>netboxlib.decode_select(buf.rpos, nil, c.space.test._format_cdata)
----- ['key', 'value']
-'cdata<char *>: 0x010586803e'...tarantool>tuples=netboxlib.decode_select(buf.rpos, nil, c.space.test._format_cdata)
---...tarantool>tuples----- ['key', 'value']
...tarantool>tuples[1]
---- ['key', 'value']
...tarantool>tuples[1]:tomap()
----1: key2: valuevalue: valueid: key...
The text was updated successfully, but these errors were encountered:
All we know a problem - netbox:call converts tuples to simple Lua tables.
And it's OK. In general I don't know source space and structure of received tuples.
But if I receive data from the space I know it will be great to have an interface
to convert result of my call directly to tuples with format.
Currently it looks like
The text was updated successfully, but these errors were encountered: