Using a buffer for requests¶
You may need a stream buffer (tnt_buf
) if you don’t need the networking
functionality of tnt_net
, but you need to write requests or parse replies.
Creating a buffer¶
-
struct tnt_stream *
tnt_buf
(struct tnt_stream *s)¶ Create a stream buffer.
-
struct tnt_stream *
tnt_buf_as
(struct tnt_stream *s, char *buf, size_t buf_len)¶ Create an immutable stream buffer from the buffer
buf
. It can be used for parsing responses.
Writing requests¶
Use the basic functions for building requests:
tnt_select()
/tnt_insert()
(see “Building a request with “tnt_stream””)struct tnt_request
/tnt_request_compile()
(see “Building a request with “tnt_request””)
Parsing replies¶
Use an iterator to iterate through replies in your stream buffer,
or use the stream’s read_reply()
method
(stream->read_reply(struct tnt_stream *stream, struct tnt_reply *reply)
).