`merge: upstream/unstable (-X ours, brand preserved)` resolved every conflicting
hunk in our favour. That is right for brand strings and wrong for code: it kept
our old server.h beside their new module.c, so module.c calls
commandResultSuccessListeners and reads from_call_argv off a struct that has
neither, and zslFreeLexRange lost the declarations it still has call sites for.
kvReaderFeed got a newer body calling kvReaderGetReadBuf/CommitRead grafted onto
older locals — an sds newbuf and an oom: label the new body never uses. Across
398 files nothing downstream noticed, because main has not compiled since.
That is what the Dockerfile was working around. Pulling valkey/valkey and copying
binaries out of it produced an image no matter what the source did, so a tree
that cannot build looked like a tree that builds. Now the image compiles this
source, so the build breaking is visible the moment it breaks.
src, deps and tests return to the last coherent commit. Carried forward on top:
- Two identical rdbIsVersionAccepted definitions, differing only in a
parameter name. The rename pass copied the function instead of editing it,
so this never compiled either.
- kv_strtod.h lost the #ifdef USE_FAST_FLOAT that separated its two
implementations, leaving both definitions and a stray #endif.
- extended-redis-compatibility is deleted, not defaulted off. It made the
server answer HELLO with "redis" and name itself Redis in five error
strings. A server that can be configured to lie about what it is has one
setting too many. HELLO now reports kv unconditionally.
- The redis-server and redis-cli install symlinks, on by default via
USE_REDIS_SYMLINKS?=yes. This is why a running instance answered to
redis-cli at all.
- valkeymodule.h and redismodule.h, 3094 lines of adapters mapping old
prefixes onto KVMODULE_*, included by nothing. kvmodule.h is the header.
- deps/libvalkey, one documentation file the rename stranded.
Wire contract is untouched. INFO still reports redis_version, redis_git_sha1,
redis_git_dirty and redis_build_id, and the Lua sandbox still exports
REDIS_VERSION — clients parse those field names, so they are protocol, not
branding. What we choose is what the server calls itself, and it calls itself kv.
Verified: builds clean, and a live instance answers HELLO with "server kv",
reports server_name:kv, has no extended-redis-compatibility directive, and
serves strings and lists.
Libkv
Libkv is the official C client for the KV database. It also supports any server that uses the RESP protocol (version 2 or 3). This project supports both standalone and cluster modes.
Table of Contents
- Features
- Supported platforms
- Building
- Contributing
- Using the library
Features
- Commands are executed in a generic way, with printf-like invocation.
- Supports both
RESP2andRESP3protocol versions. - Supports both synchronous and asynchronous operation.
- Optional support for
MPTCP,TLSandRDMAconnections. - Asynchronous API with several event libraries to choose from.
- Supports both standalone and cluster mode operation.
- Can be compiled with either
makeorCMake.
Supported platforms
This library supports and is tested against Linux, FreeBSD, macOS, and Windows. It should build and run on various proprietary Unixes although we can't run CI for those platforms. If you encounter any issues, please open an issue.
Building
Libkv is written in C targeting C99. Unfortunately we have no plans on supporting C89 or earlier. The project does use a few widely supported compiler extensions, specifically for the bundled sds string library, although we have plans to remove this from the library.
We support plain GNU make and CMake. Following is information on how to build the library.
Building with make
# Build and install the default library
sudo make install
# With all options
sudo USE_TLS=1 USE_RDMA=1 make install
# If your openssl is in a non-default location
sudo USE_TLS=1 OPENSSL_PREFIX=/path/to/openssl make install
Building with CMake
See CMakeLists.txt for all available options.
# Build and install
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
sudo make install
# Build with TLS and RDMA support
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TLS=1 -DENABLE_RDMA=1 ..
sudo make install
Contributing
Please see CONTRIBUTING.md.