Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH v3 0/4] box.session.push
Date: Fri,  1 Jun 2018 23:55:54 +0300	[thread overview]
Message-ID: <cover.1527886471.git.v.shpilevoy@tarantool.org> (raw)

Branch: http://github.com/tarantool/tarantool/tree/gh-2677-box-session-push
Issue: https://github.com/tarantool/tarantool/issues/2677

Sometimes it is needed to send some intermediate results from long poll request.
Or to create a watcher on a server side, which listens for some events and sends
notifications to a client. Or split a big response into multiple ones, as it is
described in Tarantool Wire Protocol RFC.

IPROTO_CHUNK protocol command solves all of the problems. IPROTO_CHUNK is a
non-final response, and a single request can produce multiple response chunks.
Box.session.push is API to send a chunk. It takes a Lua object and sends it to
a client using the way depending of a session type: console or binary.

Console session pushes are YAML documents tagged with using YAML %TAG feature -
push message is tagged with !push! tag. For example:
tarantool> box.session.push({a = 100, b = 200})
%TAG !push! tag:tarantool.io/push,2018
---       <--------- Here pushed message starts.
a: 100
b: 200
...
---       <--------- Here push() call result starts.
- true
...
It is not the same as future console.print() pushes - they are not linked with
chunks.

Binary push is an IProto response with IPROTO_CHUNK key in the REQUEST_TYPE
header field. In the rest it has the same structure as any another response.

IPROTO_CHUNK response must have the same sync as a request, and to avoid
specifying it in the box.session.push() API, that is ugly, the request sync is
stored in the local storage of the fiber that executes the request. Sync key
does not extend the storage size - instead it shares one of storage cells with
another fiber local variable, that is never used in IProto sessions.

Vladislav Shpilevoy (4):
  session: introduce text box.session.push
  session: enable box.session.push in local console
  session: introduce binary box.session.push
  netbox: introduce iterable future objects

 src/box/iproto.cc             | 241 +++++++++++++++++-----
 src/box/iproto_constants.h    |   3 +
 src/box/lua/call.c            |   4 +
 src/box/lua/console.c         |  75 ++++++-
 src/box/lua/console.lua       |  29 ++-
 src/box/lua/net_box.lua       | 188 ++++++++++++++---
 src/box/lua/session.c         |   6 +-
 src/box/port.c                |   7 +
 src/box/port.h                |  17 ++
 src/box/xrow.c                |  12 ++
 src/box/xrow.h                |  12 ++
 src/diag.h                    |   3 +
 src/fiber.h                   |  14 +-
 src/sio.cc                    |  16 ++
 test/app-tap/console.test.lua |   6 +-
 test/box/net.box.result       |   8 +-
 test/box/net.box.test.lua     |   8 +-
 test/box/push.result          | 461 ++++++++++++++++++++++++++++++++++++++++--
 test/box/push.test.lua        | 227 +++++++++++++++++++--
 19 files changed, 1218 insertions(+), 119 deletions(-)

-- 
2.15.1 (Apple Git-101)

             reply	other threads:[~2018-06-01 20:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 20:55 Vladislav Shpilevoy [this message]
2018-06-01 20:55 ` [tarantool-patches] [PATCH v3 1/4] session: introduce text box.session.push Vladislav Shpilevoy
2018-06-01 20:55 ` [tarantool-patches] [PATCH v3 2/4] session: enable box.session.push in local console Vladislav Shpilevoy
2018-06-01 20:55 ` [tarantool-patches] [PATCH v3 3/4] session: introduce binary box.session.push Vladislav Shpilevoy
2018-06-07 12:53   ` [tarantool-patches] " Konstantin Osipov
2018-06-07 17:02     ` Vladislav Shpilevoy
2018-06-08  3:51       ` Konstantin Osipov
2018-06-01 20:55 ` [tarantool-patches] [PATCH v3 4/4] netbox: introduce iterable future objects Vladislav Shpilevoy
2018-06-07 12:56   ` [tarantool-patches] " Konstantin Osipov
2018-06-07 17:02     ` Vladislav Shpilevoy
2018-06-08  3:52       ` Konstantin Osipov
2018-06-08 14:20         ` Vladislav Shpilevoy

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=cover.1527886471.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH v3 0/4] box.session.push' \
    /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