[tarantool-patches] Re: [PATCH v2 3/5] Merge box_error, stat and collations into core library
Konstantin Osipov
kostja at tarantool.org
Tue May 8 16:18:50 MSK 2018
* Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [18/04/29 01:47]:
> The goal is to expose collations into Lua with no dependencies on
> box library. But collations merge into core requires box_error
> and stat libraries too.
Please remove coll_cache dependency on box_error and stat, rather
than move box_error/box_stat over. If you need nice errors in box
for operations with collation cache, you can add wrappers in the
box (or you can raise errors defined in src/ as is already the
case for socket and I/O errors).
> ---
> cmake/module.cmake | 4 ++--
> src/CMakeLists.txt | 14 ++++++++++----
> src/box/CMakeLists.txt | 18 +++++-------------
> src/box/lua/call.c | 2 +-
> src/box/lua/error.cc | 2 +-
> src/box/lua/net_box.c | 2 +-
> src/box/lua/tuple.c | 2 +-
> src/box/lua/xlog.c | 2 +-
> src/{box => }/coll.c | 0
> src/{box => }/coll.h | 0
> src/{box => }/coll_cache.c | 0
> src/{box => }/coll_cache.h | 0
> src/{box => }/coll_def.c | 0
> src/{box => }/coll_def.h | 0
> src/{box => }/errcode.c | 0
> src/{box => }/errcode.h | 0
> src/{box => }/error.cc | 0
> src/{box => }/error.h | 0
> src/main.cc | 2 +-
> src/{box => }/opt_def.c | 0
> src/{box => }/opt_def.h | 0
> test/unit/CMakeLists.txt | 8 ++++----
> test/unit/coll.cpp | 3 +--
> 23 files changed, 28 insertions(+), 31 deletions(-)
> rename src/{box => }/coll.c (100%)
> rename src/{box => }/coll.h (100%)
> rename src/{box => }/coll_cache.c (100%)
> rename src/{box => }/coll_cache.h (100%)
> rename src/{box => }/coll_def.c (100%)
> rename src/{box => }/coll_def.h (100%)
> rename src/{box => }/errcode.c (100%)
> rename src/{box => }/errcode.h (100%)
> rename src/{box => }/error.cc (100%)
> rename src/{box => }/error.h (100%)
> rename src/{box => }/opt_def.c (100%)
> rename src/{box => }/opt_def.h (100%)
>
> diff --git a/cmake/module.cmake b/cmake/module.cmake
> index 988dcb94d..434938cdf 100644
> --- a/cmake/module.cmake
> +++ b/cmake/module.cmake
> @@ -25,7 +25,7 @@ function(rebuild_module_api)
> COMMAND ${CMAKE_C_COMPILER}
> ${cflags}
> -I ${CMAKE_SOURCE_DIR}/src -I ${CMAKE_BINARY_DIR}/src
> - -E ${CMAKE_SOURCE_DIR}/src/box/errcode.h > ${errcodefile}
> + -E ${CMAKE_SOURCE_DIR}/src/errcode.h > ${errcodefile}
> COMMAND
> grep "enum box_error_code" ${errcodefile} >> ${tmpfile}
> COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/module_footer.h >> ${tmpfile}
> @@ -34,7 +34,7 @@ function(rebuild_module_api)
> DEPENDS ${CMAKE_SOURCE_DIR}/extra/apigen
> ${CMAKE_CURRENT_SOURCE_DIR}/module_header.h
> ${CMAKE_CURRENT_SOURCE_DIR}/module_footer.h
> - ${CMAKE_SOURCE_DIR}/src/box/errcode.h
> + ${CMAKE_SOURCE_DIR}/src/errcode.h
> ${headers}
> )
>
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index 8ab09e968..45eb7a431 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -94,6 +94,15 @@ set (core_sources
> random.c
> trigger.cc
> http_parser.c
> + error.cc
> + errcode.c
> + rmean.c
> + latency.c
> + histogram.c
> + coll_def.c
> + coll.c
> + coll_cache.c
> + opt_def.c
> )
>
> if (TARGET_OS_NETBSD)
> @@ -112,9 +121,6 @@ target_link_libraries(core
> ${MSGPUCK_LIBRARIES}
> )
>
> -add_library(stat STATIC rmean.c latency.c histogram.c)
> -target_link_libraries(stat core)
> -
> if (ENABLE_BACKTRACE AND NOT TARGET_OS_DARWIN)
> target_link_libraries(core gcc_s ${UNWIND_LIBRARIES})
> endif()
> @@ -190,7 +196,7 @@ set(api_headers
> ${CMAKE_SOURCE_DIR}/src/box/box.h
> ${CMAKE_SOURCE_DIR}/src/box/index.h
> ${CMAKE_SOURCE_DIR}/src/box/iterator_type.h
> - ${CMAKE_SOURCE_DIR}/src/box/error.h
> + ${CMAKE_SOURCE_DIR}/src/error.h
> ${CMAKE_SOURCE_DIR}/src/box/lua/call.h
> ${CMAKE_SOURCE_DIR}/src/box/lua/tuple.h
> ${CMAKE_SOURCE_DIR}/src/latch.h
> diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
> index ae156a2f5..30d636e47 100644
> --- a/src/box/CMakeLists.txt
> +++ b/src/box/CMakeLists.txt
> @@ -21,15 +21,12 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${lua_sources})
>
> include_directories(${ZSTD_INCLUDE_DIRS})
>
> -add_library(box_error STATIC error.cc errcode.c)
> -target_link_libraries(box_error core stat)
> -
> add_library(vclock STATIC vclock.c)
> target_link_libraries(vclock core)
>
> add_library(xrow STATIC xrow.c iproto_constants.c)
> -target_link_libraries(xrow server core small vclock misc box_error
> - scramble ${MSGPUCK_LIBRARIES})
> +target_link_libraries(xrow server core small vclock misc scramble
> + ${MSGPUCK_LIBRARIES})
>
> add_library(tuple STATIC
> tuple.c
> @@ -41,20 +38,15 @@ add_library(tuple STATIC
> tuple_bloom.c
> tuple_dictionary.c
> key_def.cc
> - coll_def.c
> - coll.c
> - coll_cache.c
> field_def.c
> - opt_def.c
> )
> -target_link_libraries(tuple json_path box_error core ${MSGPUCK_LIBRARIES} ${ICU_LIBRARIES} misc bit)
> +target_link_libraries(tuple json_path core ${MSGPUCK_LIBRARIES} ${ICU_LIBRARIES} misc bit)
>
> add_library(xlog STATIC xlog.c)
> -target_link_libraries(xlog core box_error crc32 ${ZSTD_LIBRARIES})
> +target_link_libraries(xlog core crc32 ${ZSTD_LIBRARIES})
>
> add_library(box STATIC
> iproto.cc
> - error.cc
> xrow_io.cc
> tuple_convert.c
> identifier.c
> @@ -132,6 +124,6 @@ add_library(box STATIC
> lua/xlog.c
> ${bin_sources})
>
> -target_link_libraries(box box_error tuple stat xrow xlog vclock crc32 scramble
> +target_link_libraries(box tuple xrow xlog vclock crc32 scramble
> ${common_libraries})
> add_dependencies(box build_bundled_libs)
> diff --git a/src/box/lua/call.c b/src/box/lua/call.c
> index be13812aa..b60c6c397 100644
> --- a/src/box/lua/call.c
> +++ b/src/box/lua/call.c
> @@ -30,7 +30,7 @@
> */
> #include "box/lua/call.h"
> #include "box/call.h"
> -#include "box/error.h"
> +#include <error.h>
> #include "fiber.h"
>
> #include "lua/utils.h"
> diff --git a/src/box/lua/error.cc b/src/box/lua/error.cc
> index 314907421..960ea2aa9 100644
> --- a/src/box/lua/error.cc
> +++ b/src/box/lua/error.cc
> @@ -40,7 +40,7 @@ extern "C" {
> #include <errinj.h>
>
> #include "lua/utils.h"
> -#include "box/error.h"
> +#include "src/error.h"
>
> static int
> luaT_error_raise(lua_State *L)
> diff --git a/src/box/lua/net_box.c b/src/box/lua/net_box.c
> index db2d2dbb4..f5cc8d674 100644
> --- a/src/box/lua/net_box.c
> +++ b/src/box/lua/net_box.c
> @@ -43,7 +43,7 @@
> #include "third_party/base64.h"
>
> #include "coio.h"
> -#include "box/errcode.h"
> +#include "errcode.h"
> #include "lua/fiber.h"
>
> #define cfg luaL_msgpack_default
> diff --git a/src/box/lua/tuple.c b/src/box/lua/tuple.c
> index 67abb32bd..889f0569b 100644
> --- a/src/box/lua/tuple.c
> +++ b/src/box/lua/tuple.c
> @@ -39,7 +39,7 @@
>
> #include "box/tuple.h"
> #include "box/tuple_convert.h"
> -#include "box/errcode.h"
> +#include "errcode.h"
> #include "box/memtx_tuple.h"
> #include "json/path.h"
>
> diff --git a/src/box/lua/xlog.c b/src/box/lua/xlog.c
> index 030f5c2d4..c53b5a21a 100644
> --- a/src/box/lua/xlog.c
> +++ b/src/box/lua/xlog.c
> @@ -35,7 +35,7 @@
> #include <diag.h>
> #include <msgpuck/msgpuck.h>
>
> -#include <box/error.h>
> +#include "error.h"
> #include <box/xlog.h>
> #include <box/xrow.h>
> #include <box/iproto_constants.h>
> diff --git a/src/box/coll.c b/src/coll.c
> similarity index 100%
> rename from src/box/coll.c
> rename to src/coll.c
> diff --git a/src/box/coll.h b/src/coll.h
> similarity index 100%
> rename from src/box/coll.h
> rename to src/coll.h
> diff --git a/src/box/coll_cache.c b/src/coll_cache.c
> similarity index 100%
> rename from src/box/coll_cache.c
> rename to src/coll_cache.c
> diff --git a/src/box/coll_cache.h b/src/coll_cache.h
> similarity index 100%
> rename from src/box/coll_cache.h
> rename to src/coll_cache.h
> diff --git a/src/box/coll_def.c b/src/coll_def.c
> similarity index 100%
> rename from src/box/coll_def.c
> rename to src/coll_def.c
> diff --git a/src/box/coll_def.h b/src/coll_def.h
> similarity index 100%
> rename from src/box/coll_def.h
> rename to src/coll_def.h
> diff --git a/src/box/errcode.c b/src/errcode.c
> similarity index 100%
> rename from src/box/errcode.c
> rename to src/errcode.c
> diff --git a/src/box/errcode.h b/src/errcode.h
> similarity index 100%
> rename from src/box/errcode.h
> rename to src/errcode.h
> diff --git a/src/box/error.cc b/src/error.cc
> similarity index 100%
> rename from src/box/error.cc
> rename to src/error.cc
> diff --git a/src/box/error.h b/src/error.h
> similarity index 100%
> rename from src/box/error.h
> rename to src/error.h
> diff --git a/src/main.cc b/src/main.cc
> index 1682baea0..3d61e3c51 100644
> --- a/src/main.cc
> +++ b/src/main.cc
> @@ -63,7 +63,7 @@
> #include "tt_pthread.h"
> #include "lua/init.h"
> #include "box/box.h"
> -#include "box/error.h"
> +#include "error.h"
> #include "scoped_guard.h"
> #include "random.h"
> #include "tt_uuid.h"
> diff --git a/src/box/opt_def.c b/src/opt_def.c
> similarity index 100%
> rename from src/box/opt_def.c
> rename to src/opt_def.c
> diff --git a/src/box/opt_def.h b/src/opt_def.h
> similarity index 100%
> rename from src/box/opt_def.h
> rename to src/opt_def.h
> diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
> index 049edf641..8792a3ed2 100644
> --- a/test/unit/CMakeLists.txt
> +++ b/test/unit/CMakeLists.txt
> @@ -90,10 +90,10 @@ add_executable(fiber_channel_stress.test fiber_channel_stress.cc)
> target_link_libraries(fiber_channel_stress.test core)
>
> add_executable(cbus_stress.test cbus_stress.c)
> -target_link_libraries(cbus_stress.test core stat)
> +target_link_libraries(cbus_stress.test core)
>
> add_executable(cbus.test cbus.c)
> -target_link_libraries(cbus.test core unit stat)
> +target_link_libraries(cbus.test core unit)
>
> add_executable(coio.test coio.cc)
> target_link_libraries(coio.test core eio bit uri unit)
> @@ -133,9 +133,9 @@ add_executable(json_path.test json_path.c)
> target_link_libraries(json_path.test json_path unit ${ICU_LIBRARIES})
>
> add_executable(rmean.test rmean.cc)
> -target_link_libraries(rmean.test stat unit)
> +target_link_libraries(rmean.test core unit)
> add_executable(histogram.test histogram.c)
> -target_link_libraries(histogram.test stat unit)
> +target_link_libraries(histogram.test core unit)
>
> add_executable(say.test say.c)
> target_link_libraries(say.test core unit)
> diff --git a/test/unit/coll.cpp b/test/unit/coll.cpp
> index e1643c9c0..acf69b030 100644
> --- a/test/unit/coll.cpp
> +++ b/test/unit/coll.cpp
> @@ -1,9 +1,8 @@
> -#include "box/coll.h"
> +#include "coll.h"
> #include <iostream>
> #include <vector>
> #include <algorithm>
> #include <string.h>
> -#include <box/coll_def.h>
> #include <assert.h>
> #include <msgpuck.h>
> #include <diag.h>
> --
> 2.15.1 (Apple Git-101)
>
>
--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov
More information about the Tarantool-patches
mailing list