Tarantool development patches archive
 help / color / mirror / Atom feed
From: Timur Safin <tsafin@tarantool.org>
To: v.shpilevoy@tarantool.org, alexander.turenko@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH 1/2] module api: proper documentation for the ibuf wrapper
Date: Thu, 22 Oct 2020 13:20:40 +0300	[thread overview]
Message-ID: <213dd4ecad3e83c9d1ef3821e38b5584b0636c66.1603360022.git.tsafin@tarantool.org> (raw)
In-Reply-To: <cover.1603360022.git.tsafin@tarantool.org>

We have extended module api as part of #5384 but there were
some complains that this part ofapi is not self-contained
and it's impossible to understand what's going on there
without looking into small/ibuf.[hc] sources.

Now we try to document the essential part of ibuf structure
so API should makes much more sense now.

Follow-up to #5384
---
 src/box/ibuf.h | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/box/ibuf.h b/src/box/ibuf.h
index 8c6d053c4..f411a13c9 100644
--- a/src/box/ibuf.h
+++ b/src/box/ibuf.h
@@ -40,19 +40,42 @@ extern "C" {
 
 /** \cond public */
 
+/**
+ * "@p box_ibuf_t is an opaque alias for struct @p ibuf
+ * defined in the small library.
+ *
+ * The structure is a buffer composing of several pointers and
+ * counters, which serve purpose of keeping 2 joint areas
+ * in buffer:
+ * - useful area [rpos, wpos)
+ * - and one, which is unused yet [wpos, end)
+ *
+ *        +---+--------+---------+
+ * buf -> |   |..used..|.unused..|
+ *        +---+--------+---------+
+ *            ^        ^         ^
+ *            rpos     wpos      end
+ *
+ */
 typedef struct ibuf box_ibuf_t;
 
 /**
- * Reserve requested amount of bytes in ibuf buffer
+ * Reserve requested amount of bytes in ibuf buffer.
+ *
  * @param ibuf buffer used for allocation
  * @param size allocated bytes
+ *
  * @retval NULL on error, check diag.
  */
 API_EXPORT void *
 box_ibuf_reserve(box_ibuf_t *ibuf, size_t size);
 
 /**
- * Return pointers to read range pointers used [rpos..wpos)
+ * Return pointers to read range pointers used [rpos..wpos).
+ *
+ * All arguments should be non-NULL, with exception of last one
+ * @p wpos which is optional and allows NULL.
+ *
  * @param ibuf ibuf structure
  * @param rpos where to place ibuf.rpos address
  * @param wpos where to place ibuf.wpos address
@@ -61,7 +84,11 @@ API_EXPORT void
 box_ibuf_read_range(box_ibuf_t *ibuf, char ***rpos, char ***wpos);
 
 /**
- * Return pointers to write range pointers used [wpos..end)
+ * Return pointers to write range pointers used [wpos..end).
+ *
+ * All arguments should be non-NULL, with exception of last one
+ * @p end which is optional and allows NULL.
+ *
  * @param ibuf ibuf structure
  * @param wpos where to place ibuf.rpos address
  * @param end where to place ibuf.wpos address
-- 
2.20.1

  reply	other threads:[~2020-10-22 10:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 10:20 [Tarantool-patches] [PATCH 0/2] module_api: followup changes for merger part Timur Safin
2020-10-22 10:20 ` Timur Safin [this message]
2020-10-22 10:20 ` [Tarantool-patches] [PATCH 2/2] module api: polish module_api test Timur Safin
2020-11-09  5:01   ` Alexander Turenko
2020-11-02 21:13 ` [Tarantool-patches] [PATCH 0/2] module_api: followup changes for merger part Vladislav Shpilevoy
2020-11-09  5:03 ` Alexander Turenko

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=213dd4ecad3e83c9d1ef3821e38b5584b0636c66.1603360022.git.tsafin@tarantool.org \
    --to=tsafin@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/2] module api: proper documentation for the ibuf wrapper' \
    /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