Skip to content

Commit

Permalink
Introduce tsutil from tsapicore and tscpputil (#10928)
Browse files Browse the repository at this point in the history
* move tsapicore to tsutil

* Move tscpp/util to tsutil

* cmake format

* cleanup remaining tscore deps from tsutil

* what on earth
  • Loading branch information
cmcfarlen authored Dec 13, 2023
1 parent 986ebe9 commit f600c16
Show file tree
Hide file tree
Showing 168 changed files with 286 additions and 345 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ configure_file(configs/records.yaml.default.in configs/records.yaml.default)
configure_file(include/tscore/ink_config.h.cmake.in include/tscore/ink_config.h)
configure_file(include/ts/apidefs.h.in include/ts/apidefs.h)

add_subdirectory(src/tscpp/util)
add_subdirectory(src/tscpp/api)
add_subdirectory(src/tsutil)
add_subdirectory(src/tscore)
add_subdirectory(src/records)
add_subdirectory(src/iocore)
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ https://github.com/ariya/FastLZ

~~

include/tscpp/util/Bravo.h is C++ version of puzpuzpuz/xsync's RBMutex
include/tsutil/Bravo.h is C++ version of puzpuzpuz/xsync's RBMutex
Copyright (c) 2021 Andrey Pechkurov (MIT License)
2 changes: 1 addition & 1 deletion cmake/add_atsplugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(CMAKE_SHARED_LIBRARY_PREFIX "")

function(add_atsplugin name)
add_library(${name} MODULE ${ARGN})
target_link_libraries(${name} PRIVATE ts::tsapi ts::tsapicore)
target_link_libraries(${name} PRIVATE ts::tsapi ts::tsutil)
set_target_properties(${name} PROPERTIES PREFIX "")
set_target_properties(${name} PROPERTIES SUFFIX ".so")
install(TARGETS ${name} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Synopsis

.. code-block:: cpp
#include <api/ts_bw_format.h> // Above plus Formatting support.
#include <tsutil/ts_bw_format.h> // Above plus Formatting support.
Description
+++++++++++
Expand Down
13 changes: 5 additions & 8 deletions doc/developer-guide/introduction/header-file-structure.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ The header files are located in the ``include/`` directory. There are several su

The C++ Plugin API is deprecated in ATS 10. It will be removed in ATS 11.

"tscpp/util"
"tsutil"
C++ utilities. These are standalone headers (although they may depend on other headers in the
same directory). These provide functionality that is used inside the |TS| core logic but has been
demonstrated to be useful for plugins as well [#]_. The functions are in the library
``libtscpputil.so``, although many of the utilities are header only. This library is linked in to
``libtsutil.so``, although many of the utilities are header only. This library is linked in to
the ``traffic_server`` binary and so linkage may not be needed for a plugin.

This library is independent of the C++ API and can be used with or without that library.
Expand All @@ -46,17 +46,14 @@ The header files are located in the ``include/`` directory. There are several su
data structures either directly or operationally. This is linked in to the ``traffic_server`` binary therefore
has no explicit linkage when used in the core.

"api"
Plugin API internal header files. These are header files for the internal ``tsapicore`` library (see below). Theses can only be used inside |TS| itself.

New Plugin API layout
=====================

Previously, all plugin interfaces were built into the main |TS| binary. In an effort to enhance modularity and enable compile-time checks, these interfaces have been moved to ``src/api``. They are now isolated into a separate shared library ``tsapi.so``.

In addition, a new static library ``tsapicore.a`` has been created, which contains code used by both the core and the plugins (via the plugin APIs), and is linked into the |TS| binary to keep functionalities consistent.
In addition, a new static library ``tsutil.a`` has been created, which contains code used by both the core and the plugins (via the plugin APIs), and is linked into the |TS| binary to keep functionalities consistent.

Note that ``tsapi.so`` depends on ``tsapicore.a`` and other static libraries in
Note that ``tsapi.so`` depends on ``tsutil.a`` and other static libraries in
the core. ``tsapi.so`` is not statically linked against these dependencies
during its creation, but relies on them being linked into |TS|. To verify these
dependencies, a compile-time sanity check links ``tsapi.so`` with the main
Expand All @@ -81,7 +78,7 @@ The contents of "lib/ts" were broken up and moved to different locations. The he
"include/tscore" for core only headers, while headers to be made available to plugins were moved to
"include/tscpp/util". The corresponding source files were moved to "src/tscore" and "src/tscpp/util"
respectively. "libtsutil" was split in to "libtscore" for the core code and "libtscpputil" for shared
code.
code. Now "libtscpputil" has been combined with "tsapicore" headers into the "tsutil" library.

Appendix
========
Expand Down
2 changes: 1 addition & 1 deletion include/iocore/cache/CacheEvacuateDocVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "tscore/ink_assert.h"

// ts
#include "api/DbgCtl.h"
#include "tsutil/DbgCtl.h"

class CacheEvacuateDocVC : public CacheVC
{
Expand Down
2 changes: 1 addition & 1 deletion include/iocore/eventsystem/EThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "iocore/eventsystem/Thread.h"
#include "iocore/eventsystem/PriorityEventQueue.h"
#include "iocore/eventsystem/ProtectedQueue.h"
#include "tscpp/util/Histogram.h"
#include "tsutil/Histogram.h"

// TODO: This would be much nicer to have "run-time" configurable (or something)
#define PER_THREAD_DATA (1024 * 1024)
Expand Down
2 changes: 1 addition & 1 deletion include/iocore/net/SNIActionItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <openssl/ssl.h>

#include "tscore/ink_inet.h"
#include "api/DbgCtl.h"
#include "tsutil/DbgCtl.h"

class ActionItem
{
Expand Down
2 changes: 1 addition & 1 deletion include/iocore/net/SSLSNIConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#error "Unable to locate PCRE heeader"
#endif

#include "tscpp/util/ts_ip.h"
#include "tsutil/ts_ip.h"

#include "iocore/eventsystem/ConfigProcessor.h"
#include "iocore/net/SNIActionItem.h"
Expand Down
2 changes: 1 addition & 1 deletion include/iocore/net/YamlSNIConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include "iocore/net/SSLTypes.h"

#include "tscpp/util/ts_ip.h"
#include "tsutil/ts_ip.h"

#include "tscore/Errata.h"

Expand Down
2 changes: 1 addition & 1 deletion include/iocore/net/quic/QUICStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#pragma once

#include "api/Metrics.h"
#include "tsutil/Metrics.h"

using ts::Metrics;

Expand Down
2 changes: 1 addition & 1 deletion include/proxy/ControlMatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
#include "tscore/ink_apidefs.h"
#include "tscore/ink_defs.h"
#include "proxy/hdrs/HTTP.h"
#include "tscpp/util/Regex.h"
#include "tsutil/Regex.h"
#include "proxy/hdrs/URL.h"

#if __has_include("pcre/pcre.h")
Expand Down
2 changes: 1 addition & 1 deletion include/proxy/hdrs/HdrToken.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "tscore/ink_defs.h"
#include "tscore/ink_string.h"
#include "tscore/Allocator.h"
#include "tscpp/util/Regex.h"
#include "tsutil/Regex.h"
#include "tscore/ink_apidefs.h"

////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions include/proxy/http/HttpConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
#include "tscore/ink_platform.h"
#include "tscore/ink_inet.h"
#include "tscore/ink_resolver.h"
#include "tscpp/util/Regex.h"
#include "tsutil/Regex.h"
#include "iocore/eventsystem/ConfigProcessor.h"
#include "iocore/net/ConnectionTracker.h"
#include "iocore/net/SessionSharingAPIEnums.h"
#include "records/RecProcess.h"
#include "tscpp/util/ts_ip.h"
#include "api/Metrics.h"
#include "tsutil/ts_ip.h"
#include "tsutil/Metrics.h"

using ts::Metrics;

Expand Down
2 changes: 1 addition & 1 deletion include/proxy/http/PreWarmManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "iocore/net/NetTimeout.h"
#include "proxy/Milestones.h"

#include "api/Metrics.h"
#include "tsutil/Metrics.h"

using ts::Metrics;

Expand Down
2 changes: 1 addition & 1 deletion include/proxy/http/remap/UrlMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "proxy/hdrs/URL.h"
#include "proxy/http/remap/RemapPluginInfo.h"
#include "proxy/http/remap/PluginFactory.h"
#include "tscpp/util/Regex.h"
#include "tsutil/Regex.h"
#include "tscore/List.h"

class NextHopSelectionStrategy;
Expand Down
2 changes: 1 addition & 1 deletion include/proxy/http/remap/UrlRewrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "proxy/http/remap/UrlMapping.h"
#include "proxy/http/remap/UrlMappingPathIndex.h"
#include "proxy/http/HttpTransact.h"
#include "tscpp/util/Regex.h"
#include "tsutil/Regex.h"
#include "proxy/http/remap/PluginFactory.h"
#include "proxy/http/remap/NextHopStrategyFactory.h"

Expand Down
2 changes: 1 addition & 1 deletion include/proxy/http2/HTTP2.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "proxy/hdrs/MIME.h"
#include "records/RecDefs.h"

#include "api/Metrics.h"
#include "tsutil/Metrics.h"

using ts::Metrics;

Expand Down
2 changes: 1 addition & 1 deletion include/proxy/http3/Http3.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#pragma once

#include "tscore/ink_defs.h"
#include "api/Metrics.h"
#include "tsutil/Metrics.h"

using ts::Metrics;

Expand Down
2 changes: 1 addition & 1 deletion include/proxy/logging/LogConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "proxy/logging/LogObject.h"
#include "proxy/logging/RolledLogDeleter.h"
#include "swoc/MemSpan.h"
#include "api/Metrics.h"
#include "tsutil/Metrics.h"

using ts::Metrics;

Expand Down
2 changes: 1 addition & 1 deletion include/records/RecHttp.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "swoc/swoc_ip.h"

#include "tscore/ink_inet.h"
#include "tscpp/util/ts_ip.h"
#include "tsutil/ts_ip.h"
#include "tscore/ink_resolver.h"
#include "ts/apidefs.h"
#include "ts/apidefs.h"
Expand Down
2 changes: 1 addition & 1 deletion include/records/RecYAMLDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <yaml-cpp/yaml.h>

#include <swoc/BufferWriter.h>
#include "api/ts_errata.h"
#include "tsutil/ts_errata.h"

struct CfgNode;

Expand Down
2 changes: 1 addition & 1 deletion include/shared/rpc/RPCRequests.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <string>
#include <variant>
#include "api/ts_bw_format.h"
#include "tsutil/ts_bw_format.h"
#include <yaml-cpp/yaml.h>
#include <tscore/ink_uuid.h>

Expand Down
6 changes: 3 additions & 3 deletions include/ts/ts.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

#include <type_traits>

#include <api/DbgCtl.h>
#include <ts/apidefs.h>
#include <ts/parentselectdefs.h>
#include "tsutil/DbgCtl.h"
#include "ts/apidefs.h"
#include "ts/parentselectdefs.h"

class DiagsConfigState;

Expand Down
2 changes: 1 addition & 1 deletion include/tscore/CryptoHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#pragma once

#include "api/ts_bw_format.h"
#include "tsutil/ts_bw_format.h"
#include "tscore/ink_memory.h"
#include <openssl/evp.h>
#include <string_view>
Expand Down
4 changes: 2 additions & 2 deletions include/tscore/Diags.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

#pragma once

#include <api/DbgCtl.h>
#include "api/SourceLocation.h"
#include "tsutil/DbgCtl.h"
#include "tsutil/SourceLocation.h"
#include "tscore/DiagsTypes.h"
#include "tscore/LogMessage.h"

Expand Down
10 changes: 4 additions & 6 deletions include/tscore/DiagsTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@
#include <cstdarg>
#include <string>
#include <string_view>
#include "api/DbgCtl.h"
#include "tsutil/DbgCtl.h"
#include "tsutil/SourceLocation.h"
#include "tsutil/ts_diag_levels.h"
#include "tscore/BaseLogFile.h"
#include "tscore/ContFlags.h"
#include "tscore/ink_apidefs.h"
#include "tscore/ink_inet.h"
#include "tscore/ink_mutex.h"
#include "tscpp/util/Regex.h"
#include "api/SourceLocation.h"

#include "api/ts_diag_levels.h"
#include "api/DbgCtl.h"
#include "tsutil/Regex.h"

#define DIAGS_MAGIC 0x12345678
#define BYTES_IN_MB 1000000
Expand Down
2 changes: 1 addition & 1 deletion include/tscore/History.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#pragma once

#include "api/SourceLocation.h"
#include "tsutil/SourceLocation.h"
#include "tscore/ink_memory.h"

#define NO_REENTRANT 99999
Expand Down
2 changes: 1 addition & 1 deletion include/tscore/LogMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#pragma once

#include "tscore/DiagsTypes.h"
#include "api/SourceLocation.h"
#include "tsutil/SourceLocation.h"
#include "tscore/Throttler.h"

#include <atomic>
Expand Down
2 changes: 1 addition & 1 deletion include/tscore/Regression.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#pragma once

#include "tscore/ink_platform.h"
#include "tscpp/util/Regex.h"
#include "tsutil/Regex.h"
#include "tscore/Diags.h"

// Each module should provide one or more regression tests
Expand Down
7 changes: 5 additions & 2 deletions include/api/Assert.h → include/tsutil/Assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

#pragma once

#include "api/SourceLocation.h"
#include "swoc/bwf_fwd.h"
#include "tsutil/SourceLocation.h"
#include "tsutil/ts_bw_format.h"
namespace ts
{

Expand Down Expand Up @@ -54,3 +54,6 @@ void do_abort(const SourceLocation &loc, const char *expr, const char *message =
if (!(EX)) { \
ts::do_abort(MakeSourceLocation(), #EX, (MSG)); \
}

#define fatal_error(format, ...) \
ts::do_abort(MakeSourceLocation(), "FATAL", swoc::bwprint(ts::bw_dbg, format, __VA_ARGS__).c_str());
6 changes: 2 additions & 4 deletions include/tscpp/util/Bravo.h → include/tsutil/Bravo.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@

#pragma once

#include "tscpp/util/DenseThreadId.h"

#include "tscore/Diags.h"
#include "tscore/ink_assert.h"
#include "tsutil/DenseThreadId.h"
#include "tsutil/Assert.h"

#include <array>
#include <atomic>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions include/api/DbgCtl.h → include/tsutil/DbgCtl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

#pragma once

#include "api/SourceLocation.h"
#include "api/ts_diag_levels.h"
#include "tsutil/SourceLocation.h"
#include "tsutil/ts_diag_levels.h"
#include "swoc/BufferWriter.h"
#include <atomic>
#include <utility>
Expand Down
Loading

0 comments on commit f600c16

Please sign in to comment.