C · Installation

Installation

#include <ustore/types.h> 1.0.0-rc.1 · d6d40961

UStore builds with CMake into two libraries from one source list, each holding the in-memory engine and every engine the build enables through USTORE_WITH_ROCKSDB, USTORE_WITH_LEVELDB and USTORE_WITH_NVME:

  • The archive, ustore_static, linked as ustore::static or its alias ustore::ustore, carries the objects of the small libraries every build needs: ForkUnion, StringZilla, yyjson and fmt. The storage engines’ own libraries, RocksDB, LevelDB and liburing, stay archives of their own, installed beside it as ustore::rocksdb, ustore::leveldb and ustore::uring, which ustore::static links, so a CMake consumer still names one target. A build without CMake links those archives after libustore_static, or takes the shared library instead.
  • The shared library, ustore_shared, linked as ustore::shared, links them privately and exports only the functions the headers mark USTORE_EXPORT, which its consumers import on Windows through the USTORE_SHARED definition the target hands them.

Each engine is its own object of the archive, so a program links only the engines it opens. USTORE_WITH_NVME stays off until the NVMe sources are ported to this interface.

FetchContent_Declare(
    ustore
    GIT_REPOSITORY https://github.com/unum-cloud/UStore.git
    GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(ustore)
target_link_libraries(your_target PRIVATE ustore::static)

Configured with USTORE_INSTALL, the install writes both libraries, the headers and a CMake package, which find_package reads:

find_package(ustore 1.0 REQUIRED)
target_link_libraries(your_target PRIVATE ustore::shared)

The preview SDK is the sdk component alone: the stripped shared library, the C headers, the C++ wrappers, the package, a .pc file and the license. cpack --config build_release/CPackConfig.cmake archives it as ustore-<version>-<platform>-sdk.tar.gz, a ZIP on Windows, and a consumer without CMake links it through pkg-config --cflags --libs ustore. cmake --install build_release --component static adds ustore::static with the engines’ archives, and --component core the header-only templates.

c/ and cpp/ are both include roots, so every header is spelled <ustore/...> in the tree and once installed, where the headers of both land side by side in one ustore/ folder.

API

Functions

ustore_versionReports the version of the library the program runs against, which may differ from the macros it compiled against.
types.h:1118 ↗
void ustore_version(int *major, int *minor, int *patch);

Parameters

majoroutOutput for the major version.
minoroutOutput for the minor version.
patchoutOutput for the patch version.
ustore_version_nameThe version of the library the program runs against as a static string, like "1.0.0".
types.h:1121 ↗
char const * ustore_version_name(void);

Macros

USTORE_VERSION_MAJORMarks every function the library exports, and nothing else.
types.h:182 ↗
#define USTORE_VERSION_MAJOR 1

On Windows it exports from the shared library, which builds with USTORE_EXPORTING, imports where a consumer of that library defines USTORE_SHARED, as linking ustore::shared does, and expands to nothing for the static library. GCC and Clang give the function default visibility, so it survives -fvisibility=hidden. The major version of UStore, which changes when the C ABI breaks.

USTORE_VERSION_MINORThe minor version of UStore, which changes when the C ABI gains calls.
types.h:185 ↗
#define USTORE_VERSION_MINOR 0
USTORE_VERSION_PATCHThe patch version of UStore, which changes for fixes that keep the C ABI.
types.h:188 ↗
#define USTORE_VERSION_PATCH 0