From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladislav Shpilevoy Subject: [PATCH v2 07/10] port: rename dump() into dump_msgpack() Date: Fri, 20 Apr 2018 16:24:32 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: tarantool-patches@freelists.org Cc: vdavydov.dev@gmail.com List-ID: In #2677 a port must be able to dump both msgpack into obuf for binary box.session.push(), and text with no obuf for text box.session.push. --- src/box/iproto.cc | 6 +++--- src/box/lua/call.c | 4 ++-- src/box/port.c | 18 +++++++++--------- src/box/port.h | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/box/iproto.cc b/src/box/iproto.cc index a284368d3..38baf1b8d 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -1233,7 +1233,7 @@ tx_process_select(struct cmsg *m) /* * SELECT output format has not changed since Tarantool 1.6 */ - count = port_dump_16(&port, out); + count = port_dump_msgpack_16(&port, out); port_destroy(&port); if (count < 0) { /* Discard the prepared select. */ @@ -1323,9 +1323,9 @@ tx_process_call(struct cmsg *m) } if (msg->header.type == IPROTO_CALL_16) - count = port_dump_16(&port, out); + count = port_dump_msgpack_16(&port, out); else - count = port_dump(&port, out); + count = port_dump_msgpack(&port, out); port_destroy(&port); if (count < 0) { obuf_rollback_to_svp(out, &svp); diff --git a/src/box/lua/call.c b/src/box/lua/call.c index be13812aa..2f5c9deec 100644 --- a/src/box/lua/call.c +++ b/src/box/lua/call.c @@ -416,8 +416,8 @@ port_lua_destroy(struct port *base) } static const struct port_vtab port_lua_vtab = { - .dump = port_lua_dump, - .dump_16 = port_lua_dump_16, + .dump_msgpack = port_lua_dump, + .dump_msgpack_16 = port_lua_dump_16, .destroy = port_lua_destroy, }; diff --git a/src/box/port.c b/src/box/port.c index 03f6be79d..255eb732c 100644 --- a/src/box/port.c +++ b/src/box/port.c @@ -96,7 +96,7 @@ port_tuple_destroy(struct port *base) } static int -port_tuple_dump_16(struct port *base, struct obuf *out) +port_tuple_dump_msgpack_16(struct port *base, struct obuf *out) { struct port_tuple *port = port_tuple(base); struct port_tuple_entry *pe; @@ -113,14 +113,14 @@ port_tuple_dump_16(struct port *base, struct obuf *out) } static int -port_tuple_dump(struct port *base, struct obuf *out) +port_tuple_dump_msgpack(struct port *base, struct obuf *out) { struct port_tuple *port = port_tuple(base); char *size_buf = obuf_alloc(out, mp_sizeof_array(port->size)); if (size_buf == NULL) return -1; mp_encode_array(size_buf, port->size); - if (port_tuple_dump_16(base, out) < 0) + if (port_tuple_dump_msgpack_16(base, out) < 0) return -1; return 1; } @@ -132,15 +132,15 @@ port_destroy(struct port *port) } int -port_dump(struct port *port, struct obuf *out) +port_dump_msgpack(struct port *port, struct obuf *out) { - return port->vtab->dump(port, out); + return port->vtab->dump_msgpack(port, out); } int -port_dump_16(struct port *port, struct obuf *out) +port_dump_msgpack_16(struct port *port, struct obuf *out) { - return port->vtab->dump_16(port, out); + return port->vtab->dump_msgpack_16(port, out); } void @@ -157,7 +157,7 @@ port_free(void) } const struct port_vtab port_tuple_vtab = { - .dump = port_tuple_dump, - .dump_16 = port_tuple_dump_16, + .dump_msgpack = port_tuple_dump_msgpack, + .dump_msgpack_16 = port_tuple_dump_msgpack_16, .destroy = port_tuple_destroy, }; diff --git a/src/box/port.h b/src/box/port.h index 7cf3339b5..1c44b9b00 100644 --- a/src/box/port.h +++ b/src/box/port.h @@ -70,12 +70,12 @@ struct port_vtab { * On success returns number of entries dumped. * On failure sets diag and returns -1. */ - int (*dump)(struct port *port, struct obuf *out); + int (*dump_msgpack)(struct port *port, struct obuf *out); /** - * Same as dump(), but use the legacy Tarantool 1.6 - * format. + * Same as dump_msgpack(), but use the legacy Tarantool + * 1.6 format. */ - int (*dump_16)(struct port *port, struct obuf *out); + int (*dump_msgpack_16)(struct port *port, struct obuf *out); /** * Destroy a port and release associated resources. */ @@ -149,14 +149,14 @@ port_destroy(struct port *port); * Return number of entries dumped on success, -1 on error. */ int -port_dump(struct port *port, struct obuf *out); +port_dump_msgpack(struct port *port, struct obuf *out); /** * Same as port_dump(), but use the legacy Tarantool 1.6 * format. */ int -port_dump_16(struct port *port, struct obuf *out); +port_dump_msgpack_16(struct port *port, struct obuf *out); void port_init(void); -- 2.15.1 (Apple Git-101)