Files
zeekay 286f257aae De-brand the client: clickhouse-cpp -> datastore-cpp
Pure rename applied on top of upstream tag v2.6.2 (8d2415d6), not HEAD.
The fork was cut at 737145d = v2.6.2-57, which still declared version 2.6.2
in version.h; renaming there would have shipped 57 unreleased commits wearing
a 2.6.2 label. Reset to the tag first so this commit changes names only.

  clickhouse/            -> datastore/            (public include root)
  namespace clickhouse   -> namespace datastore
  CLICKHOUSE_CPP_VERSION -> DATASTORE_CPP_VERSION
  clickhouse-cpp-lib/-ut -> datastore-cpp-lib/-ut (CMake, Bazel)
  CH_MAP_BOOL_TO_UINT8   -> DS_MAP_BOOL_TO_UINT8
  CLICKHOUSE_*           -> DATASTORE_*           (test env vars)
  doc links              -> docs.hanzo.ai/datastore

This client speaks the NATIVE binary protocol only - there is no HTTP path
and no X-ClickHouse-* header anywhere in it, so the header rename that the
HTTP clients required does not apply and nothing here was broken.

The one string that reaches the wire is CLIENT_NAME, sent by both SendHello
and SendQuery's ClientInfo from a single macro, and it lands in
system.query_log.client_name. Both sites still read the one macro, so they
stay consistent and the server's Hello/Query consistency check is satisfied.
Old rows keep the old name; that is a reporting discontinuity, not a
migration, since nothing keys on it.

CI is repointed at our own server: ghcr.io/hanzoai/datastore:26.2.3.2, the
image production runs. Its entrypoint honours DATASTORE_SKIP_USER_SETUP, not
the CLICKHOUSE_ spelling the compose file used, and its config lives in
/etc/hanzo-datastore-server. ci/docker-compose/config.xml is now layered in
as a config.d drop-in so the image keeps its own white-labelling. That file
and users.xml deliberately keep a <clickhouse> root: it must match the roots
of the drop-ins the image ships, and a mismatch fails silently - the server
logs "Merging bypassed" and starts with every drop-in discarded.

The remote-TLS suites used to default to the third-party host
play.clickhouse.com. They now read DATASTORE_SECURE*_HOST and skip when it is
unset rather than point at a host we do not run.

Dropped as upstream infrastructure with no meaning here: AI_POLICY.md
(upstream's policy about their codebase), .travis.yml (dead CI referencing a
third-party apt repo), cross-repo-bug-relay.yml (relays our issues into an
upstream triage repo). LICENSE keeps its copyright notice, as Apache-2.0
requires.

Verified: cmake configure + 115-target build clean; the full suite is green
against ghcr.io/hanzoai/datastore:26.2.3.2 (894 passed, 0 failed); the
pristine v2.6.2 build run against that same server passes the identical set,
and both logged the same 3914 queries under their respective client names.
2026-07-26 11:44:39 -07:00

258 lines
8.3 KiB
CMake

