Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	tarantool-patches@dev.tarantool.org, gorcunov@gmail.com
Subject: Re: [Tarantool-patches] [PATCH 12/12] raft: move algorithm code to src/lib/raft
Date: Tue, 17 Nov 2020 18:13:40 +0300	[thread overview]
Message-ID: <4be8fcf7-8ba6-980e-3980-fda14f5443fa@tarantool.org> (raw)
In-Reply-To: <26415dbc62eff90f0e542cfd09bc6f4a07d92617.1605570907.git.v.shpilevoy@tarantool.org>


17.11.2020 03:02, Vladislav Shpilevoy пишет:
> Raft algorithm code does not depend on box anymore, and is moved
> to src/lib/raft.
>
> This is done to be able to unit test Raft similarly to Swim - with
> virtual event loop, network, time, and disk. Using any number of
> instances. That will allow to cover all crazy and rare cases
> possible in Raft, but without problems of functional tests
> stability and clumsiness.
>
> Part of #5303


LGTM.


> ---
>   src/box/CMakeLists.txt                 | 3 +--
>   src/box/raft.h                         | 2 +-
>   src/lib/CMakeLists.txt                 | 1 +
>   src/lib/raft/CMakeLists.txt            | 7 +++++++
>   src/{box/raftlib.c => lib/raft/raft.c} | 0
>   src/{box/raftlib.h => lib/raft/raft.h} | 0
>   6 files changed, 10 insertions(+), 3 deletions(-)
>   create mode 100644 src/lib/raft/CMakeLists.txt
>   rename src/{box/raftlib.c => lib/raft/raft.c} (100%)
>   rename src/{box/raftlib.h => lib/raft/raft.h} (100%)
>
> diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
> index fcf779379..a7547c29f 100644
> --- a/src/box/CMakeLists.txt
> +++ b/src/box/CMakeLists.txt
> @@ -169,7 +169,6 @@ add_library(box STATIC
>       port.c
>       txn.c
>       txn_limbo.c
> -    raftlib.c
>       raft.c
>       box.cc
>       gc.c
> @@ -263,6 +262,6 @@ add_custom_command(OUTPUT ${SQL_BIN_DIR}/opcodes.c
>           ${SQL_BIN_DIR}/opcodes.h)
>   
>   target_link_libraries(box box_error tuple stat xrow xlog vclock crc32 scramble
> -                      ${common_libraries})
> +                      raft ${common_libraries})
>   
>   add_dependencies(box build_bundled_libs generate_sql_files)
> diff --git a/src/box/raft.h b/src/box/raft.h
> index 4dffce380..7e0768cd3 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 "raftlib.h"
> +#include "raft/raft.h"
>   
>   #if defined(__cplusplus)
>   extern "C" {
> diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
> index de1b902c6..cabbe3d89 100644
> --- a/src/lib/CMakeLists.txt
> +++ b/src/lib/CMakeLists.txt
> @@ -14,6 +14,7 @@ add_subdirectory(crypto)
>   add_subdirectory(swim)
>   add_subdirectory(mpstream)
>   add_subdirectory(vclock)
> +add_subdirectory(raft)
>   if(ENABLE_BUNDLED_MSGPUCK)
>       add_subdirectory(msgpuck EXCLUDE_FROM_ALL)
>   endif()
> diff --git a/src/lib/raft/CMakeLists.txt b/src/lib/raft/CMakeLists.txt
> new file mode 100644
> index 000000000..aef2bacf7
> --- /dev/null
> +++ b/src/lib/raft/CMakeLists.txt
> @@ -0,0 +1,7 @@
> +set(lib_sources
> +    raft.c
> +)
> +
> +set_source_files_compile_flags(${lib_sources})
> +add_library(raft STATIC ${lib_sources})
> +target_link_libraries(raft core)
> diff --git a/src/box/raftlib.c b/src/lib/raft/raft.c
> similarity index 100%
> rename from src/box/raftlib.c
> rename to src/lib/raft/raft.c
> diff --git a/src/box/raftlib.h b/src/lib/raft/raft.h
> similarity index 100%
> rename from src/box/raftlib.h
> rename to src/lib/raft/raft.h

-- 
Serge Petrenko

  reply	other threads:[~2020-11-17 15:13 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17  0:02 [Tarantool-patches] [PATCH 00/12] Raft module, part 2 - relocation " Vladislav Shpilevoy
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 01/12] raft: move sources to raftlib.h/.c Vladislav Shpilevoy
2020-11-17  8:14   ` Serge Petrenko
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 10/12] raft: move box_update_ro_summary to update trigger Vladislav Shpilevoy
2020-11-17 12:42   ` Serge Petrenko
2020-11-17 15:17     ` Serge Petrenko
2020-11-18 23:21     ` Vladislav Shpilevoy
2020-11-19 10:08       ` Serge Petrenko
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 11/12] raft: introduce RaftError Vladislav Shpilevoy
2020-11-17 15:13   ` Serge Petrenko
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 12/12] raft: move algorithm code to src/lib/raft Vladislav Shpilevoy
2020-11-17 15:13   ` Serge Petrenko [this message]
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 02/12] raft: move box_raft_* to src/box/raft.h and .c Vladislav Shpilevoy
2020-11-17  8:14   ` Serge Petrenko
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 03/12] raft: stop using replication_disconnect_timeout() Vladislav Shpilevoy
2020-11-17  8:15   ` Serge Petrenko
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 04/12] raft: stop using replication_synchro_quorum Vladislav Shpilevoy
2020-11-17  8:17   ` Serge Petrenko
2020-11-19 23:42     ` Vladislav Shpilevoy
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 05/12] raft: stop using instance_id Vladislav Shpilevoy
2020-11-17  8:59   ` Serge Petrenko
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 06/12] raft: make raft_request.vclock constant Vladislav Shpilevoy
2020-11-17  9:17   ` Serge Petrenko
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 07/12] raft: stop using replicaset.vclock Vladislav Shpilevoy
2020-11-17  9:23   ` Serge Petrenko
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 08/12] raft: introduce vtab for disk and network Vladislav Shpilevoy
2020-11-17  9:35   ` Serge Petrenko
2020-11-19 23:43     ` Vladislav Shpilevoy
2020-11-17 10:00   ` Serge Petrenko
2020-11-19 23:43     ` Vladislav Shpilevoy
2020-11-20  7:56       ` Serge Petrenko
2020-11-20 19:40         ` Vladislav Shpilevoy
2020-11-23  8:09           ` Serge Petrenko
2020-11-17  0:02 ` [Tarantool-patches] [PATCH 09/12] raft: introduce raft_msg, drop xrow dependency Vladislav Shpilevoy
2020-11-17 10:22   ` Serge Petrenko
2020-11-19 23:43     ` Vladislav Shpilevoy
2020-11-20  8:03       ` Serge Petrenko

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=4be8fcf7-8ba6-980e-3980-fda14f5443fa@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 12/12] raft: move algorithm code to src/lib/raft' \
    /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