[Tarantool-patches] [PATCH v2 4/4] vclock: move to src/lib
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue Nov 10 02:58:54 MSK 2020
Vclock is used in raft, which is going to be moved to src/lib.
That means vclock also should be moved there.
It is easy, because vclock does not depend on anything in box/.
Needed for #5303
---
src/box/CMakeLists.txt | 3 ---
src/box/alter.cc | 1 -
src/box/error.cc | 2 +-
src/box/gc.c | 1 -
src/box/gc.h | 2 +-
src/box/lua/init.c | 1 -
src/box/lua/space.cc | 2 +-
src/box/recovery.h | 2 +-
src/box/relay.cc | 2 +-
src/box/replication.cc | 1 -
src/box/replication.h | 2 +-
src/box/schema.cc | 2 +-
src/box/txn_limbo.h | 2 +-
src/box/vy_log.c | 2 +-
src/box/wal.c | 1 -
src/box/wal.h | 2 +-
src/box/xlog.h | 2 +-
src/box/xrow.c | 1 -
src/box/xrow.h | 2 +-
src/lib/CMakeLists.txt | 1 +
src/lib/vclock/CMakeLists.txt | 6 ++++++
src/{box => lib/vclock}/vclock.c | 0
src/{box => lib/vclock}/vclock.h | 0
test/unit/vclock.cc | 2 +-
24 files changed, 20 insertions(+), 22 deletions(-)
create mode 100644 src/lib/vclock/CMakeLists.txt
rename src/{box => lib/vclock}/vclock.c (100%)
rename src/{box => lib/vclock}/vclock.h (100%)
diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
index df243ac33..d1667796a 100644
--- a/src/box/CMakeLists.txt
+++ b/src/box/CMakeLists.txt
@@ -79,9 +79,6 @@ include_directories(${ZSTD_INCLUDE_DIRS})
include_directories(${CMAKE_BINARY_DIR}/src/box/sql)
include_directories(${CMAKE_BINARY_DIR}/src/box)
-add_library(vclock STATIC vclock.c)
-target_link_libraries(vclock core bit)
-
add_library(box_error STATIC error.cc errcode.c mp_error.cc)
target_link_libraries(box_error core stat mpstream vclock)
diff --git a/src/box/alter.cc b/src/box/alter.cc
index 08957f6c9..075b79d33 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -50,7 +50,6 @@
#include <ctype.h>
#include "replication.h" /* for replica_set_id() */
#include "session.h" /* to fetch the current user. */
-#include "vclock.h" /* VCLOCK_MAX */
#include "xrow.h"
#include "iproto_constants.h"
#include "identifier.h"
diff --git a/src/box/error.cc b/src/box/error.cc
index ca1d73e0c..f3b4ffe86 100644
--- a/src/box/error.cc
+++ b/src/box/error.cc
@@ -34,7 +34,7 @@
#include "fiber.h"
#include "rmean.h"
#include "trigger.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#include "schema.h"
/* {{{ public API */
diff --git a/src/box/gc.c b/src/box/gc.c
index 76f7c6325..1f8cc818d 100644
--- a/src/box/gc.c
+++ b/src/box/gc.c
@@ -52,7 +52,6 @@
#include "fiber_cond.h"
#include "latch.h"
#include "say.h"
-#include "vclock.h"
#include "cbus.h"
#include "engine.h" /* engine_collect_garbage() */
#include "wal.h" /* wal_collect_garbage() */
diff --git a/src/box/gc.h b/src/box/gc.h
index 827a5db8e..829aaf479 100644
--- a/src/box/gc.h
+++ b/src/box/gc.h
@@ -36,7 +36,7 @@
#include <small/rlist.h>
#include "fiber_cond.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#include "trivia/util.h"
#include "checkpoint_schedule.h"
diff --git a/src/box/lua/init.c b/src/box/lua/init.c
index d0316ef86..fbcdfb20b 100644
--- a/src/box/lua/init.c
+++ b/src/box/lua/init.c
@@ -41,7 +41,6 @@
#include "box/box.h"
#include "box/txn.h"
#include "box/func.h"
-#include "box/vclock.h"
#include "box/session.h"
#include "box/mp_error.h"
diff --git a/src/box/lua/space.cc b/src/box/lua/space.cc
index 1ea993ccb..544a18f47 100644
--- a/src/box/lua/space.cc
+++ b/src/box/lua/space.cc
@@ -49,11 +49,11 @@ extern "C" {
#include "box/user_def.h"
#include "box/tuple.h"
#include "box/txn.h"
-#include "box/vclock.h" /* VCLOCK_MAX */
#include "box/sequence.h"
#include "box/coll_id_cache.h"
#include "box/replication.h" /* GROUP_LOCAL */
#include "box/iproto_constants.h" /* iproto_type_name */
+#include "vclock/vclock.h"
/**
* Trigger function for all spaces
diff --git a/src/box/recovery.h b/src/box/recovery.h
index b8d83951a..c8ccaa553 100644
--- a/src/box/recovery.h
+++ b/src/box/recovery.h
@@ -34,7 +34,7 @@
#include "trivia/util.h"
#include "third_party/tarantool_ev.h"
#include "xlog.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#if defined(__cplusplus)
extern "C" {
diff --git a/src/box/relay.cc b/src/box/relay.cc
index b68b45e00..1e77e0d9b 100644
--- a/src/box/relay.cc
+++ b/src/box/relay.cc
@@ -46,7 +46,7 @@
#include "recovery.h"
#include "replication.h"
#include "trigger.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#include "version.h"
#include "xrow.h"
#include "xrow_io.h"
diff --git a/src/box/replication.cc b/src/box/replication.cc
index c19f8c693..65512cf0f 100644
--- a/src/box/replication.cc
+++ b/src/box/replication.cc
@@ -40,7 +40,6 @@
#include "gc.h"
#include "error.h"
#include "relay.h"
-#include "vclock.h" /* VCLOCK_MAX */
#include "sio.h"
uint32_t instance_id = REPLICA_ID_NIL;
diff --git a/src/box/replication.h b/src/box/replication.h
index 3e46c592a..e57912848 100644
--- a/src/box/replication.h
+++ b/src/box/replication.h
@@ -38,7 +38,7 @@
#include <small/rlist.h>
#include "applier.h"
#include "fiber_cond.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#include "latch.h"
/**
diff --git a/src/box/schema.cc b/src/box/schema.cc
index 60e4a7f9c..963278b19 100644
--- a/src/box/schema.cc
+++ b/src/box/schema.cc
@@ -36,7 +36,7 @@
#include "alter.h"
#include "scoped_guard.h"
#include "user.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#include "fiber.h"
/**
diff --git a/src/box/txn_limbo.h b/src/box/txn_limbo.h
index eaf662987..3685164a9 100644
--- a/src/box/txn_limbo.h
+++ b/src/box/txn_limbo.h
@@ -30,7 +30,7 @@
* SUCH DAMAGE.
*/
#include "small/rlist.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#include <stdint.h>
diff --git a/src/box/vy_log.c b/src/box/vy_log.c
index d23b1c18a..3a67cd860 100644
--- a/src/box/vy_log.c
+++ b/src/box/vy_log.c
@@ -60,7 +60,7 @@
#include "say.h"
#include "tt_static.h"
#include "wal.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#include "xlog.h"
#include "xrow.h"
diff --git a/src/box/wal.c b/src/box/wal.c
index 84abaa7b2..937d47ba9 100644
--- a/src/box/wal.c
+++ b/src/box/wal.c
@@ -30,7 +30,6 @@
*/
#include "wal.h"
-#include "vclock.h"
#include "fiber.h"
#include "fio.h"
#include "errinj.h"
diff --git a/src/box/wal.h b/src/box/wal.h
index 581306fe9..ca43dc6eb 100644
--- a/src/box/wal.h
+++ b/src/box/wal.h
@@ -35,7 +35,7 @@
#include "small/rlist.h"
#include "cbus.h"
#include "journal.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
struct fiber;
struct wal_writer;
diff --git a/src/box/xlog.h b/src/box/xlog.h
index 5b1f42ce1..8104d1295 100644
--- a/src/box/xlog.h
+++ b/src/box/xlog.h
@@ -34,7 +34,7 @@
#include <stdbool.h>
#include <sys/stat.h>
#include "uuid/tt_uuid.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#define ZSTD_STATIC_LINKING_ONLY
#include "zstd.h"
diff --git a/src/box/xrow.c b/src/box/xrow.c
index da5c6ffae..165a00a16 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -40,7 +40,6 @@
#include "tt_static.h"
#include "error.h"
#include "mp_error.h"
-#include "vclock.h"
#include "scramble.h"
#include "iproto_constants.h"
#include "mpstream/mpstream.h"
diff --git a/src/box/xrow.h b/src/box/xrow.h
index 25985ad7f..095911239 100644
--- a/src/box/xrow.h
+++ b/src/box/xrow.h
@@ -37,7 +37,7 @@
#include "uuid/tt_uuid.h"
#include "diag.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
#if defined(__cplusplus)
extern "C" {
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 61b87fb9e..de1b902c6 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -13,6 +13,7 @@ add_subdirectory(coll)
add_subdirectory(crypto)
add_subdirectory(swim)
add_subdirectory(mpstream)
+add_subdirectory(vclock)
if(ENABLE_BUNDLED_MSGPUCK)
add_subdirectory(msgpuck EXCLUDE_FROM_ALL)
endif()
diff --git a/src/lib/vclock/CMakeLists.txt b/src/lib/vclock/CMakeLists.txt
new file mode 100644
index 000000000..ae6d4e49d
--- /dev/null
+++ b/src/lib/vclock/CMakeLists.txt
@@ -0,0 +1,6 @@
+set(lib_sources
+ vclock.c
+)
+set_source_files_compile_flags(${lib_sources})
+add_library(vclock STATIC ${lib_sources})
+target_link_libraries(vclock core bit)
diff --git a/src/box/vclock.c b/src/lib/vclock/vclock.c
similarity index 100%
rename from src/box/vclock.c
rename to src/lib/vclock/vclock.c
diff --git a/src/box/vclock.h b/src/lib/vclock/vclock.h
similarity index 100%
rename from src/box/vclock.h
rename to src/lib/vclock/vclock.h
diff --git a/test/unit/vclock.cc b/test/unit/vclock.cc
index cbda7f4fc..699a8d498 100644
--- a/test/unit/vclock.cc
+++ b/test/unit/vclock.cc
@@ -34,7 +34,7 @@ extern "C" {
#include <stdarg.h>
-#include "box/vclock.h"
+#include "vclock/vclock.h"
#define str2(x) #x
#define str(x) str2(x)
--
2.21.1 (Apple Git-122.3)
More information about the Tarantool-patches
mailing list