From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id B5C2A43040E for ; Wed, 26 Aug 2020 10:52:57 +0300 (MSK) From: Serge Petrenko Date: Wed, 26 Aug 2020 10:52:35 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [RAFT 03/10] [tosquash] raft: return raft_request to xrow List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: v.shpilevoy@tarantool.org, gorcunov@gmail.com, sergos@tarantool.org Cc: tarantool-patches@dev.tarantool.org From: Vladislav Shpilevoy 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 +#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)