SET ( datastore-cpp-lib-src
base/compressed.cpp
base/input.cpp
base/output.cpp
base/platform.cpp
base/socket.cpp
base/wire_format.cpp
base/endpoints_iterator.cpp
columns/array.cpp
columns/bool.cpp
columns/column.cpp
columns/date.cpp
columns/decimal.cpp
columns/enum.cpp
columns/factory.cpp
columns/geo.cpp
columns/ip4.cpp
columns/ip6.cpp
columns/json.cpp
columns/lowcardinality.cpp
columns/nullable.cpp
columns/numeric.cpp
columns/map.cpp
columns/string.cpp
columns/tuple.cpp
columns/time.cpp
columns/uuid.cpp
columns/itemview.cpp
types/type_parser.cpp
types/types.cpp
block.cpp
client.cpp
query.cpp
# Headers
base/buffer.h
base/compressed.h
base/endpoints_iterator.h
base/input.h
base/open_telemetry.h
base/output.h
base/platform.h
base/projected_iterator.h
base/singleton.h
base/socket.h
base/sslsocket.h
base/string_utils.h
base/string_view.h
base/uuid.h
base/wire_format.h
columns/array.h
columns/bool.h
columns/column.h
columns/date.h
columns/decimal.h
columns/enum.h
columns/factory.h
columns/geo.h
columns/ip4.h
columns/ip6.h
columns/json.h
columns/itemview.h
columns/lowcardinality.h
columns/lowcardinalityadaptor.h
columns/map.h
columns/nothing.h
columns/nullable.h
columns/numeric.h
columns/string.h
columns/time.h
columns/tuple.h
columns/utils.h
columns/uuid.h
types/type_parser.h
types/types.h
block.h
client.h
error_codes.h
exceptions.h
protocol.h
query.h
server_exception.h
)
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_compile_options(/W4)
# remove in 3.0
add_compile_options(/wd4996)
else()
set(cxx_extra_wall "-Wempty-body -Wconversion -Wreturn-type -Wparentheses -Wuninitialized -Wunreachable-code -Wunused-function -Wunused-value -Wunused-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_extra_wall}")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# a little abnormal when clang check conversion
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_extra_wall} -Wno-conversion")
endif()
endif()
IF (WITH_OPENSSL)
LIST(APPEND datastore-cpp-lib-src base/sslsocket.cpp)
ENDIF ()
ADD_LIBRARY (datastore-cpp-lib ${datastore-cpp-lib-src}
version.h)
SET_TARGET_PROPERTIES (datastore-cpp-lib
PROPERTIES
LINKER_LANGUAGE CXX
VERSION ${DATASTORE_CPP_VERSION}
)
TARGET_LINK_LIBRARIES (datastore-cpp-lib
absl::int128
cityhash::cityhash
lz4::lz4
zstd::zstd
)
TARGET_INCLUDE_DIRECTORIES (datastore-cpp-lib
PUBLIC ${PROJECT_SOURCE_DIR}
)
IF (DS_MAP_BOOL_TO_UINT8)
TARGET_COMPILE_DEFINITIONS (datastore-cpp-lib PUBLIC DS_MAP_BOOL_TO_UINT8=1)
ELSE ()
TARGET_COMPILE_DEFINITIONS (datastore-cpp-lib PUBLIC DS_MAP_BOOL_TO_UINT8=0)
ENDIF ()
IF (NOT BUILD_SHARED_LIBS)
ADD_LIBRARY (datastore-cpp-lib-static ALIAS datastore-cpp-lib)
ELSE ()
SET_TARGET_PROPERTIES (datastore-cpp-lib
PROPERTIES
SO_VERSION ${DATASTORE_CPP_VERSION}
SO_VERSION ${DATASTORE_CPP_VERSION_MAJOR}
)
ENDIF ()
IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT DISABLE_CLANG_LIBC_WORKAROUND)
INCLUDE (CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("#include <bits/c++config.h>\nint main() { return __GLIBCXX__ != 0; }"
BUILDING_WITH_LIB_STDCXX)
IF (BUILDING_WITH_LIB_STDCXX)
# there is a problem with __builtin_mul_overflow call at link time
# the error looks like: ... undefined reference to `__muloti4' ...
# caused by clang bug https://bugs.llvm.org/show_bug.cgi?id=16404
# explicit linking to compiler-rt allows to workaround the problem
SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --rtlib=compiler-rt")
# some workaround for linking issues on linux:
# /usr/bin/ld: CMakeFiles/simple-test.dir/main.cpp.o: undefined reference to symbol '_Unwind_Resume@@GCC_3.0'
# /usr/bin/ld: /lib/x86_64-linux-gnu/libgcc_s.so.1: error adding symbols: DSO missing from command line
# FIXME: that workaround breaks clang build on mingw
TARGET_LINK_LIBRARIES (datastore-cpp-lib gcc_s)
ENDIF ()
ENDIF ()
INSTALL (TARGETS datastore-cpp-lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
IF (NOT BUILD_SHARED_LIBS)
IF (NOT WITH_SYSTEM_CITYHASH)
INSTALL (TARGETS cityhash
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
ENDIF()
IF (NOT WITH_SYSTEM_LZ4)
INSTALL (TARGETS lz4
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
ENDIF()
IF (NOT WITH_SYSTEM_ZSTD)
INSTALL (TARGETS zstdstatic
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
ENDIF()
IF (NOT WITH_SYSTEM_ABSEIL)
INSTALL (TARGETS absl_int128
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
ENDIF()
ENDIF()
# general
INSTALL(FILES block.h DESTINATION include/datastore/)
INSTALL(FILES client.h DESTINATION include/datastore/)
INSTALL(FILES error_codes.h DESTINATION include/datastore/)
INSTALL(FILES exceptions.h DESTINATION include/datastore/)
INSTALL(FILES server_exception.h DESTINATION include/datastore/)
INSTALL(FILES protocol.h DESTINATION include/datastore/)
INSTALL(FILES query.h DESTINATION include/datastore/)
INSTALL(FILES version.h DESTINATION include/datastore/)
# base
INSTALL(FILES base/buffer.h DESTINATION include/datastore/base/)
INSTALL(FILES base/compressed.h DESTINATION include/datastore/base/)
INSTALL(FILES base/input.h DESTINATION include/datastore/base/)
INSTALL(FILES base/open_telemetry.h DESTINATION include/datastore/base/)
INSTALL(FILES base/output.h DESTINATION include/datastore/base/)
INSTALL(FILES base/platform.h DESTINATION include/datastore/base/)
INSTALL(FILES base/projected_iterator.h DESTINATION include/datastore/base/)
INSTALL(FILES base/singleton.h DESTINATION include/datastore/base/)
INSTALL(FILES base/socket.h DESTINATION include/datastore/base/)
INSTALL(FILES base/string_utils.h DESTINATION include/datastore/base/)
INSTALL(FILES base/string_view.h DESTINATION include/datastore/base/)
INSTALL(FILES base/uuid.h DESTINATION include/datastore/base/)
INSTALL(FILES base/wire_format.h DESTINATION include/datastore/base/)
INSTALL(FILES base/endpoints_iterator.h DESTINATION include/datastore/base/)
# columns
INSTALL(FILES columns/array.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/bool.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/column.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/date.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/decimal.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/enum.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/factory.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/geo.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/ip4.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/ip6.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/json.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/itemview.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/lowcardinality.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/nothing.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/nullable.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/numeric.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/map.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/string.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/time.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/tuple.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/utils.h DESTINATION include/datastore/columns/)
INSTALL(FILES columns/uuid.h DESTINATION include/datastore/columns/)
# types
INSTALL(FILES types/type_parser.h DESTINATION include/datastore/types/)
INSTALL(FILES types/types.h DESTINATION include/datastore/types/)
IF (WITH_OPENSSL)
TARGET_LINK_LIBRARIES (datastore-cpp-lib OpenSSL::SSL)
ENDIF ()
IF (WIN32 OR MINGW)
TARGET_LINK_LIBRARIES (datastore-cpp-lib wsock32 ws2_32)
ENDIF ()