Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun <skaplun@tarantool.org>
To: Sergey Ostanevich <sergos@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit v2 2/7] core: introduce write buffer module
Date: Sat, 26 Dec 2020 22:37:41 +0300	[thread overview]
Message-ID: <20201226193741.GY9101@root> (raw)
In-Reply-To: <AB2DFB69-D86C-4C00-8A27-949C50BEE88E@tarantool.org>

Hi!

Thanks for the review!

On 26.12.20, Sergey Ostanevich wrote:
> Hi! 
> 
> Thanks for the patch!
> 
> Just one problem and LGTM otherwise.
> 
> Sergos
> 
> > --- a/src/lj_wbuf.h
> > +++ b/src/lj_wbuf.h
> > @@ -31,32 +31,32 @@
> > #define STREAM_ERR_IO 0x1
> > #define STREAM_STOP   0x2
> > 
> > +/*
> > +** Buffer writer which is called on the buffer flush.
> > +** Should return amount of written bytes on success or zero in case of error.
> > +** *data should contain a buffer of at least the initial size.
> 
> Does it mean the writer’s provider should preserve the ‘initial size’ is some way?

Yes, inside `ctx`, for example.

> Should it create two or more buffers of the same size during initialization?

If necessary, but it is not required. This is the user's responsibility.

> 
> > +** If *data == NULL stream stops.
> > +*/
> > typedef size_t (*lj_wbuf_writer)(const void **data, size_t len, void *opt);
> > 
> > /* Write buffer. */
> > struct lj_wbuf {
> > -  /*
> > -  ** Buffer writer which will called at buffer write.
> > -  ** Should return amount of written bytes on success or zero in case of error.
> > -  ** *data should contain new buffer of size greater or equal to len.
> > -  ** If *data == NULL stream stops.
> > -  */
> >   lj_wbuf_writer writer;
> >   /* Context for writer function. */
> >   void *ctx;
> >   /* Buffer size. */
> >   size_t size;
> > -  /* Saved errno in case of error. */
> > -  int saved_errno;
> >   /* Start of buffer. */
> >   uint8_t *buf;
> >   /* Current position in buffer. */
> >   uint8_t *pos;
> > +  /* Saved errno in case of error. */
> > +  int saved_errno;
> >   /* Internal flags. */
> >   volatile uint8_t flags;
> > };
> > 
> > -/* Init buffer. */
> > +/* Initialize the buffer. */
> > void lj_wbuf_init(struct lj_wbuf *buf, lj_wbuf_writer writer, void *ctx,
> > 		  uint8_t *mem, size_t size);
> > 
> > ===================================================================
> > 
> > -- 
> > Best regards,
> > Sergey Kaplun
> 

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2020-12-26 19:38 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25 15:26 [Tarantool-patches] [PATCH luajit v2 0/7] LuaJIT memory profiler Sergey Kaplun
2020-12-25 15:26 ` [Tarantool-patches] [PATCH luajit v2 1/7] utils: introduce leb128 reader and writer Sergey Kaplun
2020-12-25 21:42   ` Igor Munkin
2020-12-26  9:32     ` Sergey Kaplun
2020-12-26 13:57       ` Sergey Kaplun
2020-12-26 18:47         ` Sergey Ostanevich
2020-12-25 15:26 ` [Tarantool-patches] [PATCH luajit v2 2/7] core: introduce write buffer module Sergey Kaplun
2020-12-26 14:22   ` Igor Munkin
2020-12-26 15:26     ` Sergey Kaplun
2020-12-26 19:03       ` Sergey Ostanevich
2020-12-26 19:37         ` Sergey Kaplun [this message]
2020-12-28  1:43           ` Sergey Kaplun
2020-12-25 15:26 ` [Tarantool-patches] [PATCH luajit v2 3/7] vm: introduce VM states for Lua and fast functions Sergey Kaplun
2020-12-26 19:07   ` Sergey Ostanevich
2020-12-27 23:48   ` Igor Munkin
2020-12-28  3:54     ` Sergey Kaplun
2020-12-25 15:26 ` [Tarantool-patches] [PATCH luajit v2 4/7] core: introduce new mem_L field Sergey Kaplun
2020-12-26 19:12   ` Sergey Ostanevich
2020-12-26 19:42     ` Sergey Kaplun
2020-12-27 13:09   ` Igor Munkin
2020-12-27 17:44     ` Sergey Kaplun
2020-12-25 15:26 ` [Tarantool-patches] [PATCH luajit v2 5/7] core: introduce memory profiler Sergey Kaplun
2020-12-27 10:58   ` Sergey Ostanevich
2020-12-27 11:54     ` Sergey Kaplun
2020-12-27 13:27       ` Sergey Ostanevich
2020-12-27 16:44   ` Igor Munkin
2020-12-27 21:47     ` Sergey Kaplun
2020-12-25 15:26 ` [Tarantool-patches] [PATCH luajit v2 6/7] misc: add Lua API for " Sergey Kaplun
2020-12-27 11:54   ` Sergey Ostanevich
2020-12-27 13:42     ` Sergey Kaplun
2020-12-27 15:37       ` Sergey Ostanevich
2020-12-27 18:58   ` Igor Munkin
2020-12-28  0:14     ` Sergey Kaplun
2020-12-25 15:26 ` [Tarantool-patches] [PATCH luajit v2 7/7] tools: introduce a memory profile parser Sergey Kaplun
2020-12-26 22:56   ` Igor Munkin
2020-12-27  7:16     ` Sergey Kaplun
2020-12-28  5:30       ` Sergey Kaplun
2020-12-28  5:33         ` Igor Munkin
2020-12-28  6:28           ` Sergey Kaplun
2020-12-28  6:31             ` Igor Munkin
2020-12-27 13:24   ` Sergey Ostanevich
2020-12-27 16:02     ` Sergey Kaplun
2020-12-27 21:55       ` Sergey Ostanevich
2020-12-28  2:05 ` [Tarantool-patches] [PATCH luajit v3 2/2] misc: add Lua API for memory profiler Sergey Kaplun
2020-12-28  2:49   ` Igor Munkin
2020-12-28  5:19     ` Sergey Kaplun
2020-12-28  2:06 ` [Tarantool-patches] [PATCH luajit v3 1/2] core: introduce " Sergey Kaplun
2020-12-28  3:59   ` Igor Munkin
2020-12-28  4:05 ` [Tarantool-patches] [PATCH luajit v3 3/7] vm: introduce VM states for Lua and fast functions Sergey Kaplun
2020-12-28  5:14   ` Igor Munkin
2020-12-28  6:01 ` [Tarantool-patches] [PATCH luajit v2 0/7] LuaJIT memory profiler Alexander V. Tikhonov
2020-12-28  8:15 ` Igor Munkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201226193741.GY9101@root \
    --to=skaplun@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit v2 2/7] core: introduce write buffer module' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox