commit c607c36: [Rework] Refactor libraries structure
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Feb 10 21:28:14 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-02-10 21:03:29 +0000
URL: https://github.com/rspamd/rspamd/commit/c607c36edda8eba5e073225ae923f80d5d22f9c6
[Rework] Refactor libraries structure
* Move logger implementation to libserver
* Move fuzzy backend files to a separate subdir
TODO: Move HTTP code from libutil
---
src/fuzzy_storage.c | 2 +-
src/libmime/lang_detection.c | 2 +-
src/libserver/CMakeLists.txt | 15 +++++++++------
src/libserver/{ => fuzzy_backend}/fuzzy_backend.c | 0
src/libserver/{ => fuzzy_backend}/fuzzy_backend.h | 0
src/libserver/{ => fuzzy_backend}/fuzzy_backend_redis.c | 0
src/libserver/{ => fuzzy_backend}/fuzzy_backend_redis.h | 0
src/libserver/{ => fuzzy_backend}/fuzzy_backend_sqlite.c | 0
src/libserver/{ => fuzzy_backend}/fuzzy_backend_sqlite.h | 0
src/{libutil => libserver}/logger.h | 0
src/{libutil => libserver/logger}/logger.c | 0
src/{libutil => libserver/logger}/logger_console.c | 0
src/{libutil => libserver/logger}/logger_file.c | 0
src/{libutil => libserver/logger}/logger_private.h | 0
src/{libutil => libserver/logger}/logger_syslog.c | 0
src/libutil/CMakeLists.txt | 4 ----
src/libutil/http_message.c | 2 +-
src/libutil/http_router.c | 2 +-
src/libutil/sqlite_utils.c | 2 +-
src/libutil/ssl_util.c | 2 +-
src/rspamadm/commands.c | 2 +-
src/rspamd.h | 2 +-
22 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index a57f07797..5bc8cf29d 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -24,7 +24,7 @@
#include "map.h"
#include "map_helpers.h"
#include "fuzzy_wire.h"
-#include "fuzzy_backend.h"
+#include "libserver/fuzzy_backend/fuzzy_backend.h"
#include "ottery.h"
#include "ref.h"
#include "xxhash.h"
diff --git a/src/libmime/lang_detection.c b/src/libmime/lang_detection.c
index a178b1bf8..9936bedfa 100644
--- a/src/libmime/lang_detection.c
+++ b/src/libmime/lang_detection.c
@@ -15,7 +15,7 @@
*/
#include "lang_detection.h"
-#include "libutil/logger.h"
+#include "libserver/logger.h"
#include "libcryptobox/cryptobox.h"
#include "libutil/multipattern.h"
#include "ucl.h"
diff --git a/src/libserver/CMakeLists.txt b/src/libserver/CMakeLists.txt
index f0dcae867..4b999c900 100644
--- a/src/libserver/CMakeLists.txt
+++ b/src/libserver/CMakeLists.txt
@@ -7,22 +7,25 @@ SET(LIBRSPAMDSERVERSRC
${CMAKE_CURRENT_SOURCE_DIR}/dns.c
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_cfg.c
${CMAKE_CURRENT_SOURCE_DIR}/async_session.c
- ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend.c
- ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend_sqlite.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend/fuzzy_backend.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend/fuzzy_backend_sqlite.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend/fuzzy_backend_redis.c
${CMAKE_CURRENT_SOURCE_DIR}/html.c
${CMAKE_CURRENT_SOURCE_DIR}/milter.c
${CMAKE_CURRENT_SOURCE_DIR}/monitored.c
${CMAKE_CURRENT_SOURCE_DIR}/protocol.c
${CMAKE_CURRENT_SOURCE_DIR}/re_cache.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/redis_pool.c
${CMAKE_CURRENT_SOURCE_DIR}/roll_history.c
${CMAKE_CURRENT_SOURCE_DIR}/spf.c
${CMAKE_CURRENT_SOURCE_DIR}/rspamd_symcache.c
${CMAKE_CURRENT_SOURCE_DIR}/task.c
${CMAKE_CURRENT_SOURCE_DIR}/url.c
- ${CMAKE_CURRENT_SOURCE_DIR}/worker_util.c)
-
-LIST(APPEND LIBRSPAMDSERVERSRC "${CMAKE_CURRENT_SOURCE_DIR}/fuzzy_backend_redis.c")
-LIST(APPEND LIBRSPAMDSERVERSRC "${CMAKE_CURRENT_SOURCE_DIR}/redis_pool.c")
+ ${CMAKE_CURRENT_SOURCE_DIR}/worker_util.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/logger/logger.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/logger/logger_file.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/logger/logger_syslog.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/logger/logger_console.c)
# Librspamd-server
SET(RSPAMD_SERVER ${LIBRSPAMDSERVERSRC} PARENT_SCOPE)
diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend/fuzzy_backend.c
similarity index 100%
rename from src/libserver/fuzzy_backend.c
rename to src/libserver/fuzzy_backend/fuzzy_backend.c
diff --git a/src/libserver/fuzzy_backend.h b/src/libserver/fuzzy_backend/fuzzy_backend.h
similarity index 100%
rename from src/libserver/fuzzy_backend.h
rename to src/libserver/fuzzy_backend/fuzzy_backend.h
diff --git a/src/libserver/fuzzy_backend_redis.c b/src/libserver/fuzzy_backend/fuzzy_backend_redis.c
similarity index 100%
rename from src/libserver/fuzzy_backend_redis.c
rename to src/libserver/fuzzy_backend/fuzzy_backend_redis.c
diff --git a/src/libserver/fuzzy_backend_redis.h b/src/libserver/fuzzy_backend/fuzzy_backend_redis.h
similarity index 100%
rename from src/libserver/fuzzy_backend_redis.h
rename to src/libserver/fuzzy_backend/fuzzy_backend_redis.h
diff --git a/src/libserver/fuzzy_backend_sqlite.c b/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.c
similarity index 100%
rename from src/libserver/fuzzy_backend_sqlite.c
rename to src/libserver/fuzzy_backend/fuzzy_backend_sqlite.c
diff --git a/src/libserver/fuzzy_backend_sqlite.h b/src/libserver/fuzzy_backend/fuzzy_backend_sqlite.h
similarity index 100%
rename from src/libserver/fuzzy_backend_sqlite.h
rename to src/libserver/fuzzy_backend/fuzzy_backend_sqlite.h
diff --git a/src/libutil/logger.h b/src/libserver/logger.h
similarity index 100%
rename from src/libutil/logger.h
rename to src/libserver/logger.h
diff --git a/src/libutil/logger.c b/src/libserver/logger/logger.c
similarity index 100%
rename from src/libutil/logger.c
rename to src/libserver/logger/logger.c
diff --git a/src/libutil/logger_console.c b/src/libserver/logger/logger_console.c
similarity index 100%
rename from src/libutil/logger_console.c
rename to src/libserver/logger/logger_console.c
diff --git a/src/libutil/logger_file.c b/src/libserver/logger/logger_file.c
similarity index 100%
rename from src/libutil/logger_file.c
rename to src/libserver/logger/logger_file.c
diff --git a/src/libutil/logger_private.h b/src/libserver/logger/logger_private.h
similarity index 100%
rename from src/libutil/logger_private.h
rename to src/libserver/logger/logger_private.h
diff --git a/src/libutil/logger_syslog.c b/src/libserver/logger/logger_syslog.c
similarity index 100%
rename from src/libutil/logger_syslog.c
rename to src/libserver/logger/logger_syslog.c
diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt
index 553d96e47..d26067df1 100644
--- a/src/libutil/CMakeLists.txt
+++ b/src/libutil/CMakeLists.txt
@@ -10,10 +10,6 @@ SET(LIBRSPAMDUTILSRC
${CMAKE_CURRENT_SOURCE_DIR}/http_connection.c
${CMAKE_CURRENT_SOURCE_DIR}/http_router.c
${CMAKE_CURRENT_SOURCE_DIR}/http_context.c
- ${CMAKE_CURRENT_SOURCE_DIR}/logger.c
- ${CMAKE_CURRENT_SOURCE_DIR}/logger_file.c
- ${CMAKE_CURRENT_SOURCE_DIR}/logger_syslog.c
- ${CMAKE_CURRENT_SOURCE_DIR}/logger_console.c
${CMAKE_CURRENT_SOURCE_DIR}/map.c
${CMAKE_CURRENT_SOURCE_DIR}/map_helpers.c
${CMAKE_CURRENT_SOURCE_DIR}/mem_pool.c
diff --git a/src/libutil/http_message.c b/src/libutil/http_message.c
index ca3523cac..0e12401a9 100644
--- a/src/libutil/http_message.c
+++ b/src/libutil/http_message.c
@@ -17,7 +17,7 @@
#include "libutil/http_connection.h"
#include "libutil/http_private.h"
#include "libutil/printf.h"
-#include "libutil/logger.h"
+#include "libserver/logger.h"
#include "utlist.h"
#include "unix-std.h"
diff --git a/src/libutil/http_router.c b/src/libutil/http_router.c
index 8d5913f0d..1e4e656c2 100644
--- a/src/libutil/http_router.c
+++ b/src/libutil/http_router.c
@@ -19,7 +19,7 @@
#include "libutil/http_private.h"
#include "libutil/regexp.h"
#include "libutil/printf.h"
-#include "libutil/logger.h"
+#include "libserver/logger.h"
#include "utlist.h"
#include "unix-std.h"
diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c
index 9c2969542..9bb0b9c1f 100644
--- a/src/libutil/sqlite_utils.c
+++ b/src/libutil/sqlite_utils.c
@@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "config.h"
-#include "libutil/logger.h"
+#include "libserver/logger.h"
#include "libutil/sqlite_utils.h"
#include "unix-std.h"
diff --git a/src/libutil/ssl_util.c b/src/libutil/ssl_util.c
index c43ace454..4760a3c78 100644
--- a/src/libutil/ssl_util.c
+++ b/src/libutil/ssl_util.c
@@ -16,7 +16,7 @@
#include "config.h"
#include "libutil/util.h"
-#include "libutil/logger.h"
+#include "libserver/logger.h"
#include "ssl_util.h"
#include "unix-std.h"
diff --git a/src/rspamadm/commands.c b/src/rspamadm/commands.c
index f379ff802..9f243c707 100644
--- a/src/rspamadm/commands.c
+++ b/src/rspamadm/commands.c
@@ -15,7 +15,7 @@
*/
#include "rspamadm.h"
#include "libutil/util.h"
-#include "libutil/logger.h"
+#include "libserver/logger.h"
#include "lua/lua_common.h"
#include "lua/lua_thread_pool.h"
diff --git a/src/rspamd.h b/src/rspamd.h
index 4e149535a..22d957490 100644
--- a/src/rspamd.h
+++ b/src/rspamd.h
@@ -21,7 +21,7 @@
#include "libutil/fstring.h"
#include "libutil/mem_pool.h"
#include "libutil/util.h"
-#include "libutil/logger.h"
+#include "libserver/logger.h"
#include "libutil/http_connection.h"
#include "libutil/upstream.h"
#include "libutil/radix.h"
More information about the Commits
mailing list