[Tarantool-patches] [RAFT 03/10] [tosquash] raft: return raft_request to xrow

Serge Petrenko sergepetrenko at tarantool.org
Wed Aug 26 10:52:35 MSK 2020


From: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>

Xrow is the owner of all the IProto and xlog codecs. So the
raft reaquest's definition belongs here, just like any other
request.
---
 src/box/raft.c | 1 -
 src/box/raft.h | 9 +--------
 src/box/xrow.c | 1 -
 src/box/xrow.h | 7 ++++++-
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/box/raft.c b/src/box/raft.c
index 839a7dfeb..227846596 100644
--- a/src/box/raft.c
+++ b/src/box/raft.c
@@ -32,7 +32,6 @@
 
 #include "error.h"
 #include "journal.h"
-#include "xrow.h"
 #include "small/region.h"
 #include "replication.h"
 #include "relay.h"
diff --git a/src/box/raft.h b/src/box/raft.h
index 9cb39dd24..b11ae7b1d 100644
--- a/src/box/raft.h
+++ b/src/box/raft.h
@@ -29,7 +29,7 @@
  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include <stdint.h>
+#include "xrow.h"
 #include "cbus.h"
 
 #if defined(__cplusplus)
@@ -52,13 +52,6 @@ struct raft {
 
 extern struct raft raft;
 
-struct raft_request {
-	uint64_t term;
-	uint32_t vote;
-	enum raft_state state;
-	struct vclock *vclock;
-};
-
 struct raft_broadcast_msg {
 	struct cmsg base;
 	struct raft_request req;
diff --git a/src/box/xrow.c b/src/box/xrow.c
index f60b12cfc..ed3f77a15 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -44,7 +44,6 @@
 #include "scramble.h"
 #include "iproto_constants.h"
 #include "mpstream/mpstream.h"
-#include "raft.h"
 
 static_assert(IPROTO_DATA < 0x7f && IPROTO_METADATA < 0x7f &&
 	      IPROTO_SQL_INFO < 0x7f, "encoded IPROTO_BODY keys must fit into "\
diff --git a/src/box/xrow.h b/src/box/xrow.h
index 3f37dc18f..5d571a821 100644
--- a/src/box/xrow.h
+++ b/src/box/xrow.h
@@ -264,7 +264,12 @@ xrow_encode_synchro(struct xrow_header *row,
 int
 xrow_decode_synchro(const struct xrow_header *row, struct synchro_request *req);
 
-struct raft_request;
+struct raft_request {
+	uint64_t term;
+	uint32_t vote;
+	uint32_t state;
+	struct vclock *vclock;
+};
 
 int
 xrow_encode_raft(struct xrow_header *row, struct region *region,
-- 
2.20.1 (Apple Git-117)



More information about the Tarantool-patches mailing list