Discussion:
issue with writing transform plugin
Gaurav Bansal
2017-06-16 04:45:58 UTC
Permalink
hi all,

We are writing a transform plugin where we get the data from server and
copying the data to the output_buffer as follows :
*TSIOBufferCopy*(output_buffer, TSVIOReaderGet(write_vio), towrite, 0);

Then after doing some checks on the data, we want to send some data (only
some data of output_buffer on which checks have been performed) in
output_buffer to the client. For this, we are using following api.
TSVIO *TSVConnWrite*(TSVConn connp, TSCont contp, TSIOBufferReader readerp,
int64_t nbytes)

We are finding one problem with the usage of above api. By using above api,
all the data in output_buffer is send back to the client while we want only
a portion of output_buffer (that portion on which the checks have been
performed so far) to be sent to client. Is there any similar api where we
can specify the offset & length of the data to be sent to client. OR is
there some other better way to handle this ? We could have taken another
buffer to store the incoming data and then after performing checks, write
only that data to the output_buffer which we want to send to the client.
But we want to avoid using a new buffer.

can anyone please help me solve the above problem ?
thanks,
gaurav
Nick Kew
2017-06-16 09:00:42 UTC
Permalink
Post by Gaurav Bansal
Then after doing some checks on the data, we want to send some data
(only some data of output_buffer on which checks have been performed)
in output_buffer to the client.
Are you perhaps looking for TSVIONBytesSet on your output buffer?

The stream-editor plugin I recently mentioned in response to
another question would be one place to see usage, as it
meticulously manages bytes-out vs bytes-in in the context
of editing a data stream.
--
Nick Kew
Gaurav Bansal
2017-06-17 12:26:12 UTC
Permalink
Thanks Nick Kew for the info. Will have a look at your stream-editor plugin
and get back.
Post by Nick Kew
Post by Gaurav Bansal
Then after doing some checks on the data, we want to send some data
(only some data of output_buffer on which checks have been performed)
in output_buffer to the client.
Are you perhaps looking for TSVIONBytesSet on your output buffer?
The stream-editor plugin I recently mentioned in response to
another question would be one place to see usage, as it
meticulously manages bytes-out vs bytes-in in the context
of editing a data stream.
--
Nick Kew
Continue reading on narkive:
Loading...