Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: vdavydov.dev@gmail.com
Subject: [PATCH 2/8] box: rename process_rw to process_dml
Date: Wed,  8 Aug 2018 01:03:45 +0300	[thread overview]
Message-ID: <92068d7f9e7fe5f5c912d7899e1c68707479fadf.1533679264.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1533679264.git.v.shpilevoy@tarantool.org>
In-Reply-To: <cover.1533679264.git.v.shpilevoy@tarantool.org>

This fixes the mess of rw/dml/1 notions. In iproto_msg we have
dml, that is executed via process1, thar calls process_rw,
that calls space_execute_dml. Lets just rename all these things
to dml.
---
 src/box/box.cc    | 20 ++++++++++----------
 src/box/box.h     | 14 ++++++++------
 src/box/iproto.cc |  2 +-
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/box/box.cc b/src/box/box.cc
index ee12d5738..6eb358442 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -161,7 +161,7 @@ box_check_memtx_min_tuple_size(ssize_t memtx_min_tuple_size)
 }
 
 static int
-process_rw(struct request *request, struct space *space, struct tuple **result)
+process_dml(struct request *request, struct space *space, struct tuple **result)
 {
 	assert(iproto_type_is_dml(request->type));
 	rmean_collect(rmean_box, request->type, 1);
@@ -301,7 +301,7 @@ apply_row(struct xstream *stream, struct xrow_header *row)
 		return;
 	}
 	struct space *space = space_cache_find_xc(request.space_id);
-	if (process_rw(&request, space, NULL) != 0) {
+	if (process_dml(&request, space, NULL) != 0) {
 		say_error("error applying row: %s", request_str(&request));
 		diag_raise();
 	}
@@ -901,7 +901,7 @@ boxk(int type, uint32_t space_id, const char *format, ...)
 	struct space *space = space_cache_find(space_id);
 	if (space == NULL)
 		return -1;
-	return process_rw(&request, space, NULL);
+	return process_dml(&request, space, NULL);
 }
 
 int
@@ -965,7 +965,7 @@ box_index_id_by_name(uint32_t space_id, const char *name, uint32_t len)
 /** \endcond public */
 
 int
-box_process1(struct request *request, box_tuple_t **result)
+box_process_dml(struct request *request, box_tuple_t **result)
 {
 	/* Allow to write to temporary spaces in read-only mode. */
 	struct space *space = space_cache_find(request->space_id);
@@ -975,7 +975,7 @@ box_process1(struct request *request, box_tuple_t **result)
 	    space_group_id(space) != GROUP_LOCAL &&
 	    box_check_writable() != 0)
 		return -1;
-	return process_rw(request, space, result);
+	return process_dml(request, space, result);
 }
 
 int
@@ -1064,7 +1064,7 @@ box_insert(uint32_t space_id, const char *tuple, const char *tuple_end,
 	request.space_id = space_id;
 	request.tuple = tuple;
 	request.tuple_end = tuple_end;
-	return box_process1(&request, result);
+	return box_process_dml(&request, result);
 }
 
 int
@@ -1078,7 +1078,7 @@ box_replace(uint32_t space_id, const char *tuple, const char *tuple_end,
 	request.space_id = space_id;
 	request.tuple = tuple;
 	request.tuple_end = tuple_end;
-	return box_process1(&request, result);
+	return box_process_dml(&request, result);
 }
 
 int
@@ -1093,7 +1093,7 @@ box_delete(uint32_t space_id, uint32_t index_id, const char *key,
 	request.index_id = index_id;
 	request.key = key;
 	request.key_end = key_end;
-	return box_process1(&request, result);
+	return box_process_dml(&request, result);
 }
 
 int
@@ -1114,7 +1114,7 @@ box_update(uint32_t space_id, uint32_t index_id, const char *key,
 	/** Legacy: in case of update, ops are passed in in request tuple */
 	request.tuple = ops;
 	request.tuple_end = ops_end;
-	return box_process1(&request, result);
+	return box_process_dml(&request, result);
 }
 
 int
@@ -1134,7 +1134,7 @@ box_upsert(uint32_t space_id, uint32_t index_id, const char *tuple,
 	request.tuple = tuple;
 	request.tuple_end = tuple_end;
 	request.index_base = index_base;
-	return box_process1(&request, result);
+	return box_process_dml(&request, result);
 }
 
 /**
diff --git a/src/box/box.h b/src/box/box.h
index e2e06d977..9e13378d9 100644
--- a/src/box/box.h
+++ b/src/box/box.h
@@ -391,14 +391,16 @@ box_sequence_reset(uint32_t seq_id);
 /** \endcond public */
 
 /**
- * The main entry point to the
- * Box: callbacks into the request processor.
- * These are function pointers since they can
- * change when entering/leaving read-only mode
- * (master->slave propagation).
+ * The main entry point to DML operations:
+ * INSERT/REPLACE/DELETE/UPDATE/UPSERT.
+ * @param request Request to process.
+ * @param[out] result Result tuple, can be NULL.
+ *
+ * @retval 0 Success.
+ * @retval -1 Error.
  */
 int
-box_process1(struct request *request, box_tuple_t **result);
+box_process_dml(struct request *request, box_tuple_t **result);
 
 int
 boxk(int type, uint32_t space_id, const char *format, ...);
diff --git a/src/box/iproto.cc b/src/box/iproto.cc
index bb7d2b868..f8b419c26 100644
--- a/src/box/iproto.cc
+++ b/src/box/iproto.cc
@@ -1368,7 +1368,7 @@ tx_process1(struct cmsg *m)
 	struct obuf_svp svp;
 	struct obuf *out;
 	tx_inject_delay();
-	if (box_process1(&msg->dml, &tuple) != 0)
+	if (box_process_dml(&msg->dml, &tuple) != 0)
 		goto error;
 	out = msg->connection->tx.p_obuf;
 	if (iproto_prepare_select(out, &svp) != 0)
-- 
2.15.2 (Apple Git-101.1)

  parent reply	other threads:[~2018-08-07 22:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 22:03 [PATCH 0/8] box.ctl.promote Vladislav Shpilevoy
2018-08-07 22:03 ` [PATCH 1/8] rfc: describe box.ctl.promote protocol Vladislav Shpilevoy
2018-08-07 22:03 ` Vladislav Shpilevoy [this message]
2018-08-13  8:20   ` [PATCH 2/8] box: rename process_rw to process_dml Vladimir Davydov
2018-08-07 22:03 ` [PATCH 3/8] Add 'exact_field_count' parameter to options decoder Vladislav Shpilevoy
2018-08-13  8:30   ` Vladimir Davydov
2018-08-07 22:03 ` [PATCH 4/8] box: remove orphan check from box_is_ro() Vladislav Shpilevoy
2018-08-13  8:34   ` Vladimir Davydov
2018-08-07 22:03 ` [PATCH 5/8] Fix gcov on Mac Vladislav Shpilevoy
2018-08-07 22:03 ` [PATCH 6/8] box: introduce _promotion space Vladislav Shpilevoy
2018-08-07 22:03 ` [PATCH 7/8] box: introduce box.ctl.promote Vladislav Shpilevoy
2018-08-13  8:58   ` Vladimir Davydov
2018-08-07 22:03 ` [PATCH 8/8] box: introduce promotion GC 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=92068d7f9e7fe5f5c912d7899e1c68707479fadf.1533679264.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH 2/8] box: rename process_rw to process_dml' \
    /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